-
Notifications
You must be signed in to change notification settings - Fork 294
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: Side-track *sMRIPrep* if a path of anatomical derivatives is given #2036
ENH: Side-track *sMRIPrep* if a path of anatomical derivatives is given #2036
Conversation
Thank your for raising your pull request. Some of the fMRIPRep maintainers will review your changes as soon as time permits. PR ReviewPlease check off boxes as applicable, and elaborate in comments below. Your review is not limited to these topics, as described in the reviewer guide
Please check what applies in the following aspects of the PR: Code documentation
Documentation site
Tests
Data
Dependencies: smriprep
Dependencies: niworkflows
Dependencies: sdcflows
Dependencies: Nipype
Dependencies: other
Reports generated within CI tests
|
ecdd708
to
cedbfbe
Compare
cedbfbe
to
657edac
Compare
I'm hitting this #2041 because sMRIPrep stores the fsnative-to-T1w (and inverse) matrices in ITK format to the output folder, but fMRIPrep expects them to be LTA for LTA concatenation (with the bbregister's LTA). I think this is the best reason to push nitransforms forward (and actually the reason why we started with it at all originally). It should be capable of:
Preparing nitransforms for this (generating a package, fixing nipy/nitransforms#64) will require a fair amount of work. WDYT? - should we try to get over with this asap, or find a workaround (i.e., convert back to LTA with FS tools) and finalize later? |
c1736b7
to
8dfc8e9
Compare
Unless I'm missing something, this report shows results using NiTransforms instead of The final step is to alter the smoke tests to use the new flag (and the proposed feature). It's working locally on ds005, though. Before that final step, it might be appropriate to have a first review here (cc/ @mgxd, @effigies). |
@effigies, @mgxd this seems to be settling in. Let's see the latest CircleCI workflow. If that comes out green, I'll add the fasttrack to ds054 and ds210. I think it's about time to finalize nipreps/smriprep#107 and get that one merged - WDYT? Another thought is that this particular feature will make it easier to quickly tests out things on other extensions (i.e., infants). If we are given a dataset with all the anatomical derivatives we need, we can work right away on the adaptations to the functional workflow (hopefully just the sampling of CIFTI2 files) without being held up by anatomical issues. |
8b03e9f
to
687df86
Compare
Okay, the |
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.
I don't think I finished reviewing but I won't get back to this before the afternoon, so might as well hit submit.
@@ -113,7 +112,8 @@ def select_target(subject_id, space): | |||
mem_gb=DEFAULT_MEMORY_MIN_GB) | |||
resampling_xfm = pe.Node(LTAConvert(in_lta='identity.nofile', out_lta=True), | |||
name='resampling_xfm') | |||
set_xfm_source = pe.Node(ConcatenateLTA(out_type='RAS2RAS'), name='set_xfm_source') | |||
merge_xfm = pe.Node(niu.Merge(2), name="merge_xfm", run_without_submitting=True) | |||
concat_xfm = pe.Node(ConcatenateXFMs(out_fmt="fs"), name="concat_xfm") |
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.
Does ConcatenateXFMs
with out_fmt=='fs'
ensure that no line exceeds 255 characters?
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.
I think it's left empty because the filename =
metadata is not set. But there's no failsafe for that in nitransforms right now, so one could think of setting it and getting bitten by this.
f84ef4c
to
0ab1a70
Compare
… given Summary ------- This PR utilizes nipreps/smriprep#107 to allow a fast skip of the anatomical workflow evaluation, and the need of maintaining the work directory for it. Closes nipreps#1175 Changes suggested ----------------- * [x] Added an ``--anat-derivatives`` flag to the command line. * [x] Integrated the new flag with the new config module. * [x] Estimate existing derivatives using *sMRIPrep*'s tooling. * [x] Pass in the existing derivatives and nipreps/smriprep#107 skips the anatomical workflow fulfilling the workflow API. Potential problems ------------------ This PR does not contain any measures to preserve the reproducibility of *fMRIPrep* if the fast-track is used.
Also, update sdcflows, nitransforms pinned versions
0ab1a70
to
7a5ebe7
Compare
7a5ebe7
to
08c4a29
Compare
This will test the correct ordering of TPMs when computing confounds
As requested by @effigies.
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.
I think this is in a mergeable state now. Considering to set a merge freeze and get it in at last. LMKWYT
@@ -271,3 +266,22 @@ Therefore, if your *fMRIPrep* process crashes and you attempt to re-run it reusi | |||
as much as it could from the previous run, you can either make sure that | |||
the default ``$PWD/work/`` points to a reasonable, reusable path in your environment or | |||
configure a better location on your with ``-w <PATH>``. | |||
|
|||
Can I use *fMRIPrep* for longitudinal studies? |
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.
I don't really know why I added this. If you feel this is worth splitting out to another PR, happy to do it.
mem_gb=mem_gb['resampled'], | ||
name='bold_reg_wf', | ||
omp_nthreads=omp_nthreads, | ||
sloppy=config.execution.debug, |
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.
Added this sloppy mode argument downstream.
if sloppy is True: | ||
downsample = pe.Node(niu.Function( | ||
function=_conditional_downsampling, output_names=["out_file", "out_mask"]), | ||
name='downsample') | ||
workflow.connect([ | ||
(inputnode, downsample, [("t1w_brain", "in_file")]), | ||
(wm_mask, downsample, [("out", "in_mask")]), | ||
(downsample, flt_bbr, [('out_file', 'reference'), | ||
('out_mask', 'wm_seg')]), |
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.
With the utilization of cached, high-resolution anatomical derivatives, the time it took for flirt/bbr to run exploded. With this patch, I minimized flirt/bbr from ~5min to ~11sec (on my desktop, it must be a bit longer on CircleCI). Some other nodes have extended their duration a bit as when used pre-computed anatomical derivatives, but I think now the timing is reasonable.
I used this simple script: https://gist.github.com/oesteban/0c17459936deb18ac81377db4b4763c2 to measure times. We should consider running something like that in fmriprep to get some stats about execution etc.
numpy | ||
pandas | ||
psutil >= 5.4 | ||
pybids >= 0.10.0 | ||
pybids >= 0.10.2 |
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.
This is necessary (uses build_path)
Yup. Will have a look this afternoon. |
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.
Mostly rewording documentation. One question about a potential qform/sform footgun.
Co-Authored-By: Chris Markiewicz <effigies@gmail.com>
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.
minor comments, LGTM
@@ -25,14 +26,15 @@ install_requires = | |||
nibabel ~= 3.0 | |||
nipype ~= 1.4 | |||
nitime | |||
nitransforms >= 20.0.0rc3,<20.2 |
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.
should we pin this to master as well?
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.
we'll need to set a release pin to cut the RC, so I'd leave this. 20.2 should be tolerant enough to allow nitransforms progress without breaking anything used in here.
Co-Authored-By: Mathias Goncalves <goncalves.mathias@gmail.com>
Summary
This PR utilizes nipreps/smriprep#107 to allow a fast skip of the
anatomical workflow evaluation, and the need of maintaining the work
directory for it.
Closes #1175
Changes proposed in this pull request
--anat-derivatives
flag to the command line.skips the anatomical workflow fulfilling the workflow API.
Potential problems
This PR does not contain any measures to preserve the reproducibility of
fMRIPrep if the fast-track is used.