@@ -3183,31 +3183,33 @@ class NlpFitInputSpec(CommandLineInputSpec):
3183
3183
desc = 'output xfm file' ,
3184
3184
genfile = True ,
3185
3185
argstr = '%s' ,
3186
- position = - 1 ,)
3186
+ position = - 1 ,
3187
+ name_source = ['source' ],
3188
+ hash_files = False ,
3189
+ name_template = '%s_nlpfit.mnc' ,
3190
+ keep_extension = False )
3187
3191
3188
3192
# This is a dummy input.
3189
3193
input_grid_files = InputMultiPath (
3190
3194
traits .File ,
3191
3195
desc = 'input grid file(s)' ,)
3192
3196
3193
- # FIXME outout_mnc?
3194
-
3195
3197
config_file = File (
3196
3198
desc = 'File containing the fitting configuration use.' ,
3197
3199
argstr = '-config_file %s' ,
3198
- mandatory = True , # FIXME debugging
3200
+ mandatory = True ,
3199
3201
exists = True )
3200
3202
3201
3203
init_xfm = File (
3202
3204
desc = 'Initial transformation (default identity).' ,
3203
3205
argstr = '-init_xfm %s' ,
3204
- mandatory = True , # FIXME debugging
3206
+ mandatory = True ,
3205
3207
exists = True )
3206
3208
3207
3209
source_mask = File (
3208
3210
desc = 'Source mask to use during fitting.' ,
3209
3211
argstr = '-source_mask %s' ,
3210
- mandatory = True , # FIXME Just for debugging...
3212
+ mandatory = True ,
3211
3213
exists = True )
3212
3214
3213
3215
verbose = traits .Bool (
@@ -3219,15 +3221,9 @@ class NlpFitInputSpec(CommandLineInputSpec):
3219
3221
usedefault = True ,
3220
3222
default_value = True )
3221
3223
3222
- # FIXME Very bare implementation, many parameters not done yet.
3223
-
3224
3224
3225
3225
class NlpFitOutputSpec (TraitedSpec ):
3226
- # FIXME nlpfit has two modes... deal with output.xfm vs output.mnc
3227
- # depending on whether -config_file is passed.
3228
-
3229
3226
output_xfm = File (desc = 'output xfm file' , exists = True )
3230
- # FIXME Is this always the case, that exists=True?
3231
3227
output_grid = File (desc = 'output grid file' , exists = True )
3232
3228
3233
3229
@@ -3258,32 +3254,13 @@ class NlpFit(CommandLine):
3258
3254
output_spec = NlpFitOutputSpec
3259
3255
_cmd = 'nlpfit'
3260
3256
3261
- def _gen_filename (self , name ):
3262
- if name == 'output_xfm' :
3263
- output_xfm = self .inputs .output_xfm
3264
-
3265
- if isdefined (output_xfm ):
3266
- return os .path .abspath (output_xfm )
3267
- else :
3268
- return aggregate_filename (
3269
- [self .inputs .source , self .inputs .target ], 'nlpfit_xfm_output' ) + '.xfm'
3270
- else :
3271
- raise NotImplemented
3272
-
3273
3257
def _list_outputs (self ):
3274
- outputs = self .output_spec ().get ()
3275
- # FIXME see above.
3276
- # outputs['output_mnc'] = os.path.abspath(self._gen_filename('output_mnc'))
3277
- outputs ['output_xfm' ] = os .path .abspath (
3278
- self ._gen_filename ('output_xfm' ))
3258
+ outputs = super (NlpFit , self )._list_outputs ()
3279
3259
3280
- # FIXME Is this the sensible? No other way to tell if the grid files
3281
- # were produced.
3282
- # FIXME This is safe to assume?
3283
- assert os .path .exists (outputs ['output_xfm' ])
3284
- if 'grid' in open (outputs ['output_xfm' ], 'r' ).read ():
3285
- outputs ['output_grid' ] = re .sub (
3286
- '.(nlxfm|xfm)$' , '_grid_0.mnc' , outputs ['output_xfm' ])
3260
+ if os .path .exists (outputs ['output_xfm' ]):
3261
+ if 'grid' in open (outputs ['output_xfm' ], 'r' ).read ():
3262
+ outputs ['output_grid' ] = re .sub (
3263
+ '.(nlxfm|xfm)$' , '_grid_0.mnc' , outputs ['output_xfm' ])
3287
3264
3288
3265
return outputs
3289
3266
0 commit comments