-
Notifications
You must be signed in to change notification settings - Fork 27
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: Revise the TOPUP workflow and related utilities #278
Conversation
90a137d
to
0ab82fe
Compare
Codecov ReportBase: 83.02% // Head: 82.54% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #278 +/- ##
==========================================
- Coverage 83.02% 82.54% -0.49%
==========================================
Files 25 25
Lines 1850 1873 +23
Branches 278 281 +3
==========================================
+ Hits 1536 1546 +10
- Misses 282 295 +13
Partials 32 32
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
748ba0a
to
72640e7
Compare
72640e7
to
465c767
Compare
Okay, for the most part, this seems to work on both @Gilles86 and @mgxd datasets - not sure about generalization to new datasets, but this is a start. There's a remaining issue with @mgxd, being that the registration between the fieldmap reference and the EPI runs is not great. But I think that should be addressed on a separate issue. Reviews at this point are welcome and important. cc/ @effigies |
8e8df4d
to
062355a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a quick pass, still having trouble conceptualizing the whole process. Do you happen to have some screenshots on how these results look on the troublesome datasets before / after this patch?
In trying to make a more reliable implementation of the workflow, this commit continues with the following improvements: - Added comments indicating the rationale of each step - Removed the ``flatten`` node, as it will not be necessary anymore. Please note that this change breaks compatibility with fMRIPrep, as this node was the entry point for the ``max_trs`` hack (which is not justified anymore). - Aligns the EPIs set prior to topup, and configures topup not to estimate head motion. The benefits are two-fold: we now control the alignment process, and may run it with ``3dVolReg``, which seems more reliable on average; and correction to generate a reference with topup and with SDCFlows (``--debug fieldmaps`` mode) are more consistent. This also saves some registration levels within topup (see changes to the config file), although I don't think this will make it run substantially faster.
I have empirically tested this with Gilles' dataset (oriented LAS, PE along *i*) and with @mgxd's dataset (oriented LAS too, but PE is *j*), so this seems to be accurate. I tested it by manually opening topup's and our fieldmap with Mango and removing the affine's orientation (although switching it off should not and does not alter the result), and checking that data are in the same LR ordering.
Instead of relying on the user's implicit ordering by BIDS' entities, this makes ordering by PE and then readout time higher priority. This means that we will always find *i* encoding blips before *i-* ones, and *j* before *j-*. I suspect that topup will give opposite sign fieldmaps if *i-* is set before *i*.
cbad583
to
d82eb92
Compare
Okay, now with tests revised for the new set of reorientation operations |
Co-authored-by: Mathias Goncalves <mathiasg@stanford.edu>
Co-authored-by: Mathias Goncalves <mathiasg@stanford.edu>
cf8447e
to
af4ca90
Compare
Co-authored-by: Mathias Goncalves <mathiasg@stanford.edu>
I had @Gilles86's reports - maybe he could confirm whether things are looking better now? In his case (nipreps/fmriprep#2830), the displacements were flipped (i.e., in the opposed direction). On your data, @mgxd, the diagnosis was similar. However, the results are still a bit off because (I suspect but haven't confirmed) of the registration between the distorted EPI and fieldmap reference. Still hoping to put together more visual documentation to make it easier to understand both the problem and the solution. |
I'll merge after @eilidhmacnicol's blessings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Left a few comments, but nothing critical to address before merging.
What was the rationale behind the b02b0.cnf
changes? I understand the estmov
change to stop the estimation of motion (since it is done elsewhere) but what was the reasoning for the reduction of levels to calculate the field?
I could have kept the number of levels, but it didn't make much sense as the blips come already aligned. Keeping them was a waste of resources and time for no improvement of the nonlinear component of the estimation (which is done in the latter levels of registration). |
Would it be possible to send me the `_boldref.nii.gz`-files?
…On Mon, 19 Sept 2022, 21:02 Oscar Esteban, ***@***.***> wrote:
still having trouble conceptualizing the whole process. Do you happen to
have some screenshots on how these results look on the troublesome datasets
before / after this patch?
I had @Gilles86 <https://github.com/Gilles86>'s reports - maybe he could
confirm whether things are looking better now? In his case (
nipreps/fmriprep#2830 <nipreps/fmriprep#2830>),
the displacements were flipped (i.e., in the opposed direction).
On your data, @mgxd <https://github.com/mgxd>, the diagnosis was similar.
However, the results are still a bit off because (I suspect but haven't
confirmed) of the registration between the distorted EPI and fieldmap
reference.
Still hoping to put together more visual documentation to make it easier
to understand both the problem and the solution.
—
Reply to this email directly, view it on GitHub
<#278 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIPRTVEAHGZF7MJZ3BT7D3V7C2ERANCNFSM6AAAAAAQDNFDKE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Debugging towards fixing nipreps/fmriprep#2830.
I'm under the impression that the fieldmap estimated by topup is only correct in polarity if the input EPIs are RA{S,I} or AR{S,I} oriented.
The strategy here would be to force all axis to be filled from left to right.
EDIT (new when calling the draft finished):
This PR includes several improvements and changes towards making proper interpretation and reuse of TOPUP outputs:
fix_coeff
node to consider the fact that the internal coordinate system of FSL is LAS (see e80e68d). I'm rather positive about the LR flip, since I've seen it on both @mgxd's and @Gilles86's data (e.g., TOPUP's field and warpfieldXX outputs showcase the flip). I'm less positive about the sign change of the field itself (only testable on @Gilles86's data because @mgxd's has j direction for PE).This does not fully-cover nipreps/fmriprep#2830 (
nor #218EDIT - it does cover this issue, finally), but I have checked that at least the reference image is generated by SDCFlows, and the corresponding by TOPUP are in spatial agreement (i.e., correction is properly applied to the EPIs fed in the estimation) on both datasets (Mathias' and Gilles'). A subsequent PR will address the unwarping ofIntendedFor
EPI targets.