@@ -976,16 +976,18 @@ class MRIsCombineOutputSpec(TraitedSpec):
976976
977977class MRIsCombine (FSSurfaceCommand ):
978978 """
979- Uses Freesurfer's mris_convert to combine two surface files into one.
979+ Uses Freesurfer's `` mris_convert`` to combine two surface files into one.
980980
981981 For complete details, see the `mris_convert Documentation.
982982 <https://surfer.nmr.mgh.harvard.edu/fswiki/mris_convert>`_
983983
984- If given an out_file that does not begin with 'lh.' or 'rh.',
985- mris_convert will prepend 'lh.' to the file name.
986- To avoid this behavior, consider setting out_file = './<filename>', or
984+ If given an `` out_file`` that does not begin with `` 'lh.'`` or `` 'rh.'`` ,
985+ `` mris_convert`` will prepend `` 'lh.'`` to the file name.
986+ To avoid this behavior, consider setting `` out_file = './<filename>'`` , or
987987 leaving out_file blank.
988988
989+ In a Node/Workflow, ``out_file`` is interpreted literally.
990+
989991 Example
990992 -------
991993
@@ -1003,24 +1005,21 @@ class MRIsCombine(FSSurfaceCommand):
10031005
10041006 def _list_outputs (self ):
10051007 outputs = self ._outputs ().get ()
1006- outputs ['out_file' ] = self ._associated_file (self .inputs .in_files [0 ],
1007- self .inputs .out_file )
1008- return outputs
10091008
1010- @staticmethod
1011- def _associated_file (in_file , out_name ):
1012- """Unlike the standard _associated_file, which uses the prefix from
1013- in_file, in MRIsCombine, it uses 'lh.' as the prefix for the output
1014- file no matter what the inputs are.
1015- """
1016- path , base = os .path .split (out_name )
1017- if path == '' :
1018- hemis = ('lh.' , 'rh.' )
1019- if base [:3 ] not in hemis :
1020- base = 'lh.' + base
1021- return os .path .abspath (os .path .join (path , base ))
1009+ # mris_convert --combinesurfs uses lh. as the default prefix
1010+ # regardless of input file names, except when path info is
1011+ # specified
1012+ path , base = os .path .split (self .inputs .out_file )
1013+ if path == '' and base [:3 ] not in ('lh.' , 'rh.' ):
1014+ base = 'lh.' + base
1015+ outputs ['out_file' ] = os .path .abspath (os .path .join (path , base ))
1016+
1017+ return outputs
10221018
10231019 def _normalize_filenames (self ):
1020+ """ In a Node context, interpret out_file as a literal path to
1021+ reduce surprise.
1022+ """
10241023 if isdefined (self .inputs .out_file ):
10251024 self .inputs .out_file = os .path .abspath (self .inputs .out_file )
10261025
@@ -3001,11 +3000,6 @@ class MRIsExpandInputSpec(FSTraitedSpec):
30013000 desc = ('Name of thickness file (implicit: "thickness")\n '
30023001 'If no path, uses directory of `in_file`\n '
30033002 'If no path AND missing "lh." or "rh.", derive from `in_file`' ))
3004- navgs = traits .Tuple (
3005- traits .Int , traits .Int ,
3006- argstr = '-navgs %d %d' ,
3007- desc = ('Tuple of (n_averages, min_averages) parameters '
3008- '(implicit: (16, 0))' ))
30093003 pial = traits .Str (
30103004 argstr = '-pial %s' , copyfile = False ,
30113005 desc = ('Name of pial file (implicit: "pial")\n '
@@ -3027,6 +3021,11 @@ class MRIsExpandInputSpec(FSTraitedSpec):
30273021 desc = 'Number of surfacces to write during expansion' )
30283022 # # Requires dev version - Re-add when min_ver/max_ver support this
30293023 # # https://github.com/freesurfer/freesurfer/blob/9730cb9/mris_expand/mris_expand.c
3024+ # navgs = traits.Tuple(
3025+ # traits.Int, traits.Int,
3026+ # argstr='-navgs %d %d',
3027+ # desc=('Tuple of (n_averages, min_averages) parameters '
3028+ # '(implicit: (16, 0))'))
30303029 # target_intensity = traits.Tuple(
30313030 # traits.Float, traits.File(exists=True),
30323031 # argstr='-intensity %g %s',
@@ -3037,7 +3036,7 @@ class MRIsExpandOutputSpec(TraitedSpec):
30373036 out_file = File (desc = 'Output surface file' )
30383037
30393038
3040- class MRIsExpand (FSCommand ):
3039+ class MRIsExpand (FSSurfaceCommand ):
30413040 """
30423041 Expands a surface (typically ?h.white) outwards while maintaining
30433042 smoothness and self-intersection constraints.
@@ -3063,7 +3062,9 @@ def _list_outputs(self):
30633062 self .inputs .out_name )
30643063 return outputs
30653064
3066- def _get_filecopy_info (self ):
3065+ def _normalize_filenames (self ):
3066+ """ Find full paths for pial, thickness and sphere files for copying
3067+ """
30673068 in_file = self .inputs .in_file
30683069
30693070 pial = self .inputs .pial
@@ -3079,20 +3080,3 @@ def _get_filecopy_info(self):
30793080 thickness_name )
30803081
30813082 self .inputs .sphere = self ._associated_file (in_file , self .inputs .sphere )
3082-
3083- return super (MRIsExpand , self )._get_filecopy_info ()
3084-
3085- @staticmethod
3086- def _associated_file (in_file , out_name ):
3087- """Based on MRIsBuildFileName in freesurfer/utils/mrisurf.c
3088-
3089- Use file prefix to indicate hemisphere, rather than inspecting the
3090- surface data structure
3091- """
3092- path , base = os .path .split (out_name )
3093- if path == '' :
3094- path , in_file = os .path .split (in_file )
3095- hemis = ('lh.' , 'rh.' )
3096- if in_file [:3 ] in hemis and base [:3 ] not in hemis :
3097- base = in_file [:3 ] + base
3098- return os .path .join (path , base )
0 commit comments