Decoding Spots with PerRoundMaxChannel

PerRoundMaxChannel is a DecodeSpotsAlgorithm that picks the channel with maximum signal intensity for each round to construct a barcode and then matches the barcode to codewords in the codebook. It is important to normalize the images prior to PerRoundMaxChannel if the channels have significant differences in range of intensity values. The returned DecodedIntensityTable has a distance field that is a decoding quality score. Spots traces with higher signal in non-max channels have a greater distance value reflecting lower confidence in the decoded target.

PerRoundMaxChannel can be used for linearly multiplexed and one hot multiplexed codebooks. Linearly multiplexed assays (e.g. osmFISH, sequential smFISH, and RNAscope) can be decoded with PerRoundMaxChannel by setting trace_building_strategy=TraceBuildingStrategies.SEQUENTIAL. One hot multiplexed assays (e.g. in situ sequencing, seqFISH, and STARmap) are termed ‘one hot’ because every round has exactly one hot channel. They can be decoded with PerRoundMaxChannel by setting trace_building_strategy=TraceBuildingStrategies.EXACT_MATCH or trace_building_strategy=TraceBuildingStrategies.NEAREST_NEIGHBORS. The example below demonstrates the recommended method for decoding one hot multiplexed data using PerRoundMaxChannel.

# Load in situ sequencing experiment and find spots
from starfish.image import ApplyTransform, LearnTransform, Filter
from starfish.types import Axes, TraceBuildingStrategies
from starfish import data, FieldOfView
from starfish.spots import FindSpots
experiment = data.ISS()
fov = experiment.fov()
imgs = fov.get_image(FieldOfView.PRIMARY_IMAGES) # primary images
dots = fov.get_image("dots") # reference round for image registration

# filter raw data
masking_radius = 15
filt = Filter.WhiteTophat(masking_radius, is_volume=False), in_place=True), in_place=True)

# register primary images to reference round
learn_translation = LearnTransform.Translation(reference_stack=dots, axes=Axes.ROUND, upsampling=1000)
transforms_list ={Axes.CH, Axes.ZPLANE}, func="max"))
warp = ApplyTransform.Warp(), transforms_list=transforms_list, in_place=True)

# run blob detector on dots (reference image with every spot)
bd = FindSpots.BlobDetector(
dots_max = dots.reduce((Axes.ROUND, Axes.ZPLANE), func="max")
spots =, reference_image=dots_max)

# Decode spots with PerRoundMaxChannel
from starfish.spots import DecodeSpots
decoder = DecodeSpots.PerRoundMaxChannel(
decoded_intensities =

Gallery generated by Sphinx-Gallery