unique_segmentation_labels#

petpal.preproc.segmentation_tools.unique_segmentation_labels(segmentation_img: ants.core.ANTsImage | numpy.ndarray, zeroth_roi: bool = False) numpy.ndarray#

Get a list of unique ROI labels in a segmentation image.

Parameters:
  • segmentation_img (ants.core.ANTsImage | np.ndarray) – Segmentation image or array with integer labels for distinct ROIs.

  • zeroth_roi (bool) – Determines whether region index zero should be included as a unique region. If True, 0 is included in output list, otherwise is not included. Default False.

Returns:

labels (np.ndarray) – Array of unique integers in the segmentation image.