Skip to content

Commit 3bacbb9

Browse files
committed
Merge pull request #1441 from cni-md/master
autorecon1: convert_modalities output fix
2 parents a3ffceb + e3767b5 commit 3bacbb9

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

nipype/workflows/fmri/fsl/preprocess.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ def create_parallelfeat_preproc(name='featpreproc', highpass=True):
113113
>>> preproc.base_dir = '/tmp'
114114
>>> preproc.run() # doctest: +SKIP
115115
"""
116+
version = 0
117+
if fsl.Info.version() and \
118+
LooseVersion(fsl.Info.version()) > LooseVersion('5.0.6'):
119+
version = 507
116120

117121
featpreproc = pe.Workflow(name=name)
118122

@@ -358,7 +362,26 @@ def create_parallelfeat_preproc(name='featpreproc', highpass=True):
358362
name='highpass')
359363
featpreproc.connect(inputnode, ('highpass', highpass_operand), highpass, 'op_string')
360364
featpreproc.connect(meanscale, 'out_file', highpass, 'in_file')
361-
featpreproc.connect(highpass, 'out_file', outputnode, 'highpassed_files')
365+
366+
if version < 507:
367+
featpreproc.connect(highpass, 'out_file', outputnode, 'highpassed_files')
368+
else:
369+
"""
370+
Add back the mean removed by the highpass filter operation as of FSL 5.0.7
371+
"""
372+
meanfunc4 = pe.MapNode(interface=fsl.ImageMaths(op_string='-Tmean',
373+
suffix='_mean'),
374+
iterfield=['in_file'],
375+
name='meanfunc4')
376+
377+
featpreproc.connect(meanscale, 'out_file', meanfunc4, 'in_file')
378+
addmean = pe.MapNode(interface=fsl.BinaryMaths(operation='add'),
379+
iterfield=['in_file', 'operand_file'],
380+
name='addmean')
381+
featpreproc.connect(highpass, 'out_file', addmean, 'in_file')
382+
featpreproc.connect(meanfunc4, 'out_file', addmean, 'operand_file')
383+
featpreproc.connect(addmean, 'out_file', outputnode, 'highpassed_files')
384+
362385

363386
"""
364387
Generate a mean functional image from the first run
@@ -368,11 +391,8 @@ def create_parallelfeat_preproc(name='featpreproc', highpass=True):
368391
suffix='_mean'),
369392
iterfield=['in_file'],
370393
name='meanfunc3')
371-
if highpass:
372-
featpreproc.connect(highpass, 'out_file', meanfunc3, 'in_file')
373-
else:
374-
featpreproc.connect(meanscale, 'out_file', meanfunc3, 'in_file')
375394

395+
featpreproc.connect(meanscale, 'out_file', meanfunc3, 'in_file')
376396
featpreproc.connect(meanfunc3, 'out_file', outputnode, 'mean')
377397

378398
return featpreproc

nipype/workflows/smri/freesurfer/autorecon1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def convert_modalities(in_file=None, out_file=None):
8686
convert.inputs.in_file = in_file
8787
convert.inputs.out_file = out_file
8888
convert.inputs.no_scale = True
89-
convert.run()
90-
out_file = os.path.abspath(convert.outputs.out_file)
89+
out = convert.run()
90+
out_file = os.path.abspath(out.outputs.out_file)
9191
return out_file
9292

9393
T2_convert = pe.Node(Function(['in_file', 'out_file'],

0 commit comments

Comments
 (0)