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: Mask fieldmap before fitting spline field #396

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

effigies
Copy link
Member

@effigies effigies commented Sep 27, 2023

Previously, we fit a spline field to the within-mask portion of a fieldmap, which could lead to large peaks outside the mask. Applying the mask to the reconstructed field can produce discontinuities in resampling. Instead of attempting to attenuate the peaks outside the mask in a smooth way, we set the fit values outside the mask to zero, and let the spline fit find a smooth field.

Replaces #395.
Addresses nipreps/fmriprep#3013.

Before

Screenshot from 2023-09-26 07-48-16

After

Screenshot from 2023-09-26 10-39-02

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (71a9ae3) 80.56% compared to head (d518851) 80.57%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #396   +/-   ##
=======================================
  Coverage   80.56%   80.57%           
=======================================
  Files          26       26           
  Lines        2290     2291    +1     
  Branches      287      287           
=======================================
+ Hits         1845     1846    +1     
  Misses        401      401           
  Partials       44       44           
Flag Coverage Δ
unittests ∅ <ø> (∅)

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

Files Coverage Δ
sdcflows/interfaces/bspline.py 69.04% <100.00%> (+0.12%) ⬆️

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

Previously, we fit a spline field to the within-mask portion of a
fieldmap, which could lead to large peaks outside the mask. Applying the
mask to the reconstructed field can produce discontinuities in
resampling. Instead of attempting to attenuate the peaks outside the
mask in a smooth way, we set the fit values outside the mask to zero,
and let the spline fit find a smooth field.

In practice, we've found that even fields with large peaks on the edge
of the mask are well fit by this method.
@effigies
Copy link
Member Author

As discussed, going ahead with this option. This will be in the next unstable release of fmriprep.

@effigies effigies merged commit 50ace2a into nipreps:master Sep 29, 2023
18 checks passed
@effigies effigies deleted the fix/mask-bs-filter branch September 29, 2023 19:00
effigies added a commit to effigies/sdcflows that referenced this pull request Oct 4, 2023
effigies added a commit to effigies/sdcflows that referenced this pull request Oct 4, 2023
effigies added a commit that referenced this pull request Nov 9, 2023
FIX: Mask fieldmap before fitting spline field [backport gh-396]
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.

1 participant