@@ -4047,13 +4047,20 @@ class VolSymmInputSpec(CommandLineInputSpec):
4047
4047
desc = 'output xfm trans file' ,
4048
4048
genfile = True ,
4049
4049
argstr = '%s' ,
4050
- position = - 2 )
4050
+ position = - 2 ,
4051
+ name_source = ['input_file' ],
4052
+ hash_files = False ,
4053
+ name_template = '%s_vol_symm.xfm' ,
4054
+ keep_extension = False )
4051
4055
4052
4056
output_file = File (
4053
4057
desc = 'output file' ,
4054
4058
genfile = True ,
4055
4059
argstr = '%s' ,
4056
- position = - 1 ,)
4060
+ position = - 1 ,
4061
+ name_source = ['input_file' ],
4062
+ hash_files = False ,
4063
+ name_template = '%s_vol_symm.mnc' )
4057
4064
4058
4065
# This is a dummy input.
4059
4066
input_grid_files = InputMultiPath (
@@ -4124,42 +4131,12 @@ class VolSymm(CommandLine):
4124
4131
output_spec = VolSymmOutputSpec
4125
4132
_cmd = 'volsymm'
4126
4133
4127
- def _gen_filename (self , name ):
4128
- if name == 'output_file' :
4129
- output_file = self .inputs .output_file
4130
-
4131
- if isdefined (output_file ):
4132
- return os .path .abspath (output_file )
4133
- else :
4134
- return aggregate_filename (
4135
- [self .inputs .input_file ], 'volsymm_output' )
4136
- elif name == 'trans_file' :
4137
- trans_file = self .inputs .trans_file
4138
-
4139
- if isdefined (trans_file ):
4140
- return os .path .abspath (trans_file )
4141
- else :
4142
- return aggregate_filename (
4143
- [self .inputs .input_file ], 'volsymm_output' ) + '.xfm'
4144
- else :
4145
- raise NotImplemented
4146
-
4147
- def _gen_outfilename (self ):
4148
- return self ._gen_filename ('output_file' )
4149
-
4150
4134
def _list_outputs (self ):
4151
- outputs = self .output_spec ().get ()
4152
- outputs ['output_file' ] = os .path .abspath (
4153
- self ._gen_filename ('output_file' ))
4154
- outputs ['trans_file' ] = os .path .abspath (
4155
- self ._gen_filename ('trans_file' ))
4135
+ outputs = super (VolSymm , self )._list_outputs ()
4156
4136
4157
- # FIXME Is this the sensible? No other way to tell if the grid files
4158
- # were produced.
4159
- # FIXME This is safe to assume?
4160
- assert os .path .exists (outputs ['trans_file' ])
4161
- if 'grid' in open (outputs ['trans_file' ], 'r' ).read ():
4162
- outputs ['output_grid' ] = re .sub (
4163
- '.(nlxfm|xfm)$' , '_grid_0.mnc' , outputs ['trans_file' ])
4137
+ # Have to manually check for the grid files.
4138
+ if os .path .exists (outputs ['trans_file' ]):
4139
+ if 'grid' in open (outputs ['trans_file' ], 'r' ).read ():
4140
+ outputs ['output_grid' ] = re .sub ('.(nlxfm|xfm)$' , '_grid_0.mnc' , outputs ['trans_file' ])
4164
4141
4165
4142
return outputs
0 commit comments