-
Notifications
You must be signed in to change notification settings - Fork 297
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: Restore SyN-SDC #2530
FIX: Restore SyN-SDC #2530
Conversation
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.
Had a quick look, but looks like ds005 doesn't undergo any fieldmap processing, despite the inclusion of the --use-syn-sdc
flag. Not sure why though..
Yeah, I'm trying to debug the workflow creation to figure out what's failing. |
So I think the issue is that we now require |
@oesteban It seems that we're no longer able to run SyN without the following defined for a BOLD file:
Presumably we should be able to have some kind of fallback, since we were able to do it before. What would be the best way to do this in the new SDCFlows? |
Okay, patched in the metadata. It's a little hacky, but I couldn't readily see a cleaner way of doing it. |
Sorry for the slow response.
This is intended. You could convince me to allow setting The second part of the problem (the readout time) could be worked-around - but big fat warnings should be set in place. Here's the problem: now SDCFlows calculates a fieldmap and the actual value of the readout time is necessary to write out the fieldmap in Hz. Since it is a scaling factor, if all runs of the dataset are acquired with exactly the same readout time, it can safely be set to 1.0 in estimation of the fieldmap and reconstruction of the distortion. However, these fieldmaps should not be used for anything else (e.g., averaging fieldmaps to calculate a new "standardized" average across studies) because the units (or more precisely, the scale) are unknown.
This is expected, there are some substantial changes made to the workflow that have made it very different from the original implementation. The most relevant are:
In addition to this, I don't remember exactly whether the T1w inversion is enabled by default. I think in the long term it could be disabled when using mutual information, but I don't know what the tool is doing at the moment by default. Overall, I'll have a deep look into this later this week. I apologize for the disappointment it must be to see this large regression up front. |
Ha, I forgot I had already expressed my concern about the missing PE - #2497. |
I'm picking up on where you left this. The first outstanding problem is that the syn registration was not correctly initialized. I reorganized the syn workflow in two parts: The idea is that the preprocessing massages the T1w and brings it into rough alignment with the EPI, through an Affine transform. However, for ds005 this registration step was far from acceptable. I am playing now with better parameters that bring the T1w into a seemingly good alignment into the EPI (for subject 02 of ds005). I'll keep playing with this. |
Resolves: #85. Context: nipreps/fmriprep#2530
I'm still testing on ds005/sub-01 locally, but this is getting closer to the end line. Results from SDCFlows are starting to seem sufficiently okay to go forward with this PR and separate the problem it its two elements: actual integration (to be addressed within fMRIPrep) and internals and improvement (to be addressed in SDCFlows proper). I will update as soon as I get new local results. |
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.
My results locally on ds005/sub-01 are very good-looking.
Okay, once I finalize some work I have optimizing the Docker image build, the next stop is to add a |
+1 to updating PhaseEncodingDirection, though we should also add it to the source datasets on OpenNeuro. We should be able to determine it visually, so I'm comfortable with this. I don't think adding an arbitrary TRT or EES to the datasets is a good idea. Internally passing around a 1.0 seems fine, but tagging good data with bad metadata would be bad management of these datasets. |
After some thought, I would discourage doing this. We could add a note to the README or similar, suggesting the setting of the PhaseEncodingDirection for preprocessing purposes, but updating the dataset's metadata might have unforeseen consequences, and it is not reflective of the reality of the dataset - even if effectively we set the right metadata value. OpenNeuro wants to be representative of the data out there, and data without PE direction recorded unfortunately exist out there. Now, regarding our test datasets, they are just that - test datasets. We should derive them as much as we need to ensure we cover the maximum of the inputs space. I'm happy setting the two metadata values dynamically on every build (that way we can also test that the workflow crashes when not present). So, let's not modify the metadata anywhere static, WDYT? EDIT: if we finally modify the README suggesting some PE setting, I'd also make sure that note comes with some sort of admonition stating that doing so should be clearly stated in the methods section of derived works. |
**multi-echo not yet covered!!!!**
This PR builds on top of nipreps#2547, unifying the final BOLDref computation.
Yes, there is data like this out there, but I don't see ON's goal as being representative of the range of data available. When data metadata can be safely improved, that seems fine. We detected L/R flips and fixed them post-hoc. But I'm not going to insist on this.
Sounds reasonable.
If the metadata is changed in the dataset, recording the version of the dataset used (and making sure that version has a clear changelog) seems sufficient. If the user modifies the dataset, the methods should reflect that. |
c6975c8
to
fc294a1
Compare
@mgxd @effigies this is ready for merge, I believe. There's one issue though (see #2606) that has held me back to apply the fieldmap estimation to ME data. In other words, in the results for ds210 on Circle you will find that the SyN estimation is executed and produces the expected outputs, but the fieldmaps are not applied. |
fc294a1
to
47c947d
Compare
We'll need to apply to the optimal combination at least. I've got a PR about sinking individual echos. I think we don't want them SDC'd, but should check in with the Tedanites. |
Although I brought up the issue within #2530 and got some mildly opposed initial opinion from @effigies (#2530 (comment)), I've come to think that we should provide the T2star workflow with HMC'ed and SDC'ed echos (confirmation awaiting: #2608 (review)). This comes as an issue related to #2606. This PR proposes that individual echoes are HMC'ed (and SDC'ed when fieldmaps are available) before calculating the optimal combination and the T2star map. I believe this may be beneficial when we combine SDC with modulation by the Jacobian of the distortion (nipreps/sdcflows#238) because that might help restore some (little, admittedly) of the dropout of the later echoes in distorted regions. I would expect more voxels will be deemed as acceptable for the exponential fitting for this reason. It also conceptually simplifies a little, as both SE and ME paths look more alike, and only the little hacks to generate ME iterables and the ``boldbuffer`` are now necessary. Otherwise, SDC would be inserted at a much later stage for ME only.
Awaiting #2610 for final reviews. |
If |
The final mask doesn't look great on ds005. I will retry with a fresh working directory and report back. |
Mask is much improved after clearing the working directory. |
I'm inclined not to impute - adding this to my TODO list. |
7143e33
to
5afadd3
Compare
Okay, I believe the formal aspect of this PR is finished - i.e., the workflow builds without errors and executes to the end. However, the results are not exciting at all. SDC-SyN performs poorly (esp. if you execute locally), mostly due to #2606 (comment). It is also possible that there are better parameters for ANTs, but I don't think we will reach that point of finesse until we do something about the bold reference in registration. An additional issue to look at (probably first with our current implementation of ME -without syn-) is that I got the impression that the Other than that, the RC will be a notch closer when we merge this in. |
Agreed. Let's get this in and work toward further improvements. |
Changes proposed in this pull request
Documentation that should be reviewed