@@ -1472,12 +1472,9 @@ class Randomise(FSLCommand):
1472
1472
Example
1473
1473
-------
1474
1474
>>> 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')
1479
1476
>>> 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'
1481
1478
1482
1479
"""
1483
1480
@@ -1536,20 +1533,25 @@ class GLMInputSpec(FSLCommandInputSpec):
1536
1533
options = traits .String (
1537
1534
argstr = '%s' ,
1538
1535
desc = 'fsl_glm options' )
1536
+
1537
+
1539
1538
class GLMOutputSpec (TraitedSpec ):
1540
1539
out_file = File (
1541
1540
exists = True ,
1542
1541
desc = 'file or image output' )
1543
1542
1543
+
1544
1544
class GLM (FSLCommand ):
1545
1545
"""
1546
1546
FSL GLM:
1547
1547
1548
1548
Example
1549
1549
-------
1550
1550
>>> 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')
1552
1552
>>> glm.cmdline
1553
+ 'fsl_glm -d maps.nii -i functional.nii -o functional_glm.txt'
1554
+
1553
1555
"""
1554
1556
_cmd = 'fsl_glm'
1555
1557
input_spec = GLMInputSpec
@@ -1560,17 +1562,12 @@ def _list_outputs(self):
1560
1562
outputs ['out_file' ] = self .inputs .out_file
1561
1563
# Generate an out_file if one is not provided
1562
1564
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' ))
1570
1566
return outputs
1571
1567
1572
1568
def _gen_filename (self , name ):
1573
1569
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