@@ -976,16 +976,18 @@ class MRIsCombineOutputSpec(TraitedSpec):
976
976
977
977
class MRIsCombine (FSSurfaceCommand ):
978
978
"""
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.
980
980
981
981
For complete details, see the `mris_convert Documentation.
982
982
<https://surfer.nmr.mgh.harvard.edu/fswiki/mris_convert>`_
983
983
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
987
987
leaving out_file blank.
988
988
989
+ In a Node/Workflow, ``out_file`` is interpreted literally.
990
+
989
991
Example
990
992
-------
991
993
@@ -1003,24 +1005,21 @@ class MRIsCombine(FSSurfaceCommand):
1003
1005
1004
1006
def _list_outputs (self ):
1005
1007
outputs = self ._outputs ().get ()
1006
- outputs ['out_file' ] = self ._associated_file (self .inputs .in_files [0 ],
1007
- self .inputs .out_file )
1008
- return outputs
1009
1008
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
1022
1018
1023
1019
def _normalize_filenames (self ):
1020
+ """ In a Node context, interpret out_file as a literal path to
1021
+ reduce surprise.
1022
+ """
1024
1023
if isdefined (self .inputs .out_file ):
1025
1024
self .inputs .out_file = os .path .abspath (self .inputs .out_file )
1026
1025
@@ -3001,11 +3000,6 @@ class MRIsExpandInputSpec(FSTraitedSpec):
3001
3000
desc = ('Name of thickness file (implicit: "thickness")\n '
3002
3001
'If no path, uses directory of `in_file`\n '
3003
3002
'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))' ))
3009
3003
pial = traits .Str (
3010
3004
argstr = '-pial %s' , copyfile = False ,
3011
3005
desc = ('Name of pial file (implicit: "pial")\n '
@@ -3027,6 +3021,11 @@ class MRIsExpandInputSpec(FSTraitedSpec):
3027
3021
desc = 'Number of surfacces to write during expansion' )
3028
3022
# # Requires dev version - Re-add when min_ver/max_ver support this
3029
3023
# # 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))'))
3030
3029
# target_intensity = traits.Tuple(
3031
3030
# traits.Float, traits.File(exists=True),
3032
3031
# argstr='-intensity %g %s',
@@ -3037,7 +3036,7 @@ class MRIsExpandOutputSpec(TraitedSpec):
3037
3036
out_file = File (desc = 'Output surface file' )
3038
3037
3039
3038
3040
- class MRIsExpand (FSCommand ):
3039
+ class MRIsExpand (FSSurfaceCommand ):
3041
3040
"""
3042
3041
Expands a surface (typically ?h.white) outwards while maintaining
3043
3042
smoothness and self-intersection constraints.
@@ -3063,7 +3062,9 @@ def _list_outputs(self):
3063
3062
self .inputs .out_name )
3064
3063
return outputs
3065
3064
3066
- def _get_filecopy_info (self ):
3065
+ def _normalize_filenames (self ):
3066
+ """ Find full paths for pial, thickness and sphere files for copying
3067
+ """
3067
3068
in_file = self .inputs .in_file
3068
3069
3069
3070
pial = self .inputs .pial
@@ -3079,20 +3080,3 @@ def _get_filecopy_info(self):
3079
3080
thickness_name )
3080
3081
3081
3082
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