@@ -3153,11 +3153,7 @@ class NlpFitInputSpec(CommandLineInputSpec):
3153
3153
desc = 'output xfm file' ,
3154
3154
genfile = True ,
3155
3155
argstr = '%s' ,
3156
- position = - 1 ,
3157
- name_source = ['source' ],
3158
- hash_files = False ,
3159
- name_template = '%s_nlpfit.mnc' ,
3160
- keep_extension = False )
3156
+ position = - 1 ,)
3161
3157
3162
3158
# This is a dummy input.
3163
3159
input_grid_files = InputMultiPath (
@@ -3224,13 +3220,27 @@ class NlpFit(CommandLine):
3224
3220
output_spec = NlpFitOutputSpec
3225
3221
_cmd = 'nlpfit'
3226
3222
3223
+ def _gen_filename (self , name ):
3224
+ if name == 'output_xfm' :
3225
+ output_xfm = self .inputs .output_xfm
3226
+
3227
+ if isdefined (output_xfm ):
3228
+ return os .path .abspath (output_xfm )
3229
+ else :
3230
+ return aggregate_filename (
3231
+ [self .inputs .source , self .inputs .target ], 'nlpfit_xfm_output' ) + '.xfm'
3232
+ else :
3233
+ raise NotImplemented
3234
+
3227
3235
def _list_outputs (self ):
3228
- outputs = super (NlpFit , self )._list_outputs ()
3236
+ outputs = self .output_spec ().get ()
3237
+ outputs ['output_xfm' ] = os .path .abspath (
3238
+ self ._gen_filename ('output_xfm' ))
3229
3239
3230
- if os .path .exists (outputs ['output_xfm' ]):
3231
- if 'grid' in open (outputs ['output_xfm' ], 'r' ).read ():
3232
- outputs ['output_grid' ] = re .sub (
3233
- '.(nlxfm|xfm)$' , '_grid_0.mnc' , outputs ['output_xfm' ])
3240
+ assert os .path .exists (outputs ['output_xfm' ])
3241
+ if 'grid' in open (outputs ['output_xfm' ], 'r' ).read ():
3242
+ outputs ['output_grid' ] = re .sub (
3243
+ '.(nlxfm|xfm)$' , '_grid_0.mnc' , outputs ['output_xfm' ])
3234
3244
3235
3245
return outputs
3236
3246
0 commit comments