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

ENH: Improve support of 4D in sdcflows.interfaces.bspline.ApplyCoeffsField #234

Merged
merged 11 commits into from
Sep 21, 2021

Conversation

oesteban
Copy link
Member

This PR revises the implementation of the core unwarping interface, by enabling sdcflows.transforms.B0FieldTransform to project the coefficients representing the fieldmap into each volume of the input through the head-motion correction matrix, thereby moving the fieldmap with the head motion of that frame and hence applying time-step-wise correction.

I'm not confident this will really add substantial accuracy, but theoretically is the way to go. Given the sophistication (and the pervasive interpolation for each frame of the bspline field), this is not implemented elsewhere (except, perhaps, for applyTOPUP).

Resolves: #233.
Initiated-by: nipreps/fmriprep#2210.

@oesteban
Copy link
Member Author

Okay, this is starting to look pretty good. I'm testing the new code within fMRIPrep and the feeling is optimistic.

It is very cool that B0FieldTransform is capable of producing hmc-ed and sdc-ed time-series, with a single interpolation step. Extension to sampling on surfaces and/or having further transforms to pre-concatenate does not seem like daunting future iterations at this point.

I might need to add some little changes here and there as fMRIPrep continues, but overall this is ready for your judgment.

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2021

Codecov Report

Merging #234 (8ca1e79) into master (1620310) will decrease coverage by 3.77%.
The diff coverage is 73.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #234      +/-   ##
==========================================
- Coverage   93.66%   89.89%   -3.78%     
==========================================
  Files          24       25       +1     
  Lines        1673     1771      +98     
  Branches      191      205      +14     
==========================================
+ Hits         1567     1592      +25     
- Misses         81      150      +69     
- Partials       25       29       +4     
Flag Coverage Δ
travis 85.31% <71.73%> (-3.63%) ⬇️
unittests 90.15% <73.91%> (-3.37%) ⬇️

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

Impacted Files Coverage Δ
sdcflows/workflows/fit/pepolar.py 100.00% <ø> (ø)
sdcflows/transform.py 91.26% <70.83%> (-6.36%) ⬇️
sdcflows/interfaces/bspline.py 87.38% <71.18%> (-6.34%) ⬇️
sdcflows/workflows/apply/correction.py 100.00% <100.00%> (ø)
sdcflows/conftest.py 0.00% <0.00%> (ø)

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 1620310...8ca1e79. Read the comment docs.

Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

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

This overall looks sensible to me. Having a bit of trouble keeping track of which way the HMC transforms are going. I kind of expected more affine inversions, but I'm assuming that you're keeping proper track...

@oesteban oesteban force-pushed the enh/4d-resampling branch 3 times, most recently from 332c7ee to eb93721 Compare September 17, 2021 14:10
@oesteban
Copy link
Member Author

The following steps are:

i. Adding support to prepend additional transforms (e.g., epi-to-anatomical, anatomical-to-standard)
ii. Modulate intensity through the Jacobian of the SDC transform, prior to resampling
iii. An interface to project surfaces (requires (i))

As the three steps require the foundations set in this PR, I think the best path forward is merging this one. I'm aware I'm reducing coverage by ~4%, so I'll think about adding meaningful tests.

@oesteban oesteban merged commit 4b464fa into nipreps:master Sep 21, 2021
@oesteban oesteban deleted the enh/4d-resampling branch September 21, 2021 08:22
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.

Extension of sdcflows.interfaces.bspline.ApplyCoeffsField
3 participants