Picture a mouse embryo a few days after fertilization. It starts as a single cell and divides — 2 cells, 4, 8, 16, 32, 68 on to the blastocyst stage with more than a hundred tightly packed nuclei. If you want to understand how individual cells make fate decisions during that process — which become the embryo proper, which become extra-embryonic tissue — you need to track every nucleus across time. To do that you first have to find them all, automatically, in three-dimensional fluorescence images where the signal is deliberately kept dim to avoid killing the embryo with the very light used to image it.
That was the problem behind our 2024 paper on nuclear instance segmentation for preimplantation mouse embryos[1]. It pulled me deep into deep-learning segmentation tools, benchmarking, and a realization: no single model does well at every stage of development. More recently the same fundamental challenge resurfaced in a completely different imaging context — spatial transcriptomics on tissue sections, where images are orders of magnitude larger and cells far more heterogeneous. This is the story of both.
What “instance segmentation” actually means
Three things often get conflated. Semantic segmentation answers “where are the nuclei?” as a class label per pixel — everything is either “nucleus” or “not nucleus.” Object detection draws a bounding box around each one. Instance segmentation does both: it finds every individual nucleus and produces a precise pixel-level mask for each. That last step matters for biology. You cannot measure a nucleus’s volume, shape, or fluorescence intensity without an accurate per-nucleus mask, and a nucleus is a good proxy for cell position relative to its neighbors.
For the embryo work we were doing 3D instance segmentation on volumetric stacks acquired by selective plane illumination microscopy (SPIM) — light-sheet imaging, where a thin sheet of light illuminates one plane at a time. The embryos expressed H2B-miRFP720, a near-infrared nuclear reporter the team generated for this work. Near-infrared matters: it reduces phototoxicity, and it does not overlap spectrally with the green, red, and far-red reporters biologists typically want to image alongside it. An embryo can carry up to four distinct reporters at once.
Four problems that make this hard
The challenges are baked into the biology and the microscope physics.
- Low signal-to-noise. Light damages living embryos, so exposure is kept conservative. Foreground ends up only marginally brighter than background.
- Voxel anisotropy. A voxel — the 3D equivalent of a pixel — is not a cube. Because the sample is imaged along a single axis, z-resolution is far worse than xy-resolution. In our data the anisotropy is roughly a factor of 10.
- Increasingly dense packing. At the 16-cell stage the median surface-to-surface distance between neighboring nuclei is about 6.0 µm. By the 32-cell stage it is 2.9 µm; by 64 cells, 1.8 µm; past 100 cells, roughly 0.5 µm. Nuclei do not shrink proportionally, so they end up nearly touching.
- Variable shapes and mitosis. Nuclei divide constantly. A nucleus mid-division looks nothing like a resting one.
Seven models, one benchmark
Rather than commit to one tool and hope, the team systematically evaluated seven networks on the same ground truth. That ground truth is BlastoSPIM 1.0 — more than 570 3D images with roughly 12,000 hand-annotated nuclei, spanning the 2-cell stage to past 100 cells. Each model was trained on 482 of those images and tested on held-out data.
The seven span distinct architectural philosophies:
- Cellpose [2] — a 2D U-Net that predicts spatial gradients flowing toward each cell’s center, then clusters pixels by following those flows. Used here in 2.5D mode, processing 3D stacks slice by slice.
- Stardist-3D [3] — represents each nucleus as a star-convex polyhedron: a set of radial distances from center to boundary. A strong fit for roughly convex objects.
- QCANet [4] — two 3D U-Nets, one for semantic segmentation and one for nucleus-center detection, combined by marker-based watershed.
- RDCNet [5] — 3D recurrent dilated convolutions producing embeddings that cluster into instances.
- U3D-BCD [6] — a 3D residual U-Net jointly predicting foreground masks, instance Boundary Contours, and a signed Distance transform, combined to separate touching objects.
- UNETR-BCD [7] — swaps the encoder for a transformer stack, keeping the BCD decoder.
- ELEPHANT [8] — a 3D U-Net predicting nucleus center, periphery, and background probabilities.
Two metrics. The F1 score first asks, for each predicted nucleus, whether its overlap with a ground-truth nucleus clears an Intersection-over-Union threshold — IoU being overlap volume divided by union volume, with 0.5 the usual cutoff. Matches are binary. Panoptic quality is subtler: it sums the actual IoU values of matched pairs rather than counting them, then penalizes false positives and negatives. It rewards masks that are not merely detected but accurately shaped.
Stardist-3D won on F1 across stages, staying above 95% from the 8-cell stage through the 64-cell stage — well above prior state-of-the-art on comparable confocal data, especially past 32 nuclei. But the interesting result is where the models diverge, and why.
UNETR-BCD scored a panoptic quality roughly equal to Stardist-3D’s despite a clearly worse F1. The explanation: when UNETR-BCD does match a nucleus, the mask fits tightly — it just matches fewer of them. ELEPHANT ran the opposite way, posting a respectable F1 but persistently low panoptic quality, because it constrains every nucleus to an ellipsoid and real nuclei are not ellipsoids. And at very stringent IoU cutoffs Stardist-3D actually falls below UNETR-BCD, since a star-convex polyhedron with a fixed number of rays can only approximate a shape so far. Stardist-3D wins not by dominating every metric but by striking the right balance at the cutoff (≈0.5) that downstream tracking actually needs.
The failure modes were as informative as the scores. U3D-BCD, UNETR-BCD, and RDCNet tended to undersegment — merging two nuclei into one instance. Cellpose did the reverse, oversegmenting into small spurious instances or missing nuclei outright. QCANet usually predicted the right number of centroids, but its watershed post-processing split masks improperly when two centroids landed in the same contiguous region; it also isotropizes the image by degrading xy-resolution, which blurs the boundary between juxtaposed nuclei. Looking only at XY slices, several of these models seem fine. The XZ slices are where the anisotropy shows up.
When one model isn’t enough
Stardist-3D’s performance still deteriorated at the latest stages. So the team annotated 80 more images of late blastocysts — over 6,600 additional nuclear instances, a dataset called BlastoSPIM 2.0 — and trained a dedicated “late blastocyst” model on 72 of them.
It outperformed the original (“early embryo”) model on late blastocysts and underperformed it on embryos with fewer than 64 nuclei. A third model trained on both datasets landed in between — worse than either specialist in its own domain. The practical upshot is a switch: use the early model until the embryo reaches about 48 nuclei, then hand off to the late one. Even on the hardest test set, images with low foreground-background contrast where human annotators struggle, the early model held above 90% F1 through 64 cells and the late model reached ≈86% beyond that.
Around the time this work wrapped, a new class of models began reframing the problem. Cellpose-SAM [9] adapts Meta’s Segment Anything Model — a foundation model trained on enormous quantities of natural images — to cellular segmentation. Its authors used BlastoSPIM as one of their benchmarks. Out of the box it scored AP@0.5 IoU of 0.58 on our data. Fine-tuned on 300 images with ROIs, it reached 0.89. That is a large gain from a modest amount of additional annotation, and it hints at where the field is heading.
From embryos to tissue: a different kind of big
The embryo images span a few hundred micrometers. Segmenting cells in Xenium spatial transcriptomics data operates at another scale entirely. Xenium measures gene expression in situ — RNA transcripts detected directly within a tissue section, their positions recorded at subcellular resolution. To know which transcripts belong to which cell, you need cell segmentation. The images run roughly 30,000 × 30,000 pixels. Typical microscopy images are 1024 × 1024 or smaller.
Xenium stores images as pyramidal OME-TIFFs: the same image at nested zoom levels, each with its own pixel-to-micron factor. Level 0 is 0.2125 µm per pixel; each successive level halves the resolution, down to 6.8 µm at level 5. Level 3 sits closest to 1 µm per pixel, which makes it the best choice for overlaying transcript coordinates with minimal interpolation.
The segmentation challenges differ from the embryo case but are equally real. Tissue contains wildly different cell shapes — compact epithelial cells, sprawling macrophages, dendritic melanocytes — and a model tuned for round cells struggles with the outliers. More surprisingly, the nuclear channel creates a problem of its own. Nuclei are so bright relative to membrane and cytoplasmic staining that running Cellpose on all channels together causes it to segment nuclei, not cells. The nucleus comes out beautifully; the cell boundary, which is what you actually want, is swamped. The fix is counterintuitive: drop the nuclear channel. Run on membrane channels alone and cell morphology is preserved.
The tile-and-stitch pipeline
No GPU holds a 30k × 30k image, let alone runs Cellpose over it. The solution is tiling, which sounds trivial and is not.
Four stages. Load: read the OME-TIFF, parse its OME-XML metadata, extract the relevant channels and max-project to a 2D greyscale image. Tile: divide into 2048 × 2048 pixel tiles with 265 pixels of overlap on each shared edge — a step size of 1783 pixels. Segment: run Cellpose per tile, using cpsam (the SAM-based model), cyto3, or the dedicated nuclei model. Stitch: reassemble.
The overlap is essential. Without it, every cell straddling a tile boundary gets cut in half and produces garbage at the seam. But overlap creates its own problem — the same cell is segmented twice, once by each neighboring tile. We resolve this by centre-cropping: each tile contributes only its inner 1783 × 1783 region to the final canvas, discarding the 132–133 pixel margins where boundary effects are worst.
The second problem is label collisions. Cellpose numbers each segmented cell starting from 1. If tile (0,0) produces cells 1 through 250 and tile (0,1) also produces cells 1 through 250, they overwrite each other. Each tile’s labels are therefore offset by a fixed increment before being written to the global canvas, guaranteeing unique IDs across the whole image.
Compared against Xenium’s own default segmentation on two tissue regions, the pattern is consistent: cpsam on membrane-only channels wins. It reaches F1 around 0.75 and panoptic quality around 0.55, against 0.22–0.45 F1 for cyto3 on the same regions. The channel choice matters nearly as much as the model choice — cyto3’s F1 jumps from 0.22 to 0.40 on one region and from 0.45 to 0.66 on the other simply by dropping the nuclear channel. Precision stays high throughout (above 0.75); recall is the harder metric, which is what you would expect when finding every cell in dense, morphologically diverse tissue.
What comes next
The throughline across both projects is that the hardest part of computational image analysis is rarely the choice of architecture. It is the data engineering: knowing your image format, knowing which channels help and which dominate, understanding the physics of your microscope. Biology constrains the physics, physics constrains image quality, and image quality constrains what any algorithm can achieve.
What I am most curious about is how SAM-based models change the annotation economics. Both projects required enormous manual annotation — roughly 12,000 nuclei for BlastoSPIM 1.0, another 6,600 for 2.0, all hand-drawn by biologists and students. If Cellpose-SAM and its successors can hit high accuracy with 300 images instead of 500, that shifts how much expert labor each new imaging context demands. BlastoSPIM is now part of that ecosystem: someone else’s benchmark, used to evaluate a model we had no hand in building. That is a small but real contribution to the cumulative infrastructure that makes the next tool possible.
For anyone facing a similar problem — large images, heterogeneous cells, imperfect signal — the practical advice is this. Before reaching for a more sophisticated model, look hard at your data. Check what your channels are actually showing you. Inspect the z-slices, not just the xy views. And build your tiling carefully, because the seams are where things go wrong.
References
[1] Nunley H, Shao B, Denberg D, Grover P, Singh J, Avdeeva M, Joyce B, Kim-Yip R, Kohrman A, Biswas A, Watters A, Gal Z, Kickuth A, Chalifoux M, Shvartsman SY, Brown LM, Posfai E. Nuclear instance segmentation and tracking for preimplantation mouse embryos. Development. 2024;151(21):dev202817. doi:10.1242/dev.202817
[2] Stringer C, Wang T, Michaelos M, Pachitariu M. Cellpose: a generalist algorithm for cellular segmentation. Nature Methods. 2021;18:100–106. doi:10.1038/s41592-020-01018-x
[3] Weigert M, Schmidt U, Haase R, Sugawara K, Myers G. Star-convex polyhedra for 3D object detection and segmentation in microscopy. In: IEEE Winter Conference on Applications of Computer Vision (WACV). Snowmass, CO: IEEE; 2020:3655–3662. doi:10.1109/WACV45572.2020.9093435
[4] Tokuoka Y, Yamada TG, Mashiko D, Ikeda Z, Hiroi NF, Kobayashi TJ, Yamagata K, Funahashi A. 3D convolutional neural networks-based segmentation to acquire quantitative criteria of the nucleus during mouse embryogenesis. npj Systems Biology and Applications. 2020;6:32. doi:10.1038/s41540-020-00152-8
[5] Ortiz R, De Medeiros G, Peters AH, Liberali P, Rempfler M. RDCNet: instance segmentation with a minimalist recurrent residual network. In: Machine Learning in Medical Imaging (MLMI), MICCAI 2020 Workshop, Vol. 12436. Cham: Springer; 2020:434–443.
[6] Lin Z, Wei D, Petkova MD, Wu Y, Ahmed Z, K KS, Zou S, Wendt N, Boulanger-Weill J, Wang X, et al. NucMM dataset: 3D neuronal nuclei instance segmentation at sub-cubic millimeter scale. In: Medical Image Computing and Computer Assisted Intervention (MICCAI) 2021, Vol. 12901. Cham: Springer; 2021:164–174.
[7] Hatamizadeh A, Tang Y, Nath V, Yang D, Myronenko A, Landman B, Roth HR, Xu D. UNETR: Transformers for 3D medical image segmentation. In: IEEE/CVF Winter Conference on Applications of Computer Vision (WACV). Waikoloa, HI: IEEE; 2022:1748–1758. doi:10.1109/WACV51458.2022.00181
[8] Sugawara K, Çevrim C, Averof M. Tracking cell lineages in 3D by incremental deep learning. eLife. 2022;11:e69380. doi:10.7554/eLife.69380
[9] Pachitariu M, Rariden M, Stringer C. Cellpose-SAM: superhuman generalization for cellular segmentation. bioRxiv. 2025. doi:10.1101/2025.04.28.651001










