Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Drop header before resampling image to avoid unsafe cast #415

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

effigies
Copy link
Member

int16 images with scale factors can get badly truncated or wrapped. This PR scales the data array and drops the header before passing to Affine().resample() to avoid this. We then re-add the dtype, though this may not be necessary. I think the effects of multiple interpolation are going to be minimal here, so keeping dtypes as expected is probably worth it.

Copy link
Member

@oesteban oesteban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fixed in nitransforms?

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (5ef205f) 76.62% compared to head (efa3528) 76.59%.

Files Patch % Lines
sdcflows/interfaces/utils.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #415      +/-   ##
==========================================
- Coverage   76.62%   76.59%   -0.03%     
==========================================
  Files          32       32              
  Lines        2823     2824       +1     
  Branches      373      373              
==========================================
  Hits         2163     2163              
- Misses        594      595       +1     
  Partials       66       66              
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@effigies
Copy link
Member Author

Not yet. Since that needs to work more broadly, a deeper review will be necessary.

@effigies effigies merged commit 3f29105 into nipreps:master Dec 15, 2023
20 of 22 checks passed
@effigies effigies deleted the fix/unsafe-get_data_dtype-cast branch December 15, 2023 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants