-
Notifications
You must be signed in to change notification settings - Fork 1.5k
patch dataset transform should be applied to the patches only #4477
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
import monai
from monai.transforms import DataStatsd
import numpy as np
img = [{"img": np.zeros((1, 30, 40, 3))}]
patch_func = monai.data.PatchIterd(keys=["img"], patch_size=(30, 40, 1))
transform = DataStatsd(keys=["img"])
for x in monai.data.GridPatchDataset(img, patch_iter=patch_func, transform=transform):
print(x[0]["img"].shape)should generate slices in shape (30, 40, 1),
but the transform is mistakenly applied in the base class:
Data statistics:
Type: <class 'numpy.ndarray'> float64
Shape: (1, 30, 40, 3)
Value range: (0.0, 0.0)
Data statistics:
Type: <class 'numpy.ndarray'> float64
Shape: (1, 30, 40, 1)
Value range: (0.0, 0.0)
(1, 30, 40, 1)
Data statistics:
Type: <class 'numpy.ndarray'> float64
Shape: (1, 30, 40, 1)
Value range: (0.0, 0.0)
(1, 30, 40, 1)
Data statistics:
Type: <class 'numpy.ndarray'> float64
Shape: (1, 30, 40, 1)
Value range: (0.0, 0.0)
(1, 30, 40, 1)
Expected behavior
the super().__iter__() shouldn't trigger the patch transform
MONAI/monai/data/grid_dataset.py
Line 194 in 7504526
| for image in super().__iter__(): |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working