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: Allow Jacobian correction to be toggled on/off #462

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

effigies
Copy link
Member

@effigies effigies commented Oct 2, 2024

Jacobian correction is optional in fMRIPrep, but it can't be toggled when calling SDCFlows resampling, as in SDCFlows workflows. This:

  • Allows ApplyCoeffsField and init_unwarp_wf to take a boolean jacobian argument that determine whether the Jacobian will be applied.
  • Sets the default for init_unwarp_wf to True to avoid changing behavior in downstream tools that do not upgrade and decide to disable it.
  • Sets the default to False for ApplyCoeffsField. This seems the more conservative option for an interface.
  • Sets jacobian=True when adding ApplyCoeffsField to the init_topup_wf workflow and jacobian=False in the init_syn_sdc_wf

The main thing this enables is fixing nipreps/fmriprep#3366.

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.67%. Comparing base (1350d57) to head (9c48489).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #462      +/-   ##
==========================================
+ Coverage   83.66%   83.67%   +0.01%     
==========================================
  Files          32       32              
  Lines        2816     2818       +2     
  Branches      377      378       +1     
==========================================
+ Hits         2356     2358       +2     
  Misses        390      390              
  Partials       70       70              

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

@effigies effigies force-pushed the fix/optional-jacobian branch from baf7bd8 to 8dfbccf Compare October 2, 2024 20:53
@effigies
Copy link
Member Author

effigies commented Oct 3, 2024

I think this should be uncontroversial, but shout if you disagree @mgxd @oesteban. Will merge in a couple hours if I don't hear.

mgxd
mgxd previously approved these changes Oct 3, 2024
Copy link
Contributor

@mgxd mgxd left a comment

Choose a reason for hiding this comment

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

LGTM, little nits

sdcflows/interfaces/bspline.py Outdated Show resolved Hide resolved
@@ -73,6 +73,7 @@ def _sdc_unwarp(
coordinates: np.ndarray,
pe_info: Tuple[int, float],
hmc_xfm: np.ndarray | None,
jacobian: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming you've checked all instances - inserting a new parameter in the middle of a non keyword only function makes me nervous

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what testing's for. And yes, I've checked.

Co-authored-by: Mathias Goncalves <goncalves.mathias@gmail.com>
@effigies effigies merged commit 3f4bbf7 into nipreps:master Oct 4, 2024
13 checks passed
@effigies effigies deleted the fix/optional-jacobian branch October 4, 2024 00:50
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