You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using monai.transforms.LoadImage with the nrrdreader to load an NRRD file, the resulting image metadata contains negative strides. This negative strides issue leads to an error when the tensor is collated.
torch/utils/data/_utils/collate.py", line 222, in <listcomp>
return collate([torch.as_tensor(b) for b in batch], collate_fn_map=collate_fn_map)
ValueError: At least one stride in the given numpy array is negative, and tensors with negative strides are not currently supported. (You can probably work around this by making a copy of your array with array.copy().)
Fixes#7798
### Description
Add copy to avoid negative strides when save spatial shape.
### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.
Signed-off-by: YunLiu <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
Describe the bug
When using
monai.transforms.LoadImage
with the nrrdreader to load an NRRD file, the resulting image metadata contains negative strides. This negative strides issue leads to an error when the tensor is collated.To Reproduce
Error log:
Test data:
https://drive.google.com/file/d/1Et-khdsou7E2T_aoX0zLvnld49Xh8YDn/view?usp=drive_link
The text was updated successfully, but these errors were encountered: