MONAI icon indicating copy to clipboard operation
MONAI copied to clipboard

`Lazy=True` ignored when using nested `Compose`

Open KumoLiu opened this issue 2 years ago • 6 comments

Describe the bug Lazy=True ignored when using nested Compose

To Reproduce

import monai.transforms as mt
from monai.data import Dataset

d = {"image": "/workspace/Code/MONAI/tests/testing_data/ref_avg152T1_LR.nii.gz"}

trans = mt.Compose(
        [
            mt.Flipd(keys="image", spatial_axis=1),
            mt.NormalizeIntensityd(keys=["image"]),
            mt.CenterSpatialCropd(keys=["image"], roi_size=(30, 30, 20)),
        ],
        lazy=True,
        log_stats=True
    )
xform = mt.Compose(
    [
        mt.LoadImaged(keys="image", ensure_channel_first=True),
        trans,
        mt.RandAffined(keys="image", prob=1.0, rotate_range=45.0, translate_range=10.0, scale_range=0.15),
    ],
    log_stats=True,
)
out_1 = xform(d)

KumoLiu avatar Oct 19 '23 15:10 KumoLiu

I'll can address that in #7140, I think.

atbenmurray avatar Oct 20 '23 09:10 atbenmurray

Hi @atbenmurray please discuss with the core dev team before self-assigning feature request.

wyli avatar Oct 20 '23 10:10 wyli

Hi @wyli, self assigning of feature requests/enhancements happens all the time. e.g. #6985. Why is it an issue here?

mjorgecardoso avatar Oct 20 '23 11:10 mjorgecardoso

In the process of addressing this in PR #7140

atbenmurray avatar Nov 03 '23 14:11 atbenmurray

In the process of addressing this in PR #7140

it's unclear to me why a single PR is used to address multiple, separate significant bugs (https://github.com/Project-MONAI/MONAI/issues/7130 https://github.com/Project-MONAI/MONAI/issues/7139 https://github.com/Project-MONAI/MONAI/issues/7146). it makes design discussions difficult and in general not following best practices for this project. cc @aylward

wyli avatar Nov 06 '23 14:11 wyli

Hi folks. I'm taking this task back on. The solution for it is still part of PR #7140

atbenmurray avatar Jan 19 '24 13:01 atbenmurray