mitk.transfer_labels#
- mitk.transfer_labels(source: object, destination: object, label_mapping: collections.abc.Iterable, merge_style: object = <MergeStyle.REPLACE: 0>, overwrite_style: object = <OverwriteStyle.REGARD_LOCKS: 0>, destination_labels: object = None, source_background: SupportsInt = 0, destination_background: SupportsInt = 0, destination_background_locked: bool = False) None#
Transfer label content from source to destination.
Dispatches based on the type of source:
If source is a
MultiLabelSegmentation, destination must also be one. The cross-group transfer is performed in-place.If source is a plain
Image, destination must also be one. destination_labels must be supplied to interpret the pixel values, and source_background / destination_background identify the unlabeled values in each image.
- Parameters:
source – Source segmentation or image.
destination – Target segmentation or image (must match source’s type).
label_mapping – Iterable of
(source_value, destination_value)pairs.merge_style –
MergeStyle. Defaults toREPLACE.overwrite_style –
OverwriteStyle. Defaults toREGARD_LOCKS.destination_labels – Required for image-mode transfers. Iterable of
Labelobjects describing the destination image’s labels.source_background – Unlabeled value in source (image mode only).
destination_background – Unlabeled value in destination (image mode only).
destination_background_locked – If True, treat the destination background pixel as locked.