Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions fmriprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,14 @@ def _fallback_trt(value, parser):
help='Path to existing FreeSurfer subjects directory to reuse. '
'(default: OUTPUT_DIR/freesurfer)',
)
g_fs.add_argument(
'--fs-legacy-id',
action=BooleanOptionalAction,
default=False,
help='Use BIDS subject IDs as FreeSurfer subject IDs, for compatibility with '
'reusing FreeSurfer reconstructions generated by older versions of fMRIPrep. '
'This option is incompatible with `--subject-anatomical-reference sessionwise`.',
)
g_fs.add_argument(
'--submm-recon',
action=BooleanOptionalAction,
Expand Down
2 changes: 2 additions & 0 deletions fmriprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ class workflow(_Config):
"""Run FreeSurfer ``recon-all`` with the ``-hires`` flag."""
fs_no_resume = None
"""Adjust pipeline to reuse base template of existing longitudinal freesurfer"""
fs_legacy_id = False
"""Use BIDS subject IDs as FreeSurfer subject IDs."""
ignore = None
"""Ignore particular steps for *fMRIPrep*."""
force = None
Expand Down
11 changes: 11 additions & 0 deletions fmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ def init_single_subject_wf(
(about, ds_report_about, [('out_report', 'in_file')]),
]) # fmt:skip

if config.workflow.fs_legacy_id:
config.loggers.workflow.info(f'Using legacy FreeSurfer subject ID: sub-{subject_id}')
if (
config.workflow.subject_anatomical_reference == 'sessionwise'
and session_id is not None
):
msg = 'Session-wise anatomical reference is incompatible with legacy FreeSurfer subject IDs.'
config.loggers.workflow.error(msg)
raise RuntimeError(msg)
workflow.disconnect(bids_info, create_fs_id, [('session', 'session_id')])

# Set up the template iterator once, if used
template_iterator_wf = None
select_MNI2009c_xfm = None
Expand Down