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: Use seconds as time units when converting PARRECHeader to Nifti1Header #931

Merged
merged 2 commits into from
Jul 13, 2020

Conversation

effigies
Copy link
Member

@effigies effigies commented Jul 6, 2020

parrec2nii produces NIfTI files with TRs in seconds but records the units as msec

#692 proposed retaining the PAR/REC msec units by removing a division by 1000.. This PR instead proposes keeping things in seconds.

cc @Roosted7 @epongpipat

Replaces #692.

@effigies
Copy link
Member Author

effigies commented Jul 6, 2020

Would be glad if anybody wants to weigh in on which of these two approaches is best. I think this one will specifically fix conversions and not break anybody's workflows that have been depending on PARRECImage providing TRs in seconds. I can see an argument for keeping things close to the image, but I think standardizing on seconds makes more sense.

@codecov
Copy link

codecov bot commented Jul 6, 2020

Codecov Report

Merging #931 into maint/3.1.x will decrease coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           maint/3.1.x     #931      +/-   ##
===============================================
- Coverage        91.86%   91.77%   -0.09%     
===============================================
  Files               97       97              
  Lines            12360    12360              
  Branches          2177     2177              
===============================================
- Hits             11354    11344      -10     
- Misses             675      681       +6     
- Partials           331      335       +4     
Impacted Files Coverage Δ
nibabel/parrec.py 92.50% <100.00%> (ø)
nibabel/environment.py 75.00% <0.00%> (-20.00%) ⬇️
nibabel/casting.py 85.28% <0.00%> (-0.87%) ⬇️
nibabel/dft.py 80.36% <0.00%> (-0.62%) ⬇️
nibabel/nifti1.py 92.12% <0.00%> (-0.31%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97a0467...7759954. Read the comment docs.

@effigies
Copy link
Member Author

Anybody care to have a look? If not I'll exercise supreme maintainer powers and hit merge tomorrow.

@Roosted7 @epongpipat I would appreciate your opinions on this one.

@matthew-brett
Copy link
Member

Hmm - it's a tough call, I agree. In general, we try to report the file from nibabel as a native reader would have reported it, but here I guess we allowed ourselves to make the file appear more NIfTI-like. This fix seems better for back-compatibility, but you could also make an argument for converting to seconds only when converting the image to NIfTI format (so, not in _calc_zooms, but in as_analyze...). But - I do agree that we shouldn't make odd milliseconds NIfTI images, they would be very confusing.

@effigies
Copy link
Member Author

How about going with this for a bug fix, and we can move PARRECImage to report msec TR in a feature release?

Maybe it would be worth revisiting #567. I ran into some conceptual problems trying to think through the API there.

@matthew-brett
Copy link
Member

matthew-brett commented Jul 13, 2020 via email

@effigies effigies merged commit 6f5f766 into nipy:maint/3.1.x Jul 13, 2020
@effigies effigies deleted the fix/parrec2nii_t_units branch July 13, 2020 15:16
@effigies effigies added this to the 3.2.0 milestone Aug 16, 2020
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