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

feat(get_trt): Allow estimated and fallback TotalReadoutTime #477

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

effigies
Copy link
Member

This is work toward nipreps/fmriprep#3009.

The primary purpose is to recover SyN-SDC in cases where TRT is not calculable. When we calculated displacement fields and applied them without round-tripping through a field in Hz, this didn't matter. Now that we do, it would be good to allow tools to supply a trivial value in these cases. I would suggest a power of 2 that is in the neighborhood of a plausible value, such as 0.03125, which only modifies the exponent of a floating point value, and not the significand, minimizing the potential for accumulating floating point error.

While I'm here, I provide a boolean flag (False by default) to fall back to EstimatedTotalReadoutTime or EstimatedEffectiveEchoSpacing.

The order of precedence (if both use_estimated and fallback are enabled) is:

  1. TotalReadoutTime
  2. EstimatedTotalReadoutTime
  3. EffectiveEchoSpacing
  4. EstimatedEffectiveEchoSpacing
  5. EchoSpacing + ParallelReductionFactorInPlane
  6. WaterFatShift + EPIFactor
  7. fallback

We could instead move Estimated* to after WaterFatShift, if that would be better.

Closes #249.

@effigies effigies requested a review from oesteban January 15, 2025 16:18
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.85%. Comparing base (0d86ff4) to head (6fb8fd5).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
sdcflows/utils/epimanip.py 90.32% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #477      +/-   ##
==========================================
- Coverage   83.86%   83.85%   -0.01%     
==========================================
  Files          30       30              
  Lines        2807     2819      +12     
  Branches      360      365       +5     
==========================================
+ Hits         2354     2364      +10     
- Misses        383      384       +1     
- Partials       70       71       +1     

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

effigies and others added 3 commits January 15, 2025 17:32
We previously allowed a KeyError to be raised, but that makes falling
back more difficult. This puts the entire PEDir-dependent branch inside
an if-block.
@effigies
Copy link
Member Author

Given that the only point of contention here is the default value of a flag and not the overall logic, and that the current default is consistent with the preexisting behavior, I'm going to merge this as "safe".

If you disagree with my response, we can change the default in a separate PR. There is also the opportunity to set a different default behavior for an app like fMRIPrep/dMRIPrep where it calls this function.

@effigies effigies merged commit 89fdba9 into nipreps:master Jan 22, 2025
18 checks passed
@effigies effigies deleted the enh/estimated-trt branch January 22, 2025 02:07
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.

Read Philips' EstimatedTotalReadoutTime and EstimatedEffectiveEchoSpacing
2 participants