mitk.split_label_value_mapping_by_source_and_target_group#
- mitk.split_label_value_mapping_by_source_and_target_group(source: mitk.MultiLabelSegmentation, target: mitk.MultiLabelSegmentation, label_mapping: collections.abc.Iterable) dict[int, dict[int, list[tuple[int, int]]]]#
Partition a label-value mapping by source-group and target-group pair.
Used internally by
transfer_labels()to schedule cross-group transfers correctly.- Parameters:
source – Source
MultiLabelSegmentation.target – Target
MultiLabelSegmentation.label_mapping – Iterable of
(source_value, destination_value)pairs.
- Returns:
A mapping keyed by
(source_group_index, target_group_index)to the subset of label_mapping whose endpoints live in those groups.