@@ -1495,52 +1495,59 @@ def _gen_filename(self, name):
1495
1495
1496
1496
1497
1497
class FIRSTInputSpec (FSLCommandInputSpec ):
1498
- in_file = File (exists = True , mandatory = True , position = - 2 , copyfile = False ,
1499
- argstr = '-i %s' ,
1500
- desc = 'input data file' )
1501
- out_file = File ('segmented' , usedefault = True , mandatory = True , position = - 1 ,
1502
- argstr = '-o %s' ,
1503
- desc = 'output data file' , hash_files = False )
1498
+ in_file = File (
1499
+ exists = True , mandatory = True , position = - 2 , copyfile = False ,
1500
+ argstr = '-i %s' , desc = 'input data file' )
1501
+ out_file = File (
1502
+ 'segmented' , usedefault = True , mandatory = True , position = - 1 ,
1503
+ argstr = '-o %s' , desc = 'output data file' , hash_files = False )
1504
1504
verbose = traits .Bool (argstr = '-v' , position = 1 ,
1505
- desc = "Use verbose logging." )
1506
- brain_extracted = traits .Bool (argstr = '-b' , position = 2 ,
1505
+ desc = "Use verbose logging." )
1506
+ brain_extracted = traits .Bool (
1507
+ argstr = '-b' , position = 2 ,
1507
1508
desc = "Input structural image is already brain-extracted" )
1508
- no_cleanup = traits .Bool (argstr = '-d' , position = 3 ,
1509
+ no_cleanup = traits .Bool (
1510
+ argstr = '-d' , position = 3 ,
1509
1511
desc = "Input structural image is already brain-extracted" )
1510
- method = traits .Enum ('auto' , 'fast' , 'none' ,
1511
- xor = ['method_as_numerical_threshold' ],
1512
- argstr = '-m' , position = 4 ,
1512
+ method = traits .Enum (
1513
+ 'auto' , 'fast' , 'none' , xor = ['method_as_numerical_threshold' ],
1514
+ argstr = '-m %s ' , position = 4 , usedefault = True ,
1513
1515
desc = ("Method must be one of auto, fast, none, or it can be entered "
1514
1516
"using the 'method_as_numerical_threshold' input" ))
1515
- method_as_numerical_threshold = traits .Float (argstr = '-m' , position = 4 ,
1517
+ method_as_numerical_threshold = traits .Float (
1518
+ argstr = '-m %d' , position = 4 ,
1516
1519
desc = ("Specify a numerical threshold value or use the 'method' input "
1517
1520
"to choose auto, fast, or none" ))
1518
- list_of_specific_structures = traits .List (traits . Str , argstr = '-s %s' ,
1519
- sep = ',' , position = 5 , minlen = 1 ,
1521
+ list_of_specific_structures = traits .List (
1522
+ traits . Str , argstr = '-s %s' , sep = ',' , position = 5 , minlen = 1 ,
1520
1523
desc = 'Runs only on the specified structures (e.g. L_Hipp, R_Hipp'
1521
- 'L_Accu, R_Accu, L_Amyg, R_Amyg'
1522
- 'L_Caud, R_Caud, L_Pall, R_Pall'
1523
- 'L_Puta, R_Puta, L_Thal, R_Thal, BrStem' )
1524
- affine_file = File (exists = True , position = 6 ,
1525
- argstr = '-a %s' ,
1526
- desc = ('Affine matrix to use (e.g. img2std.mat) (does not '
1527
- 're-run registration)' ))
1524
+ 'L_Accu, R_Accu, L_Amyg, R_Amyg'
1525
+ 'L_Caud, R_Caud, L_Pall, R_Pall'
1526
+ 'L_Puta, R_Puta, L_Thal, R_Thal, BrStem' )
1527
+ affine_file = File (
1528
+ exists = True , position = 6 , argstr = '-a %s' ,
1529
+ desc = ('Affine matrix to use (e.g. img2std.mat) (does not '
1530
+ 're-run registration)' ))
1528
1531
1529
1532
1530
1533
class FIRSTOutputSpec (TraitedSpec ):
1531
- vtk_surfaces = OutputMultiPath (File (exists = True ),
1532
- desc = 'VTK format meshes for each subcortical region' )
1533
- bvars = OutputMultiPath (File (exists = True ),
1534
- desc = 'bvars for each subcortical region' )
1535
- original_segmentations = File (exists = True ,
1536
- desc = ('3D image file containing the segmented regions as integer '
1537
- 'values. Uses CMA labelling' ))
1538
- segmentation_file = File (exists = True ,
1539
- desc = '4D image file containing a single volume per segmented region' )
1534
+ vtk_surfaces = OutputMultiPath (
1535
+ File (exists = True ),
1536
+ desc = 'VTK format meshes for each subcortical region' )
1537
+ bvars = OutputMultiPath (
1538
+ File (exists = True ),
1539
+ desc = 'bvars for each subcortical region' )
1540
+ original_segmentations = File (
1541
+ exists = True , desc = ('3D image file containing the segmented regions '
1542
+ 'as integer values. Uses CMA labelling' ))
1543
+ segmentation_file = File (
1544
+ exists = True , desc = ('4D image file containing a single volume per '
1545
+ 'segmented region' ))
1540
1546
1541
1547
1542
1548
class FIRST (FSLCommand ):
1543
- """Use FSL's run_first_all command to segment subcortical volumes
1549
+ """
1550
+ Use FSL's run_first_all command to segment subcortical volumes
1544
1551
1545
1552
http://www.fmrib.ox.ac.uk/fsl/first/index.html
1546
1553
@@ -1574,7 +1581,7 @@ def _list_outputs(self):
1574
1581
'L_Thal' , 'R_Thal' ,
1575
1582
'BrStem' ]
1576
1583
outputs ['original_segmentations' ] = \
1577
- self ._gen_fname ('original_segmentations' )
1584
+ self ._gen_fname ('original_segmentations' )
1578
1585
outputs ['segmentation_file' ] = self ._gen_fname ('segmentation_file' )
1579
1586
outputs ['vtk_surfaces' ] = self ._gen_mesh_names ('vtk_surfaces' ,
1580
1587
structures )
@@ -1583,10 +1590,13 @@ def _list_outputs(self):
1583
1590
1584
1591
def _gen_fname (self , name ):
1585
1592
path , outname , ext = split_filename (self .inputs .out_file )
1593
+ method = self .inputs .method
1594
+
1586
1595
if name == 'original_segmentations' :
1587
- return op .abspath (outname + '_all_fast_origsegs .nii.gz' )
1596
+ return op .abspath ('%s_all_%s_origsegs .nii.gz' % ( outname , method ) )
1588
1597
if name == 'segmentation_file' :
1589
- return op .abspath (outname + '_all_fast_firstseg.nii.gz' )
1598
+ return op .abspath ('%s_all_%s_firstseg.nii.gz' % (outname , method ))
1599
+
1590
1600
return None
1591
1601
1592
1602
def _gen_mesh_names (self , name , structures ):
0 commit comments