From 654783083c7e24f9436a1e83e4a1d85d5e8f9eb3 Mon Sep 17 00:00:00 2001 From: bpinsard Date: Fri, 29 Sep 2023 16:35:23 -0400 Subject: [PATCH 1/4] wip: add a flag to reuse freesurfer as is, for longitudinal base case --- fmriprep/cli/parser.py | 6 ++++++ fmriprep/config.py | 2 ++ fmriprep/workflows/base.py | 1 + 3 files changed, 9 insertions(+) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index 0ccb02ad0..fd77e2033 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -635,6 +635,12 @@ def _slice_time_ref(value, parser): dest='run_reconall', help='Disable FreeSurfer surface preprocessing.', ) + g_fs.add_argument( + "--fs-reuse-base", + action="store_true", + dest="fs_reuse_base", + help="Reuse freesurfer base template (from longitudinal preprocessing)", + ) g_carbon = parser.add_argument_group('Options for carbon usage tracking') g_carbon.add_argument( diff --git a/fmriprep/config.py b/fmriprep/config.py index d0d4668e8..ae64e9d2c 100644 --- a/fmriprep/config.py +++ b/fmriprep/config.py @@ -561,6 +561,8 @@ class workflow(_Config): """Run *fieldmap-less* susceptibility-derived distortions estimation.""" hires = None """Run FreeSurfer ``recon-all`` with the ``-hires`` flag.""" + fs_reuse_base = None + """Adjust pipeline to reuse base template of existing longitudinal freesurfer""" ignore = None """Ignore particular steps for *fMRIPrep*.""" level = None diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 584a60e88..8fd9a2091 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -321,6 +321,7 @@ def init_single_subject_wf(subject_id: str): output_dir=fmriprep_dir, freesurfer=config.workflow.run_reconall, hires=config.workflow.hires, + fs_reuse_base=config.workflow.fs_reuse_base, longitudinal=config.workflow.longitudinal, msm_sulc=msm_sulc, t1w=subject_data['t1w'], From 674bbf1c2f9d6bb5761c6d55be721bb6c9446aac Mon Sep 17 00:00:00 2001 From: bpinsard Date: Mon, 15 Jan 2024 09:32:14 -0500 Subject: [PATCH 2/4] add smriprep PR while awaiting it to be merged --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 320c3da77..db26a8339 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ "pybids >= 0.15.2", "requests", "sdcflows @ git+https://github.com/nipreps/sdcflows.git@master", - "smriprep @ git+https://github.com/nipreps/smriprep.git@master", + "smriprep @ git+https://github.com/nipreps/smriprep.git@refs/pull/393/merge", "tedana >= 23.0.2", "templateflow >= 23.0.0", "toml", From 46363b3bc1b19c3e84b040a477139bab0e2a97a4 Mon Sep 17 00:00:00 2001 From: bpinsard Date: Fri, 15 Mar 2024 16:12:41 -0400 Subject: [PATCH 3/4] rename option to --fs-no-resume --- fmriprep/cli/parser.py | 10 ++++++---- fmriprep/config.py | 2 +- fmriprep/workflows/base.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index fd77e2033..18a3e1838 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -636,10 +636,12 @@ def _slice_time_ref(value, parser): help='Disable FreeSurfer surface preprocessing.', ) g_fs.add_argument( - "--fs-reuse-base", - action="store_true", - dest="fs_reuse_base", - help="Reuse freesurfer base template (from longitudinal preprocessing)", + '--fs-no-resume', + action='store_true', + dest='fs_no_resume', + help='Import precomputed freesurfer without resuming ' + '(longitudinal or fastsurfer data) ' + "!expert option (you know what you're doing)!", ) g_carbon = parser.add_argument_group('Options for carbon usage tracking') diff --git a/fmriprep/config.py b/fmriprep/config.py index ae64e9d2c..983b3bb3b 100644 --- a/fmriprep/config.py +++ b/fmriprep/config.py @@ -561,7 +561,7 @@ class workflow(_Config): """Run *fieldmap-less* susceptibility-derived distortions estimation.""" hires = None """Run FreeSurfer ``recon-all`` with the ``-hires`` flag.""" - fs_reuse_base = None + fs_no_resume = None """Adjust pipeline to reuse base template of existing longitudinal freesurfer""" ignore = None """Ignore particular steps for *fMRIPrep*.""" diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 8fd9a2091..df3268a5d 100644 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -321,7 +321,7 @@ def init_single_subject_wf(subject_id: str): output_dir=fmriprep_dir, freesurfer=config.workflow.run_reconall, hires=config.workflow.hires, - fs_reuse_base=config.workflow.fs_reuse_base, + fs_no_resume=config.workflow.fs_no_resume, longitudinal=config.workflow.longitudinal, msm_sulc=msm_sulc, t1w=subject_data['t1w'], From 6843e5ddfe763c29494f25c3eee5b890823984c8 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 22 Mar 2024 19:35:18 -0400 Subject: [PATCH 4/4] Apply suggestions from code review --- fmriprep/cli/parser.py | 5 ++--- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index 18a3e1838..195706610 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -639,9 +639,8 @@ def _slice_time_ref(value, parser): '--fs-no-resume', action='store_true', dest='fs_no_resume', - help='Import precomputed freesurfer without resuming ' - '(longitudinal or fastsurfer data) ' - "!expert option (you know what you're doing)!", + help='EXPERT: Import pre-computed FreeSurfer reconstruction without resuming. ' + 'The user is responsible for ensuring that all necessary files are present.', ) g_carbon = parser.add_argument_group('Options for carbon usage tracking') diff --git a/pyproject.toml b/pyproject.toml index db26a8339..320c3da77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ "pybids >= 0.15.2", "requests", "sdcflows @ git+https://github.com/nipreps/sdcflows.git@master", - "smriprep @ git+https://github.com/nipreps/smriprep.git@refs/pull/393/merge", + "smriprep @ git+https://github.com/nipreps/smriprep.git@master", "tedana >= 23.0.2", "templateflow >= 23.0.0", "toml",