@@ -1495,52 +1495,59 @@ def _gen_filename(self, name):
14951495
14961496
14971497class 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 )
15041504 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 ,
15071508 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 ,
15091511 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 ,
15131515 desc = ("Method must be one of auto, fast, none, or it can be entered "
15141516 "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 ,
15161519 desc = ("Specify a numerical threshold value or use the 'method' input "
15171520 "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 ,
15201523 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)' ))
15281531
15291532
15301533class 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' ))
15401546
15411547
15421548class 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
15441551
15451552 http://www.fmrib.ox.ac.uk/fsl/first/index.html
15461553
@@ -1574,7 +1581,7 @@ def _list_outputs(self):
15741581 'L_Thal' , 'R_Thal' ,
15751582 'BrStem' ]
15761583 outputs ['original_segmentations' ] = \
1577- self ._gen_fname ('original_segmentations' )
1584+ self ._gen_fname ('original_segmentations' )
15781585 outputs ['segmentation_file' ] = self ._gen_fname ('segmentation_file' )
15791586 outputs ['vtk_surfaces' ] = self ._gen_mesh_names ('vtk_surfaces' ,
15801587 structures )
@@ -1583,10 +1590,13 @@ def _list_outputs(self):
15831590
15841591 def _gen_fname (self , name ):
15851592 path , outname , ext = split_filename (self .inputs .out_file )
1593+ method = self .inputs .method
1594+
15861595 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 ) )
15881597 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+
15901600 return None
15911601
15921602 def _gen_mesh_names (self , name , structures ):
0 commit comments