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
{{ message }}
Repository navigation
NormalizeIntensity inverse fails on non-contiguous inputs with nonzero=True #9182
The text in this issue was written with AI assistance (Claude and GPT-6 Astra).
NormalizeIntensity(nonzero=True) accepts a transposed image, but inverse() on the result raises a stride error. NormalizeIntensityd and channel_wise=True fail the same way. This blocks restoring the original intensities after normalizing an image whose axes were reordered.
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Expected behavior
round_trip= True for all four cases, as for a contiguous input.
Environment
MONAI dev (6aa4abf) from source, PyTorch 2.14.1+cpu, NumPy 2.5.4, Python 3.12.13, Linux.
Additional context
The error comes from mask.view(-1)[zeroed_idx] = True in NormalizeIntensity.inverse (added in #8905): the boolean mask keeps the transposed layout. Making that mask contiguous fixes all four cases. I have the fix with regression tests and will open a PR.
Activity