Issue during transforms #7543
Replies: 6 comments
-
Hi @DarthPenguinz, which MONAI version did you use? |
Beta Was this translation helpful? Give feedback.
-
Hi! I have tried 0.5.0 and 1.2.0 |
Beta Was this translation helpful? Give feedback.
-
Hi @DarthPenguinz, I don't think we have such a logic in 1.2.0 since we introduced MONAI/monai/transforms/spatial/dictionary.py Line 358 in c33f1ba |
Beta Was this translation helpful? Give feedback.
-
Hi this is the error from 1.2.0 Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
Hi @DarthPenguinz, could you please try with the latest version since there has been some update in |
Beta Was this translation helpful? Give feedback.
-
Hi! I have just tried it but get this error. Could I check if this is regarding the dimensions of my input? Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
Hi, when executing the following transforms, I get this error
train_transform = Compose(
[
AddChanneld(keys=["image", "label"]),
Spacingd(keys=['image', 'label'], pixdim=(1, 1, 1), mode=("bilinear", "nearest")),
RandFlipd(keys=['image', 'label'], prob=0.5, spatial_axis=0),
RandFlipd(keys=['image', 'label'], prob=0.5, spatial_axis=1),
RandFlipd(keys=['image', 'label'], prob=0.5, spatial_axis=2),
NormalizeIntensityd(keys='image', nonzero=True, channel_wise=True),
RandScaleIntensityd(keys='image', factors=0.1, prob=1.0),
RandShiftIntensityd(keys='image', offsets=0.1, prob=1.0),
DivisiblePadd(k=16, keys=["image", "label"]),
ToTensord(keys=['image', 'label'])
]
)
input data information of the runtime error transform:
name statistics:
Type: <class 'str'>
Value: BRATS_457.nii.gz
image statistics:
Type: <class 'numpy.ndarray'>
Shape: (1, 4, 240, 240, 155)
Value range: (0.0, 1260.0)
label statistics:
Type: <class 'numpy.ndarray'>
Shape: (1, 155, 240, 240)
Value range: (0.0, 3.0)
Traceback (most recent call last):
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/monai/transforms/transform.py", line 48, in apply_transform
return transform(data)
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/monai/transforms/spatial/dictionary.py", line 201, in call
meta_data = d[meta_data_key]
KeyError: 'image_meta_dict'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ryanng/Desktop/3D-UNet/train.py", line 42, in
for data in train_dataloader:
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 631, in next
data = self._next_data()
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 675, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/torch/utils/data/utils/fetch.py", line 51, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/Users/ryanng/Desktop/3D-UNet/dataset.py", line 118, in getitem
proccessed_out = self.transform0
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/monai/transforms/compose.py", line 144, in call
input = apply_transform(transform, input)
File "/Users/ryanng/.pyenv/versions/deeplearning/lib/python3.9/site-packages/monai/transforms/transform.py", line 71, in apply_transform
raise RuntimeError(f"applying transform {transform}") from e
RuntimeError: applying transform <monai.transforms.spatial.dictionary.Spacingd object at 0x31c885040>
Beta Was this translation helpful? Give feedback.
All reactions