Skip to content

Commit b729f20

Browse files
committed
fix: participant_labels is None error / better location for config file
1 parent ddfef28 commit b729f20

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

fmriprep/cli/parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,12 @@ def parse_args(args=None, namespace=None):
389389

390390
# First check that bids_dir looks like a BIDS folder
391391
config.init_layout()
392+
all_subjects = config.execution.layout.get_subjects()
393+
if config.execution.participant_label is None:
394+
config.execution.participant_label = all_subjects
395+
392396
participant_label = set(config.execution.participant_label)
393-
missing_subjects = participant_label - set(config.execution.layout.get_subjects())
397+
missing_subjects = participant_label - set(all_subjects)
394398
if missing_subjects:
395399
config.loggers.cli.error(
396400
"One or more participant labels were not found in the BIDS directory: "

fmriprep/cli/workflow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ def build_workflow(config_file, retval):
2727
retval['return_code'] = 1
2828
retval['workflow'] = None
2929

30-
# warn if older results exist
30+
# warn if older results exist: check for dataset_description.json in output folder
3131
msg = check_pipeline_version(
3232
version, output_dir / 'fmriprep' / 'dataset_description.json'
3333
)
3434
if msg is not None:
3535
build_log.warning(msg)
3636

37+
# Please note this is the input folder's dataset_description.json
3738
dset_desc_path = config.execution.bids_dir / 'dataset_description.json'
3839
if dset_desc_path.exists():
3940
from hashlib import sha256

fmriprep/workflows/base.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ def init_fmriprep_wf():
8686
else:
8787
fmriprep_wf.add_nodes([single_subject_wf])
8888

89+
# Dump a copy of the config file into the log directory
90+
log_dir = config.execution.output_dir / 'fmriprep' / 'sub-{}'.format(subject_id) \
91+
/ 'log' / config.execution.run_uuid
92+
log_dir.mkdir(exist_ok=True, parents=True)
93+
config.to_filename(log_dir / 'fmriprep.toml')
94+
8995
return fmriprep_wf
9096

9197

@@ -294,19 +300,11 @@ def init_single_subject_wf(subject_id):
294300
('outputnode.t1w2fsnative_xfm', 'inputnode.t1w2fsnative_xfm'),
295301
('outputnode.fsnative2t1w_xfm', 'inputnode.fsnative2t1w_xfm')]),
296302
])
297-
298-
# Dump a copy of the config file into the log directory
299-
log_dir = config.execution.output_dir / 'fmriprep' / 'sub-{}'.format(subject_id) \
300-
/ 'log' / config.execution.run_uuid
301-
log_dir.mkdir(exist_ok=True, parents=True)
302-
config.to_filename(log_dir / 'fmriprep.toml')
303303
return workflow
304304

305305

306306
def _prefix(subid):
307-
if subid.startswith('sub-'):
308-
return subid
309-
return '-'.join(('sub', subid))
307+
return '-'.join(('sub', subid.lstrip('sub-')))
310308

311309

312310
def _pop(inlist):

0 commit comments

Comments
 (0)