MONAI icon indicating copy to clipboard operation
MONAI copied to clipboard

Provide ability to override `map_items=True` set by default for `Dataset`

Open surajpaib opened this issue 10 months ago • 2 comments

Is your feature request related to a problem? Please describe. https://github.com/Project-MONAI/MONAI/blob/bff4b1559a147f570fc881717eadc7b3e8a98b96/monai/data/dataset.py#L98

In the Dataset class, for any transform applied, map_items=True is the default behavior in the apply_transform helper function.

I'm trying to use some other datasets in MONAI which have an (input, target) tuple as the return from _getitem_. When I superclass this with the MONAI dataset, the tuple is unpacked, and the input and target are operated on as different items in the dataset.

Describe the solution you'd like Ability to provide kwargs to Dataset that propagates to the apply_transform function, allowing disabling this mapping behavior.

Describe alternatives you've considered Not using the Dataset class.

Additional context A lot of datasets have the (input, target) behavior, and it would be useful to be able to wrap these in MONAI dataset classes.

surajpaib avatar Apr 15 '24 15:04 surajpaib

I'm happy to send a PR for this!

surajpaib avatar Apr 17 '24 15:04 surajpaib

Hi @KumoLiu

I've made a PR for this change. Let me know if all good. Thanks!

surajpaib avatar May 21 '24 02:05 surajpaib