Skip to content

Commit 2417714

Browse files
committed
test latest commit in smriprep, use unique layout object, integrate new datasinks (close #965, close #955)
1 parent 9b77fcc commit 2417714

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

fmriprep/__about__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
'nilearn',
9090
'nipype>=1.1.6',
9191
'nitime',
92-
'niworkflows',
92+
'niworkflows>=0.7.0,<0.8.0a',
9393
'numpy',
9494
'pandas',
9595
'psutil>=5.4',
@@ -104,10 +104,8 @@
104104

105105

106106
LINKS_REQUIRES = [
107-
'git+https://github.com/oesteban/niworkflows.git@'
108-
'0208e37b8915d89720856ac76becbed7592437c5#niworkflows-0.6.1',
109107
'git+https://github.com/oesteban/smriprep.git@'
110-
'e504ddaca62da545b75a7cbc629ff91b8b48f2ee#smriprep-0.0.4',
108+
'2ad4639b308a5d13183819e13bcb3ca6d4d93eac#smriprep-0.0.4',
111109
]
112110

113111
TESTS_REQUIRES = [

fmriprep/cli/run.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ def build_workflow(opts, retval):
552552
from subprocess import check_call, CalledProcessError, TimeoutExpired
553553
from pkg_resources import resource_filename as pkgrf
554554
from shutil import copyfile
555+
from bids import BIDSLayout
555556

556557
from nipype import logging, config as ncfg
557558
from niworkflows.utils.bids import collect_participants
@@ -606,9 +607,9 @@ def build_workflow(opts, retval):
606607

607608
# First check that bids_dir looks like a BIDS folder
608609
bids_dir = os.path.abspath(opts.bids_dir)
610+
layout = BIDSLayout(bids_dir, validate=False)
609611
subject_list = collect_participants(
610-
bids_dir, participant_label=opts.participant_label,
611-
bids_validate=False)
612+
layout, participant_label=opts.participant_label)
612613

613614
# Load base plugin_settings from file if --use-plugin
614615
if opts.use_plugin is not None:
@@ -716,6 +717,7 @@ def build_workflow(opts, retval):
716717
logger.warning('Option --debug is deprecated and has no effect')
717718

718719
retval['workflow'] = init_fmriprep_wf(
720+
layout=layout,
719721
subject_list=subject_list,
720722
task_id=opts.task_id,
721723
echo_idx=opts.echo_idx,
@@ -731,7 +733,6 @@ def build_workflow(opts, retval):
731733
skull_strip_fixed_seed=opts.skull_strip_fixed_seed,
732734
work_dir=work_dir,
733735
output_dir=output_dir,
734-
bids_dir=bids_dir,
735736
freesurfer=opts.run_reconall,
736737
output_spaces=output_spaces,
737738
template=opts.template,

fmriprep/workflows/base.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from .bold import init_func_preproc_wf
3434

3535

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,
3737
ignore, debug, low_mem, anat_only, longitudinal, t2s_coreg,
3838
omp_nthreads, skull_strip_template, skull_strip_fixed_seed,
3939
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
5151
:simple_form: yes
5252
5353
import os
54-
os.environ['FREESURFER_HOME'] = os.getcwd()
54+
from pybids import BIDSLayout
5555
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'],
5759
task_id='',
5860
echo_idx=None,
5961
run_uuid='X',
6062
work_dir='.',
6163
output_dir='.',
62-
bids_dir='.',
6364
ignore=[],
6465
debug=False,
6566
low_mem=False,
@@ -90,6 +91,8 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
9091
9192
Parameters
9293
94+
layout : BIDSLayout object
95+
BIDS dataset layout
9396
subject_list : list
9497
List of subject labels
9598
task_id : str or None
@@ -103,8 +106,6 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
103106
Directory in which to store workflow execution state and temporary files
104107
output_dir : str
105108
Directory in which to save derivatives
106-
bids_dir : str
107-
Root directory of BIDS dataset
108109
ignore : list
109110
Preprocessing steps to skip (may include "slicetiming", "fieldmaps")
110111
debug : bool
@@ -182,13 +183,13 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
182183
reportlets_dir = os.path.join(work_dir, 'reportlets')
183184
for subject_id in subject_list:
184185
single_subject_wf = init_single_subject_wf(
186+
layout=layout,
185187
subject_id=subject_id,
186188
task_id=task_id,
187189
echo_idx=echo_idx,
188190
name="single_subject_" + subject_id + "_wf",
189191
reportlets_dir=reportlets_dir,
190192
output_dir=output_dir,
191-
bids_dir=bids_dir,
192193
ignore=ignore,
193194
debug=debug,
194195
low_mem=low_mem,
@@ -230,8 +231,8 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output
230231
return fmriprep_wf
231232

232233

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,
235236
omp_nthreads, skull_strip_template, skull_strip_fixed_seed,
236237
freesurfer, output_spaces, template, medial_surface_nan,
237238
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,
252253
:simple_form: yes
253254
254255
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',
256259
task_id='',
257260
echo_idx=None,
258261
name='single_subject_wf',
259262
reportlets_dir='.',
260263
output_dir='.',
261-
bids_dir='.',
262264
ignore=[],
263265
debug=False,
264266
low_mem=False,
@@ -288,6 +290,8 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
288290
289291
Parameters
290292
293+
layout : BIDSLayout object
294+
BIDS dataset layout
291295
subject_id : str
292296
List of subject labels
293297
task_id : str or None
@@ -321,8 +325,6 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
321325
Directory in which to save reportlets
322326
output_dir : str
323327
Directory in which to save derivatives
324-
bids_dir : str
325-
Root directory of BIDS dataset
326328
freesurfer : bool
327329
Enable FreeSurfer surface reconstruction (may increase runtime)
328330
output_spaces : list
@@ -379,8 +381,7 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir,
379381
}
380382
layout = None
381383
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]
384385

385386
# Make sure we always go through these two checks
386387
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,
423424
name='bidssrc')
424425

425426
bids_info = pe.Node(BIDSInfo(
426-
bids_dir=bids_dir, bids_validate=False),
427+
bids_dir=layout.root, bids_validate=False),
427428
name='bids_info', run_without_submitting=True)
428429

429430
summary = pe.Node(SubjectSummary(output_spaces=output_spaces, template=template),
@@ -541,4 +542,3 @@ def _prefix(subid):
541542
if subid.startswith('sub-'):
542543
return subid
543544
return '-'.join(('sub', subid))
544-

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pybids>=0.7.0,<0.8
2-
git+https://github.com/oesteban/niworkflows.git@0208e37b8915d89720856ac76becbed7592437c5#niworkflows-0.6.1
3-
git+https://github.com/oesteban/smriprep.git@e504ddaca62da545b75a7cbc629ff91b8b48f2ee#smriprep-0.0.4
2+
niworkflows>=0.7.0,<0.8.0a
3+
git+https://github.com/oesteban/smriprep.git@2ad4639b308a5d13183819e13bcb3ca6d4d93eac#smriprep-0.0.4
44
templateflow>=0.0.4

0 commit comments

Comments
 (0)