-
Notifications
You must be signed in to change notification settings - Fork 40
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: insert the gradunwarp workflow in anat template workflow #355
base: master
Are you sure you want to change the base?
Conversation
Cool! I suspect that we can't use FSL warps directly with antsApplyTransforms. @oesteban can nitransforms translate these yet? Some quick googling shows the SCT folks have the transform going the other way, which we could look at if we don't already support this: spinalcordtoolbox/spinalcordtoolbox#2529 |
Right I wrongly assumed these were compatible. Regarding the transforms, I think it would be possible to make gradunwarp output in a nitransforms compatible format maybe skipping/simplifying that step. |
It would be experimental, but the implementation is there mostly thanks to @smoia :) |
Glad to hear I did something useful in my life - I'm not sure I did though. When I was trying not to break nitransforms, I was working with FSL 5.x transformations, but FSL 6.x transforms were breaking the code. I did open an issue about it, but can't find it now... |
I upgraded the workflow in niworkflow to convert the warp from fsl to itk, based on the code of nitransforms. As nitransforms.io only inputs transforms, I inverted the itk input function to output in itk format (flipping sign of the 1st and 2nd dimensions) and from what I understand itk deformation fields are relative. It seems to warp in a sensible way, though the gradient correction transforms are very subtle. sMRIPrep doesn't use the warp field as it directly pass the corrected image in the anat template workflow so that's only used in fMRIPrep when combining all transforms for one-step interpolation. Side question: do you have specific datasets you use for testing fmriprep with sdcflows? (small datasets with different types of fieldmap) I noticed that sdcflows ones are generated on the fly during testing, but I suppose you have integration tests that do not run on github actions. Thanks for all the feedback! |
You left it working for FSL 5. Then I realized that FSL 6 started to break all tests across the board and discovered a nasty bug in their interpolation. I reported the bug to FSL, and they must have fixed it (it wasn't the most transparent process tbh). See? you did something :) @bpinsard, @effigies - I don't know if in this PR or a separate one, but I would like to see sMRIPrep pick up corrected files when available. I don't know this is the PR where that logic would go in (why not?), but if it helps, we are calling our T1w as follows:
|
Is there any interest in using the command from TORTOISE that directly creates an ITK displacement field from coef files? It works for all scanner manufacturers and has a permissive license |
@mattcieslak thanks for this information. When you say displacement field from coeffs files you mean as a replacement to gradunwarp? I plan to work on this feature during the upcoming nipreps sprint. Thanks! |
This should be implemented and functional in nitransforms already, and the dependency is already included. As an additional perk, it makes the transform compatible with BIDS' X5 file format. |
I'm pretty sure we haven't implemented gradient coefficients in nitransforms. It should be possible to adapt gradunwarp, though. |
9f37e54
to
bdd7861
Compare
…aise if inconsistent within contrast
ok, rebase was way too difficult after fit/apply refactor, restarted from scratch. |
Giving it more thought, I think the step should be inserted after denoising but before conform to keep the affine intact. |
…fore conform to keep scanner-relative affines intact
the failing CI will require niworkflows PR to be merged. |
Working on nipreps/fmriprep#1550.
Relies on an updated version of the gradunwarp https://github.com/bpinsard/gradunwarp/tree/fix/mem_leaks.
Unwarping is inserted in the
anat_template_wf
and is thus applied to T1w and T2w.It is applied after denoising to avoid messing with noise structure with interpolation.
Does it make sense?
Necessary PRs:
nipreps/niworkflows#819