Skip to content

Commit e0bde09

Browse files
committed
fix: ensure output dtype when resampling
1 parent 79e5cad commit e0bde09

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

nitransforms/resampling.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,9 @@ def apply(
189189
)
190190

191191
if isinstance(_ref, ImageGrid): # If reference is grid, reshape
192-
hdr = None
193-
if _ref.header is not None:
194-
hdr = _ref.header.copy()
195-
hdr.set_data_dtype(output_dtype or spatialimage.get_data_dtype())
192+
hdr = _ref.header.copy() if _ref.header is not None else spatialimage.header.__class__()
193+
hdr.set_data_dtype(output_dtype)
194+
196195
moved = spatialimage.__class__(
197196
resampled.reshape(_ref.shape if data.ndim < 4 else _ref.shape + (-1,)),
198197
_ref.affine,

0 commit comments

Comments
 (0)