autods_pet.ops.masks#
Mask operations for multilabel segmentations.
- autods_pet.ops.masks.label_mask(seg, label)[source]#
Extract a binary mask for a single label from a multilabel segmentation.
- Parameters:
seg (
Image) – Multilabel segmentation image (integer-valued).label (
int) – The label value to extract.
- Returns:
Binary
uint8mask where the selected label is 1 and all else is 0.- Return type:
Image
- autods_pet.ops.masks.label_union(seg, labels)[source]#
Binary mask that is the union of several labels.
- autods_pet.ops.masks.keep_largest_component(mask)[source]#
Keep only the largest connected component of a binary mask.
- Parameters:
mask (
Image) – Binary mask (non-zero values are foreground).- Returns:
Binary
uint8mask containing only the largest connected component. If the mask is empty, returns the input unchanged.- Return type:
Image
- autods_pet.ops.masks.fill_holes(mask, max_hole_volume_mm3=None)[source]#
Fill holes in a binary mask.
- Parameters:
- Returns:
Binary
uint8mask with holes filled.- Return type:
Image
- autods_pet.ops.masks.subtract_mask(base, subtract)[source]#
Set difference of two binary masks (base minus subtract).
- Parameters:
base (
Image) – Binary mask to subtract from.subtract (
Image) – Binary mask whose foreground voxels are removed from base.
- Returns:
Binary
uint8mask containing voxels in base that are not in subtract.- Return type:
Image