@@ -1518,3 +1518,57 @@ def _list_outputs(self):
1518
1518
'%s_%s_corrp_fstat*.nii' % (self .inputs .base_name ,prefix )))
1519
1519
1520
1520
return outputs
1521
+
1522
+
1523
+ class GLMInputSpec (FSLCommandInputSpec ):
1524
+ in_file = File (
1525
+ exists = True ,mandatory = True ,
1526
+ argstr = '-i %s' ,
1527
+ desc = 'input 3d+t file' ,)
1528
+ design = File (
1529
+ exists = True , mandatory = True ,
1530
+ argstr = '-d %s' ,
1531
+ desc = 'design file or image file' )
1532
+ out_file = File (
1533
+ genfile = True , argstr = "-o %s" ,
1534
+ desc = "file or image output" )
1535
+ mask = File (
1536
+ exists = True ,
1537
+ argstr = '-m %s' ,
1538
+ desc = 'mask file' )
1539
+ contrasts = File (
1540
+ exists = True ,
1541
+ argstr = '-c %s' ,
1542
+ desc = 't-contrasts file' )
1543
+ options = traits .String (
1544
+ argstr = '%s' ,
1545
+ desc = 'fsl_glm options' )
1546
+ class GLMOutputSpec (TraitedSpec ):
1547
+ out_file = File (
1548
+ exists = True ,
1549
+ desc = 'file or image output' )
1550
+
1551
+ class GLM (FSLCommand ):
1552
+ _cmd = 'fsl_glm'
1553
+ input_spec = GLMInputSpec
1554
+ output_spec = GLMOutputSpec
1555
+
1556
+ def _list_outputs (self ):
1557
+ outputs = self .output_spec ().get ()
1558
+ outputs ['out_file' ] = self .inputs .out_file
1559
+ # Generate an out_file if one is not provided
1560
+ if not isdefined (outputs ['out_file' ]) and isdefined (self .inputs .in_file ):
1561
+ ext = Info .output_type_to_ext (self .inputs .output_type )
1562
+ if split_filename (self .inputs .in_file )[- 1 ] in Info .ftypes .values ():
1563
+ ext = '.txt'
1564
+ outputs ['out_file' ] = self ._gen_fname (self .inputs .in_file ,
1565
+ suffix = '_glm' ,
1566
+ ext = ext )
1567
+
1568
+ return outputs
1569
+
1570
+ def _gen_filename (self , name ):
1571
+ if name in ('out_file' ):
1572
+ return self ._list_outputs ()[name ]
1573
+ else :
1574
+ return None
0 commit comments