Skip to content

Commit 363563e

Browse files
committed
fix: clean up fsl model tests.
1 parent a30b270 commit 363563e

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

nipype/interfaces/fsl/model.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,12 +1472,9 @@ class Randomise(FSLCommand):
14721472
Example
14731473
-------
14741474
>>> import nipype.interfaces.fsl as fsl
1475-
>>> rand = fsl.Randomise(in_file='allFA.nii', \
1476-
mask = 'mask.nii', \
1477-
tcon='design.con', \
1478-
design_mat='design.mat')
1475+
>>> rand = fsl.Randomise(in_file='allFA.nii', mask = 'mask.nii', tcon='design.con', design_mat='design.mat')
14791476
>>> rand.cmdline
1480-
'randomise -i allFA.nii -o tbss_ -d design.mat -t design.con -m mask.nii'
1477+
'randomise -i allFA.nii -o "tbss_" -d design.mat -t design.con -m mask.nii'
14811478
14821479
"""
14831480

@@ -1536,20 +1533,25 @@ class GLMInputSpec(FSLCommandInputSpec):
15361533
options = traits.String(
15371534
argstr='%s',
15381535
desc = 'fsl_glm options')
1536+
1537+
15391538
class GLMOutputSpec(TraitedSpec):
15401539
out_file = File(
15411540
exists=True,
15421541
desc = 'file or image output')
15431542

1543+
15441544
class GLM(FSLCommand):
15451545
"""
15461546
FSL GLM:
15471547
15481548
Example
15491549
-------
15501550
>>> import nipype.interfaces.fsl as fsl
1551-
>>> glm = fsl.GLM(in_file='functional.nii', design = 'maps.nii')
1551+
>>> glm = fsl.GLM(in_file='functional.nii', design='maps.nii')
15521552
>>> glm.cmdline
1553+
'fsl_glm -d maps.nii -i functional.nii -o functional_glm.txt'
1554+
15531555
"""
15541556
_cmd = 'fsl_glm'
15551557
input_spec = GLMInputSpec
@@ -1560,17 +1562,12 @@ def _list_outputs(self):
15601562
outputs['out_file'] = self.inputs.out_file
15611563
# Generate an out_file if one is not provided
15621564
if not isdefined(outputs['out_file']) and isdefined(self.inputs.in_file):
1563-
ext = Info.output_type_to_ext(self.inputs.output_type)
1564-
if split_filename(self.inputs.in_file)[-1] in Info.ftypes.values():
1565-
ext = '.txt'
1566-
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
1567-
suffix='_glm',
1568-
ext=ext)
1569-
1565+
outputs['out_file'] = os.path.abspath(self._gen_filename('out_file'))
15701566
return outputs
15711567

15721568
def _gen_filename(self, name):
15731569
if name in ('out_file'):
1574-
return self._list_outputs()[name]
1575-
else:
1576-
return None
1570+
from nipype.utils.filemanip import fname_presuffix
1571+
return fname_presuffix(self.inputs.in_file,
1572+
suffix='_glm.txt', use_ext=False)
1573+
return None

0 commit comments

Comments
 (0)