What it does¶
Cellpose draws an outline around every cell, or every nucleus, in an image. It is a single deep-learning model, trained on many kinds of images, that works on new images without retraining.
Parameters¶
use_cellpose: turns Cellpose on.Which image it sees, one of:
cellpose_channels: one or two marker names, nuclear stain last, e.g."CD45 DNA_1";use_projection: combine many markers into one cell image and one nuclear image; see Channel projection.
segment_cellsandsegment_nuclei: cells, nuclei or both.flow_thresholdandcellprob_threshold, default0.6and-1, set by the segmentation benchmark. sopa’s values, 2 and -6, tile the tissue into cells.Before the model:
clip_limitandclahe_kernel_size(contrast enhancement),gaussian_sigma(smoothing). Both off by default: in the benchmark each lowered F1.pretrained_modelandcellpose_kwargsfor other Cellpose options.
More in Methods and targets and Many markers with Cellpose.
How it works¶
For every pixel the network predicts the probability of being inside a cell, and two flow maps, horizontal and vertical, that point towards the cell’s centre. Following the flows from every pixel groups the pixels into cells, one mask each Stringer et al., 2020.
This pipeline runs Cellpose-SAM, which keeps that output but replaces the network with the image encoder of SAM, a large general-purpose segmentation model. It was trained to ignore channel order and to cope with cell diameters from 7.5 to 120 px, so it needs no diameter estimate, with a small loss of accuracy on very small cells Pachitariu et al., 2025. The model is built into the container, so nothing is downloaded during a run.
Cellpose runs on every patch separately; the patches are then joined. If it segmented both cells and nuclei, they are linked. Cellpose-SAM is slow without a GPU: about 24 s per 1200 px crop on an Apple GPU.
Inputs and outputs. In: one patch of the image, as one or two channels: a cell channel and a
nuclear channel for cells, the nuclear channel alone for nuclei. Out: polygons in the store,
cellpose_cells and with nuclei cellpose_nuclei, then a table cellpose_table after
quantification. See The SpatialData store.
Similar tools¶
StarDist fits star-shaped outlines, which suits round nuclei (Schmidt et al., 2018). This pipeline used it for nuclei until version 2.0.
Mesmer segments cells from one nuclear and one membrane image, trained on tissue (Greenwald et al. 2022).
InstanSeg, the pipeline’s other method, reads every marker at once.
Cellpose is a widely used generalist model. Cellpose-SAM replaced Cellpose 3 (cyto3): in the
projection benchmark Cyto3 fell back to nuclei where Cellpose-SAM found whole cells, at about
eight times the run time. StarDist was dropped in 2.0, since Cellpose and InstanSeg also segment
nuclei.
Read more¶
Cellpose: Stringer et al., 2020.
Cellpose-SAM: Pachitariu et al., 2025.
Version used:
| Module | Tool | Version | Container | Paper |
|---|---|---|---|---|
| SEGMENT_PATCH | Cellpose | 4.2.1.1 | docker.io/josenimo/sopa:2.3.0-1 | Pachitariu et al. (2025) |
- Stringer, C., Wang, T., Michaelos, M., & Pachitariu, M. (2020). Cellpose: a generalist algorithm for cellular segmentation. Nature Methods, 18(1), 100–106. 10.1038/s41592-020-01018-x
- Pachitariu, M., Rariden, M., & Stringer, C. (2025). Cellpose-SAM: superhuman generalization for cellular segmentation. 10.1101/2025.04.28.651001
- Schmidt, U., Weigert, M., Broaddus, C., & Myers, G. (2018). Cell Detection with Star-Convex Polygons. In Medical Image Computing and Computer Assisted Intervention – MICCAI 2018 (pp. 265–273). Springer International Publishing. 10.1007/978-3-030-00934-2_30
- Greenwald, N. F., Miller, G., Moen, E., Kong, A., Kagel, A., Dougherty, T., Fullaway, C. C., McIntosh, B. J., Leow, K. X., Schwartz, M. S., Pavelchek, C., Cui, S., Camplisson, I., Bar-Tal, O., Singh, J., Fong, M., Chaudhry, G., Abraham, Z., Moseley, J., … Van Valen, D. (2021). Whole-cell segmentation of tissue images with human-level performance using large-scale data annotation and deep learning. Nature Biotechnology, 40(4), 555–565. 10.1038/s41587-021-01094-0