Skip to content

MaskIntensityD to support user-specified data field #1520

@wyli

Description

@wyli

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions