Describe the bug
MaskIntensityD supports to use numpy array as a constructor argument for the mask array,
but one of the common use cases is to dynamically set the mask array from a user-specified data key
|
class MaskIntensityd(MapTransform): |
|
""" |
|
Dictionary-based wrapper of :py:class:`monai.transforms.MaskIntensity`. |
|
|
|
Args: |
|
keys: keys of the corresponding items to be transformed. |
|
See also: :py:class:`monai.transforms.compose.MapTransform` |
|
mask_data: if mask data is single channel, apply to evey channel |
|
of input image. if multiple channels, the channel number must |
|
match input data. mask_data will be converted to `bool` values |
|
by `mask_data > 0` before applying transform to input image. |
|
|
|
""" |
|
|
|
def __init__(self, keys: KeysCollection, mask_data: np.ndarray) -> None: |
|
super().__init__(keys) |
Expected behavior
the transform should support:
def __init__(self, keys: KeysCollection, mask_keys: KeysCollection) where data[mask_keys] will be used as the masking array
Describe the bug
MaskIntensityD supports to use numpy array as a constructor argument for the mask array,
but one of the common use cases is to dynamically set the mask array from a user-specified data key
MONAI/monai/transforms/intensity/dictionary.py
Lines 470 to 485 in 50c4659
Expected behavior
the transform should support:
def __init__(self, keys: KeysCollection, mask_keys: KeysCollection)wheredata[mask_keys]will be used as the masking array