Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Answers - Spotiflow

First run the main notebook

Exercise: How many spots does Spotiflow find outside the nuclei?

We already have spot_label, which is 0 for every spot that is not inside a nucleus.

282 of 1709 spots are outside the nuclei
<Figure size 800x800 with 1 Axes>

Two different things show up in that plot. Some spots lie just outside the edge of a nucleus, where the Cellpose mask is slightly smaller than the nucleus. But the larger group sits on nuclei that Cellpose did not find at all: every focus in such a nucleus counts as being outside.

So this plot says as much about the segmentation as about the spot detection. A nucleus that is missed does not just lower the number of nuclei, it also removes all of its foci from the analysis. It is worth checking this before drawing conclusions from the counts.

Exercise: What does the detection threshold change?

A higher prob_thresh keeps only the spots the model is more confident about.

prob_thresh 0.3: 2390 spots
prob_thresh 0.5: 1709 spots
prob_thresh 0.7: 1331 spots
<Figure size 1500x500 with 3 Axes>

The spots that appear and disappear are the dim ones. The bright, clearly separated foci are found at every threshold.

If you compare conditions, use the same threshold everywhere: the control images are dimmer, so a threshold that is too high removes more spots there than in the irradiated images.

Bonus exercise: Nuclei on the edge of the image

Loading...

Without the border nuclei we keep 54 of the 69 irradiated nuclei and 87 of the 101 control nuclei. The mean number of foci per irradiated nucleus goes up from about 37 to 40: the nuclei that were cut off by the border did indeed have less foci.

Note the relabel_sequential() step. clear_border() sets the removed nuclei to 0 but keeps the numbers of the others, so there are gaps (1, 2, 5, 6, ...). np.bincount() would then report 0 foci for the missing numbers, and those zeros would pull the mean down again.