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
|
for image in super().__iter__(): |
Describe the bug
should generate slices in shape
(30, 40, 1),but the
transformis mistakenly applied in the base class:Expected behavior
the
super().__iter__()shouldn't trigger the patch transformMONAI/monai/data/grid_dataset.py
Line 194 in 7504526