Skip to content

Commit 9525f40

Browse files
committed
Merge pull request nipy#446 from satra/fix/tests
Fix/tests
2 parents 8878c0f + e596ad1 commit 9525f40

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

nipype/interfaces/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,11 @@ class must be instantiated with a command argument
10171017
>>> cli.cmdline
10181018
'ls -al'
10191019
1020-
>>> cli.inputs.trait_get() #doctest: +SKIP
1020+
>>> cli.inputs.trait_get()
10211021
{'ignore_exception': False, 'args': '-al', 'environ': {'DISPLAY': ':1'}}
10221022
10231023
>>> cli.inputs.get_hashval()
1024-
({'ignore_exception': False, 'args': '-al', 'environ': {'DISPLAY': ':1'}}, 'b1faf85652295456a906f053d48daef6')
1024+
({'args': '-al'}, 'a2f45e04a34630c5f33a75ea2a533cdd')
10251025
10261026
"""
10271027

nipype/workflows/dmri/fsl/tbss.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# vi: set ft=python sts=4 ts=4 sw=4 et:
33

44
import os
5+
from warnings import warn
6+
57
import nipype.pipeline.engine as pe
68
import nipype.interfaces.utility as util
79
import nipype.interfaces.fsl as fsl
@@ -99,7 +101,7 @@ def create_tbss_2_reg(name="tbss_2_reg"):
99101
100102
>>> from nipype.workflows.dmri.fsl import tbss
101103
>>> tbss2 = create_tbss_2_reg(name="tbss2")
102-
>>> tbss2.inputs.inputnode.target = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz")
104+
>>> tbss2.inputs.inputnode.target = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz") # doctest: +SKIP
103105
>>> tbss2.inputs.inputnode.fa_list = ['s1_FA.nii', 's2_FA.nii', 's3_FA.nii']
104106
>>> tbss2.inputs.inputnode.mask_list = ['s1_mask.nii', 's2_mask.nii', 's3_mask.nii']
105107
@@ -126,13 +128,16 @@ def create_tbss_2_reg(name="tbss_2_reg"):
126128
iterfield=['in_file', 'in_weight'],
127129
name="flirt")
128130

131+
fnirt = pe.MapNode(interface=fsl.FNIRT(fieldcoeff_file=True),
132+
iterfield=['in_file', 'inmask_file', 'affine_file'],
133+
name="fnirt")
129134
# Fnirt the FA image to the target
130-
config_file = os.path.join(os.environ["FSLDIR"],
131-
"etc/flirtsch/FA_2_FMRIB58_1mm.cnf")
132-
fnirt = pe.MapNode(interface=fsl.FNIRT(config_file=config_file,
133-
fieldcoeff_file=True),
134-
iterfield=['in_file', 'inmask_file', 'affine_file'],
135-
name="fnirt")
135+
if fsl.no_fsl():
136+
warn('NO FSL found')
137+
else:
138+
config_file = os.path.join(os.environ["FSLDIR"],
139+
"etc/flirtsch/FA_2_FMRIB58_1mm.cnf")
140+
fnirt.inputs.config_file=config_file
136141

137142
# Define the registration workflow
138143
tbss2 = pe.Workflow(name=name)
@@ -195,7 +200,10 @@ def create_tbss_3_postreg(name='tbss_3_postreg', estimate_skeleton=True):
195200
applywarp = pe.MapNode(interface=fsl.ApplyWarp(),
196201
iterfield=['in_file', 'field_file'],
197202
name="applywarp")
198-
applywarp.inputs.ref_file = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz")
203+
if fsl.no_fsl():
204+
warn('NO FSL found')
205+
else:
206+
applywarp.inputs.ref_file = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz")
199207

200208
# Merge the FA files into a 4D file
201209
mergefa = pe.Node(fsl.Merge(dimension="t"),
@@ -402,7 +410,10 @@ def create_tbss_all(name='tbss_all', estimate_skeleton=True):
402410

403411
tbss1 = create_tbss_1_preproc(name='tbss1')
404412
tbss2 = create_tbss_2_reg(name='tbss2')
405-
tbss2.inputs.inputnode.target = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz")
413+
if fsl.no_fsl():
414+
warn('NO FSL found')
415+
else:
416+
tbss2.inputs.inputnode.target = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz")
406417
tbss3 = create_tbss_3_postreg(name='tbss3', estimate_skeleton=estimate_skeleton)
407418
tbss4 = create_tbss_4_prestats(name='tbss4')
408419

@@ -522,7 +533,10 @@ def create_tbss_non_FA(name='tbss_non_FA'):
522533
applywarp = pe.MapNode(interface=fsl.ApplyWarp(),
523534
iterfield=['in_file', 'field_file'],
524535
name="applywarp")
525-
applywarp.inputs.ref_file = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz")
536+
if fsl.no_fsl():
537+
warn('NO FSL found')
538+
else:
539+
applywarp.inputs.ref_file = fsl.Info.standard_image("FMRIB58_FA_1mm.nii.gz")
526540
# Merge the non FA files into a 4D file
527541
merge = pe.Node(fsl.Merge(dimension="t"), name="merge")
528542
#merged_file="all_FA.nii.gz"

0 commit comments

Comments
 (0)