scallops.segmentation.watershed.segment_cells_watershed
- scallops.segmentation.watershed.segment_cells_watershed(image, nuclei, threshold='Li', cyto_channel=None, threshold_correction_factor=1, quantile_threshold=0.2, nuclei_channel=0, rm_small_std=None, rolling_ball=False, sigma=None, closing_radius=None, t=0, chunks=None, depth=30, watershed_method='distance', at_least_nuclei=True)
Segment cells using watershed algorithm, matching cell labels to nuclei labels.
- Parameters:
image (DataArray) – Image with the dimensions (t, c, z, y, x)
nuclei (ndarray) – Labeled segmentation mask of nuclei. Uses nuclei as seeds and matches cell labels to nuclei labels.
cyto_channel (int | Sequence[int] | None) – Index or list of indices for cyto channel(s). If not provided, all channels except for nuclei_channel are used.
threshold (Literal['Li', 'quantile', 'Otsu', 'Local'] | float) – One of Li, Otsu, quantile, or float value If Li, use Li’s iterative Minimum Cross Entropy method
threshold_li(). If Otsu, use Otsu’s methodthreshold_otsu(). If quantile, usethreshold_quantile()threshold_correction_factor (float) – Factor to adjust the computed threshold by.
quantile_threshold (float) – Quantile when threshold is ‘quantile`
threshold – Threshold to apply to cell mask.
nuclei_channel (int) – DAPI channel index
rm_small_std (float | None) – If specified, remove objects smaller than specified number of standard deviations of identified nuclei
rolling_ball (bool) – If true, apply skimage.restoration.rolling_ball subtraction to mask prior to calculating threshold
sigma (float | None) – sigma (optional) gaussian filter sigma to smooth the image prior to computing threshold
closing_radius (int | None) – (optional) disk radius for closing cell labels
t (list[int] | int | None) – Optional list of time indices (0-based) to use for computing cell mask
chunks (tuple[int, int] | None) – Chunk size to perform segmentation using non-overlapping chunks.
depth (int) – The number of elements that each block should share with its neighbors when using dask
at_least_nuclei (bool) – Ensure cells occupy at least the same pixels as nuclei
watershed_method (Literal['binary', 'distance', 'intensity']) – Watershed method: If distance, use distance transformation of the binarized mask. If intensity, use inverted cytoplasm intensity image (same as CellProfiler WATERSHED_I) If binary, use distance from nuclei as in publication The phenotypic landscape of essential human genes <https://pubmed.ncbi.nlm.nih.gov/36347254/>.
- Returns:
Cell labels matching nuclei labels and thresholds if an auto threshold method is used.
- Return type:
tuple[ndarray, float | None]