Skip to content

Commit

Permalink
FIX: Drop header before resampling image to avoid unsafe cast
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Dec 15, 2023
1 parent 5ef205f commit efa3528
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))

Check warning on line 143 in sdcflows/interfaces/utils.py

View check run for this annotation

Codecov / codecov/patch

sdcflows/interfaces/utils.py#L143

Added line #L143 was not covered by tests
# Restore the original on-disk data type
nii.__class__(regridded_img.dataobj, refaff, nii.header).to_filename(retval[i])

Check warning on line 145 in sdcflows/interfaces/utils.py

View check run for this annotation

Codecov / codecov/patch

sdcflows/interfaces/utils.py#L145

Added line #L145 was not covered by tests

self._results["out_data"] = retval

Expand Down

0 comments on commit efa3528

Please sign in to comment.