33
33
from .bold import init_func_preproc_wf
34
34
35
35
36
- def init_fmriprep_wf (subject_list , task_id , echo_idx , run_uuid , work_dir , output_dir , bids_dir ,
36
+ def init_fmriprep_wf (layout , subject_list , task_id , echo_idx , run_uuid , work_dir , output_dir ,
37
37
ignore , debug , low_mem , anat_only , longitudinal , t2s_coreg ,
38
38
omp_nthreads , skull_strip_template , skull_strip_fixed_seed ,
39
39
freesurfer , output_spaces , template , medial_surface_nan , cifti_output , hires ,
@@ -51,15 +51,16 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
51
51
:simple_form: yes
52
52
53
53
import os
54
- os.environ['FREESURFER_HOME'] = os.getcwd()
54
+ from pybids import BIDSLayout
55
55
from fmriprep.workflows.base import init_fmriprep_wf
56
- wf = init_fmriprep_wf(subject_list=['fmripreptest'],
56
+ os.environ['FREESURFER_HOME'] = os.getcwd()
57
+ wf = init_fmriprep_wf(layout=BIDSLayout('.', validate=False),
58
+ subject_list=['fmripreptest'],
57
59
task_id='',
58
60
echo_idx=None,
59
61
run_uuid='X',
60
62
work_dir='.',
61
63
output_dir='.',
62
- bids_dir='.',
63
64
ignore=[],
64
65
debug=False,
65
66
low_mem=False,
@@ -90,6 +91,8 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
90
91
91
92
Parameters
92
93
94
+ layout : BIDSLayout object
95
+ BIDS dataset layout
93
96
subject_list : list
94
97
List of subject labels
95
98
task_id : str or None
@@ -103,8 +106,6 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
103
106
Directory in which to store workflow execution state and temporary files
104
107
output_dir : str
105
108
Directory in which to save derivatives
106
- bids_dir : str
107
- Root directory of BIDS dataset
108
109
ignore : list
109
110
Preprocessing steps to skip (may include "slicetiming", "fieldmaps")
110
111
debug : bool
@@ -182,13 +183,13 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
182
183
reportlets_dir = os .path .join (work_dir , 'reportlets' )
183
184
for subject_id in subject_list :
184
185
single_subject_wf = init_single_subject_wf (
186
+ layout = layout ,
185
187
subject_id = subject_id ,
186
188
task_id = task_id ,
187
189
echo_idx = echo_idx ,
188
190
name = "single_subject_" + subject_id + "_wf" ,
189
191
reportlets_dir = reportlets_dir ,
190
192
output_dir = output_dir ,
191
- bids_dir = bids_dir ,
192
193
ignore = ignore ,
193
194
debug = debug ,
194
195
low_mem = low_mem ,
@@ -230,8 +231,8 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
230
231
return fmriprep_wf
231
232
232
233
233
- def init_single_subject_wf (subject_id , task_id , echo_idx , name , reportlets_dir , output_dir ,
234
- bids_dir , ignore , debug , low_mem , anat_only , longitudinal , t2s_coreg ,
234
+ def init_single_subject_wf (layout , subject_id , task_id , echo_idx , name , reportlets_dir ,
235
+ output_dir , ignore , debug , low_mem , anat_only , longitudinal , t2s_coreg ,
235
236
omp_nthreads , skull_strip_template , skull_strip_fixed_seed ,
236
237
freesurfer , output_spaces , template , medial_surface_nan ,
237
238
cifti_output , hires , use_bbr , bold2t1w_dof , fmap_bspline , fmap_demean ,
@@ -252,13 +253,14 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
252
253
:simple_form: yes
253
254
254
255
from fmriprep.workflows.base import init_single_subject_wf
255
- wf = init_single_subject_wf(subject_id='test',
256
+ from bids import BIDSLayout
257
+ wf = init_single_subject_wf(layout=BIDSLayout('.', validate=False),
258
+ subject_id='test',
256
259
task_id='',
257
260
echo_idx=None,
258
261
name='single_subject_wf',
259
262
reportlets_dir='.',
260
263
output_dir='.',
261
- bids_dir='.',
262
264
ignore=[],
263
265
debug=False,
264
266
low_mem=False,
@@ -288,6 +290,8 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
288
290
289
291
Parameters
290
292
293
+ layout : BIDSLayout object
294
+ BIDS dataset layout
291
295
subject_id : str
292
296
List of subject labels
293
297
task_id : str or None
@@ -321,8 +325,6 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
321
325
Directory in which to save reportlets
322
326
output_dir : str
323
327
Directory in which to save derivatives
324
- bids_dir : str
325
- Root directory of BIDS dataset
326
328
freesurfer : bool
327
329
Enable FreeSurfer surface reconstruction (may increase runtime)
328
330
output_spaces : list
@@ -379,8 +381,7 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
379
381
}
380
382
layout = None
381
383
else :
382
- subject_data , layout = collect_data (
383
- bids_dir , subject_id , task_id , echo_idx , bids_validate = False )
384
+ subject_data = collect_data (layout , subject_id , task_id , echo_idx )[0 ]
384
385
385
386
# Make sure we always go through these two checks
386
387
if not anat_only and subject_data ['bold' ] == []:
@@ -423,7 +424,7 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
423
424
name = 'bidssrc' )
424
425
425
426
bids_info = pe .Node (BIDSInfo (
426
- bids_dir = bids_dir , bids_validate = False ),
427
+ bids_dir = layout . root , bids_validate = False ),
427
428
name = 'bids_info' , run_without_submitting = True )
428
429
429
430
summary = pe .Node (SubjectSummary (output_spaces = output_spaces , template = template ),
@@ -541,4 +542,3 @@ def _prefix(subid):
541
542
if subid .startswith ('sub-' ):
542
543
return subid
543
544
return '-' .join (('sub' , subid ))
544
-
0 commit comments