Skip to content

Commit 042a67b

Browse files
committed
Use unique_labels.
1 parent e6b973b commit 042a67b

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

fmriprep/cli/run.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,10 @@ def main():
220220

221221
from fmriprep.reports.core import generate_reports
222222

223-
# Generate reports phase
224-
session_list = (
225-
config.execution.get().get('bids_filters', {}).get('bold', {}).get('session')
226-
)
227-
228223
failed_reports = generate_reports(
229-
config.execution.participant_label,
224+
config.execution.unique_labels,
230225
config.execution.fmriprep_dir,
231226
config.execution.run_uuid,
232-
session_list=session_list,
233227
)
234228
write_derivative_description(
235229
config.execution.bids_dir,

fmriprep/cli/workflow.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,17 @@ def build_workflow(config_file, retval):
7777
desc_content = dset_desc_path.read_bytes()
7878
config.execution.bids_description_hash = sha256(desc_content).hexdigest()
7979

80-
# First check that bids_dir looks like a BIDS folder
81-
subject_list = collect_participants(
82-
config.execution.layout, participant_label=config.execution.participant_label
83-
)
84-
8580
# Called with reports only
8681
if config.execution.reports_only:
87-
build_log.log(25, 'Running --reports-only on participants %s', ', '.join(subject_list))
88-
session_list = (
89-
config.execution.bids_filters.get('bold', {}).get('session')
90-
if config.execution.bids_filters
91-
else None
82+
build_log.log(
83+
25,
84+
'Running --reports-only on participants %s',
85+
', '.join(config.execution.unique_labels),
9286
)
93-
9487
failed_reports = generate_reports(
95-
config.execution.participant_label,
88+
config.execution.unique_labels,
9689
config.execution.fmriprep_dir,
9790
config.execution.run_uuid,
98-
session_list=session_list,
9991
)
10092
if failed_reports:
10193
config.loggers.cli.error(
@@ -110,7 +102,7 @@ def build_workflow(config_file, retval):
110102
init_msg = [
111103
"Building fMRIPrep's workflow:",
112104
f'BIDS dataset path: {config.execution.bids_dir}.',
113-
f'Participant list: {subject_list}.',
105+
f'Participant list: {config.execution.unique_labels}.',
114106
f'Run identifier: {config.execution.run_uuid}.',
115107
f'Output spaces: {config.execution.output_spaces}.',
116108
]
@@ -123,7 +115,7 @@ def build_workflow(config_file, retval):
123115

124116
build_log.log(25, f"\n{' ' * 11}* ".join(init_msg))
125117

126-
retval['workflow'] = init_fmriprep_wf()
118+
retval['workflow'] = init_fmriprep_wf(config.execution.unique_labels)
127119

128120
# Check for FS license after building the workflow
129121
if not check_valid_fs_license():

fmriprep/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ class execution(_Config):
441441
"""Select a particular task from all available in the dataset."""
442442
templateflow_home = _templateflow_home
443443
"""The root folder of the TemplateFlow client."""
444+
unique_labels = None
445+
"""Combinations of subject + session identifiers to be preprocessed."""
444446
work_dir = Path('work').absolute()
445447
"""Path to a working directory where intermediate results will be available."""
446448
write_graph = False
@@ -468,6 +470,12 @@ class execution(_Config):
468470
@classmethod
469471
def init(cls):
470472
"""Create a new BIDS Layout accessible with :attr:`~execution.layout`."""
473+
# Convert string literal None to NoneType
474+
if cls.unique_labels:
475+
cls.unique_labels = [
476+
[sub, ses] if ses != 'None' else [sub, None] for sub, ses in cls.unique_labels
477+
]
478+
471479
if cls.fs_license_file and Path(cls.fs_license_file).is_file():
472480
os.environ['FS_LICENSE'] = str(cls.fs_license_file)
473481

0 commit comments

Comments
 (0)