@@ -3028,7 +3028,10 @@ class XfmConcatInputSpec(CommandLineInputSpec):
3028
3028
desc = 'output file' ,
3029
3029
genfile = True ,
3030
3030
argstr = '%s' ,
3031
- position = - 1 ,)
3031
+ position = - 1 ,
3032
+ name_source = ['input_files' ],
3033
+ hash_files = False ,
3034
+ name_template = '%s_xfmconcat.xfm' )
3032
3035
3033
3036
verbose = traits .Bool (
3034
3037
desc = 'Print out log messages. Default: False.' ,
@@ -3042,7 +3045,6 @@ class XfmConcatInputSpec(CommandLineInputSpec):
3042
3045
3043
3046
class XfmConcatOutputSpec (TraitedSpec ):
3044
3047
output_file = File (desc = 'output file' , exists = True )
3045
- # FIXME is exists=True always the case?
3046
3048
output_grids = OutputMultiPath (desc = 'output grids' , exists = True )
3047
3049
3048
3050
@@ -3064,36 +3066,16 @@ class XfmConcat(CommandLine):
3064
3066
output_spec = XfmConcatOutputSpec
3065
3067
_cmd = 'xfmconcat'
3066
3068
3067
- def _gen_filename (self , name ):
3068
- if name == 'output_file' :
3069
- output_file = self .inputs .output_file
3070
-
3071
- if isdefined (output_file ):
3072
- return os .path .abspath (output_file )
3073
- else :
3074
- return aggregate_filename (
3075
- self .inputs .input_files ,
3076
- 'xfmconcat_output' ) + '.xfm'
3077
- else :
3078
- raise NotImplemented
3079
-
3080
- def _gen_outfilename (self ):
3081
- return self ._gen_filename ('output_file' )
3082
-
3083
3069
def _list_outputs (self ):
3084
- outputs = self .output_spec ().get ()
3085
- outputs ['output_file' ] = os .path .abspath (self ._gen_outfilename ())
3086
-
3087
- # FIXME Is this the sensible? No other way to tell if the grid files
3088
- # were produced.
3089
- # FIXME This is safe to assume?
3090
- assert os .path .exists (outputs ['output_file' ])
3091
- if 'grid' in open (outputs ['output_file' ], 'r' ).read ():
3092
- outputs ['output_grids' ] = glob .glob (
3093
- re .sub (
3094
- '.(nlxfm|xfm)$' ,
3095
- '_grid_*.mnc' ,
3096
- outputs ['output_file' ]))
3070
+ outputs = super (XfmConcat , self )._list_outputs ()
3071
+
3072
+ if os .path .exists (outputs ['output_file' ]):
3073
+ if 'grid' in open (outputs ['output_file' ], 'r' ).read ():
3074
+ outputs ['output_grids' ] = glob .glob (
3075
+ re .sub (
3076
+ '.(nlxfm|xfm)$' ,
3077
+ '_grid_*.mnc' ,
3078
+ outputs ['output_file' ]))
3097
3079
3098
3080
return outputs
3099
3081
0 commit comments