Cell segmentation — epitools.analysis.segmentation#

This module contains functions for segmenting 3D (ZYX) and 4D (TZXY) images.

epitools.analysis.segmentation.calculate_segmentation(projection, spot_sigma, outline_sigma, threshold)#

Segment an image using a thresholded local-minima-seeded watershed algorith.

This will segment cells in images with marked membranes that have a high signal intensity.

The two sigma parameters allow tuning the segmentation result. Under the hood, this algorithm first applies two Gaussian blurs, then uses a local minima detection and seeded watershed. Afterwards, all objects are removed that have an average intensity below a given threshold.

Parameters:
  • projection (ndarray[tuple[int, ...], dtype[float64]]) – A projected image stack processed using Epitools.

  • spot_sigma (float) – Controls how close segmented cells can be - larger values result in more seeds used in the segmentation

  • outline_sigma (float) – Controls how precisely segmented cells are outlined - larger values result in more precise (rougher) cell boundaries.

  • threshold (float) – Cells with an average intensity below threshold are will be removed from the segmentation and treated as background.

Returns:

np.NDArray

Seeds used in the segmentated

np.NDArray

Labels of the segmented image (0 corresponds to background)

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[int64]]]