Segmentation Module

Segmentation [Cellpose]

Segmentation Module currently utilizes the Cellpose model only (more to come soon), a generalist algorithm for cell segmentation, to process volumetric datasets. It provides tools to perform and visualize 3D segmentation on microscopy images, facilitating the analysis of biological structures within a 3D space.

exm.segmentation.segmentation.display_3d_masks(image, masks)[source]

Displays the 3D masks on the given image.

Parameters:
exm.segmentation.segmentation.segment_3d(volume, model, downsample=False, chan=0, chan2=0, diameter=30, flow_threshold=0.4, cellprob_threshold=0, do_3D=True)[source]

Performs 3D segmentation on the given volume using the provided model.

Parameters:
  • volume (numpy.ndarray) – The volume to segment.

  • model (cellpose.models.CellposeModel) – The model to use for segmentation.

  • downsample (bool) – Whether to downsample the volume before segmentation. Default is False.

  • chan (int) – The channel to use for segmentation. Default is 0.

  • chan2 (int) – The second channel to use for segmentation. Default is 0.

  • diameter (float) – Estimated diameter of objects to segment. Set to 0 to auto-estimate. Default is 30.

  • flow_threshold (float) – The flow threshold for the segmentation. Default is 0.4.

  • cellprob_threshold (float) – The cell probability threshold for the segmentation. Default is 0.

  • do_3D (bool) – Whether to perform 3D segmentation. Default is True.

Returns:

The segmented masks.

Return type:

numpy.ndarray