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
NibabelWriter fails on 2D channel-less arrays with no target affine (regression in 1.6.0) #9166
NibabelWriter.set_metadata() raises TypeError: '>=' not supported between instances of 'NoneType' and 'int' for a 2D array written with channel_dim=None when no original_affine / spatial_shape is given. The same call works for 3D arrays, and it worked for 2D arrays in 1.5.1.
spatial_resample now derives the spatial rank from get_spatial_ndim(img) (the MetaTensor.spatial_ndim path). For this input that gives rank 1, so the spatial_size is None and spatial_rank > 1 auto-size branch is skipped. spatial_size stays None and then reaches fall_back_tuple(..., lambda x: x >= 0).
Hi @garciadias, thanks for the clear repro and the pointer to get_spatial_ndim. Is anyone already working on this? If not, I'd like to take it.
My plan is to trace how spatial_resample derives the spatial rank for a channel-less 2D array and fix that path, then add a regression test based on your (64, 64) example. I'm happy to adjust if you'd prefer a different approach.
Hi @Karunasagar12 If you wanted to look into this issue feel free but @Spenhouet mentioned he had a fix already for it. It you wanted to check that PR it would help to have more eyes on things, thanks.
Activity
Karunasagar12 commentedon Oct 18, 2026
Hi @garciadias, thanks for the clear repro and the pointer to
get_spatial_ndim. Is anyone already working on this? If not, I'd like to take it.My plan is to trace how
spatial_resamplederives the spatial rank for a channel-less 2D array and fix that path, then add a regression test based on your (64, 64) example. I'm happy to adjust if you'd prefer a different approach.ericspod commentedon Oct 20, 2026
Hi @Karunasagar12 If you wanted to look into this issue feel free but @Spenhouet mentioned he had a fix already for it. It you wanted to check that PR it would help to have more eyes on things, thanks.
Fix unspecified spatial size for rank-one resampling and add NIfTI re…
test(nifti): cover 2D writer without target affine (#9173)