Skip to content

Commit

Permalink
Merge pull request #415 from effigies/fix/unsafe-get_data_dtype-cast
Browse files Browse the repository at this point in the history
FIX: Drop header before resampling image to avoid unsafe cast
  • Loading branch information
effigies authored Dec 15, 2023
2 parents 5ef205f + efa3528 commit 3f29105
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sdcflows/interfaces/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ def _run_interface(self, runtime):
nii.__class__(nii.dataobj, refaff, nii.header).to_filename(retval[i])
continue

resampler.apply(nii).to_filename(retval[i])
# Hack around nitransforms' unsafe cast by dropping get_data_dtype that conflicts
# with effective dtype
# NT23_0_1: Isssue in nitransforms.base.TransformBase.apply
regridded_img = resampler.apply(nii.__class__(np.asanyarray(nii.dataobj), nii.affine))
# Restore the original on-disk data type
nii.__class__(regridded_img.dataobj, refaff, nii.header).to_filename(retval[i])

self._results["out_data"] = retval

Expand Down

0 comments on commit 3f29105

Please sign in to comment.