Skip to content

Commit

Permalink
Merge branch 'enh/skip_native'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgorgo committed Dec 7, 2016
2 parents 60e98d0 + 15c539c commit e15da51
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
6 changes: 5 additions & 1 deletion fmriprep/run_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def main():
g_input.add_argument('-t', '--workflow-type', default='auto', required=False,
action='store', choices=['auto', 'ds005', 'ds054'],
help='specify workflow type manually')
g_input.add_argument('--skip-native', action='store_true',
default=False,
help="don't output timeseries in native space")

# ANTs options
g_ants = parser.add_argument_group('specific settings for ANTs registrations')
Expand Down Expand Up @@ -92,7 +95,8 @@ def create_workflow(opts):
'skull_strip_ants': opts.skull_strip_ants,
'output_dir': op.abspath(opts.output_dir),
'work_dir': op.abspath(opts.work_dir),
'workflow_type': opts.workflow_type
'workflow_type': opts.workflow_type,
'skip_native': opts.skip_native
}

# set up logger
Expand Down
21 changes: 12 additions & 9 deletions fmriprep/workflows/epi.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ def epi_hmc(name='EPI_HMC', settings=None):
('out_file', 'epi_mean')]),
])

# Write corrected file in the designated output dir
ds_hmc = pe.Node(
DerivativesDataSink(base_directory=settings['output_dir'],
suffix='preproc'),
name='DerivativesHMC'
)

ds_mask = pe.Node(
DerivativesDataSink(base_directory=settings['output_dir'],
suffix='brainmask'),
Expand Down Expand Up @@ -111,11 +104,9 @@ def epi_hmc(name='EPI_HMC', settings=None):
)

workflow.connect([
(inputnode, ds_hmc, [('epi', 'source_file')]),
(inputnode, ds_report, [('epi', 'source_file')]),
(inputnode, ds_mask, [('epi', 'source_file')]),
(inputnode, mean_epi_overlay_ds, [('epi', 'origin_file')]),
(hmc, ds_hmc, [('out_file', 'in_file')]),
(bet_hmc, ds_mask, [('mask_file', 'in_file')]),
(hmc, mean_epi_stripped_overlay, [('mean_img', 'overlay_file')]),
(bet_hmc, mean_epi_stripped_overlay, [('mask_file', 'in_file')]),
Expand All @@ -126,6 +117,18 @@ def epi_hmc(name='EPI_HMC', settings=None):
(bet_hmc, ds_report, [('out_report', 'in_file')])
])

if not settings["skip_native"]:
# Write corrected file in the designated output dir
ds_hmc = pe.Node(
DerivativesDataSink(base_directory=settings['output_dir'],
suffix='preproc'),
name='DerivativesHMC'
)
workflow.connect([
(inputnode, ds_hmc, [('epi', 'source_file')]),
(hmc, ds_hmc, [('out_file', 'in_file')])
])

return workflow


Expand Down
6 changes: 4 additions & 2 deletions test/workflows/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def test_wf_ds054_type(self, _):
# set up
mock_subject_data = {'t1w': ['um'], 'sbref': ['um'], 'func': 'um'}
mock_settings = {'output_dir': '.', 'work_dir': '.',
'ants_nthreads': 1, 'biggest_epi_file_size_gb': 1}
'ants_nthreads': 1, 'biggest_epi_file_size_gb': 1,
'skip_native': False}

# run
wf054 = wf_ds054_type(mock_subject_data, mock_settings)
Expand Down Expand Up @@ -39,7 +40,8 @@ def test_wf_ds005_type(self, _):
# set up
mock_subject_data = {'func': ''}
mock_settings = {'output_dir': '.', 'ants_nthreads': 1,
'biggest_epi_file_size_gb': 1}
'biggest_epi_file_size_gb': 1,
'skip_native': False}

# run
wf005 = wf_ds005_type(mock_subject_data, mock_settings)
Expand Down
3 changes: 2 additions & 1 deletion test/workflows/test_confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class TestConfounds(TestWorkflow):

def test_discover_wf(self):
# run
workflow = discover_wf(stub.settings({'biggest_epi_file_size_gb': 1}))
workflow = discover_wf(stub.settings({'biggest_epi_file_size_gb': 1,
'skip_native': False}))
workflow.write_hierarchical_dotfile()

# assert
Expand Down

0 comments on commit e15da51

Please sign in to comment.