Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MaskIntensityD to support user-specified data field #1520

Closed
wyli opened this issue Jan 28, 2021 · 1 comment · Fixed by #1521
Closed

MaskIntensityD to support user-specified data field #1520

wyli opened this issue Jan 28, 2021 · 1 comment · Fixed by #1521
Assignees

Comments

@wyli
Copy link
Contributor

wyli commented Jan 28, 2021

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

@Nic-Ma Nic-Ma self-assigned this Jan 28, 2021
@Nic-Ma
Copy link
Contributor

Nic-Ma commented Jan 28, 2021

Good suggestion. I will update it soon.
Thanks for raising it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants