segmentations_merge#
- petpal.preproc.segmentation_tools.segmentations_merge(segmentation_primary: numpy.ndarray, segmentation_secondary: numpy.ndarray, regions: list) numpy.ndarray#
Merge segmentations by assigning regions to a primary segmentation image from a secondary segmentation. Region indices are pulled from the secondary into the primary from a list.
Primary and secondary segmentations must have the same shape and orientation.
- Parameters:
segmentation_primary (np.ndarray) – The main segmentation to which new regions will be added.
segmentation_secondary (np.ndarray) – Distinct segmentation with regions to add to the primary.
regions (list) – List of regions to pull from the secondary to add to the primary.
- Returns:
segmentation_primary (np.ndarray) –
- The input segmentation with new
regions added.