Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` orig_labels: original labels that map to others. target_labels: expected label values, 1: 1 map to the `orig_labels`
(
self,
keys: KeysCollection,
orig_labels: Sequence,
target_labels: Sequence,
dtype: DtypeLike = np.float32,
allow_missing_keys: bool = False,
)
| 1536 | backend = MapLabelValue.backend |
| 1537 | |
| 1538 | def __init__( |
| 1539 | self, |
| 1540 | keys: KeysCollection, |
| 1541 | orig_labels: Sequence, |
| 1542 | target_labels: Sequence, |
| 1543 | dtype: DtypeLike = np.float32, |
| 1544 | allow_missing_keys: bool = False, |
| 1545 | ) -> None: |
| 1546 | """ |
| 1547 | Args: |
| 1548 | keys: keys of the corresponding items to be transformed. |
| 1549 | See also: :py:class:`monai.transforms.compose.MapTransform` |
| 1550 | orig_labels: original labels that map to others. |
| 1551 | target_labels: expected label values, 1: 1 map to the `orig_labels`. |
| 1552 | dtype: convert the output data to dtype, default to float32. |
| 1553 | if dtype is from PyTorch, the transform will use the pytorch backend, else with numpy backend. |
| 1554 | allow_missing_keys: don't raise exception if key is missing. |
| 1555 | |
| 1556 | """ |
| 1557 | super().__init__(keys, allow_missing_keys) |
| 1558 | self.mapper = MapLabelValue(orig_labels=orig_labels, target_labels=target_labels, dtype=dtype) |
| 1559 | |
| 1560 | def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]: |
| 1561 | d = dict(data) |
nothing calls this directly
no test coverage detected