Skip to content

Commit 6a393ca

Browse files
committed
testing file naming
1 parent 8812dc7 commit 6a393ca

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

nipype/interfaces/dtitk/registration.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,23 @@ class RigidTask(CommandLineDtitk):
3939
output_spec = RigidOutputSpec
4040
_cmd = 'dti_rigid_sn'
4141

42+
def _gen_outfilename(self):
43+
out_file = self.inputs.out_file
44+
if not isdefined(out_file) and isdefined(self.inputs.in_file):
45+
out_file = self._gen_fname(self.inputs.in_file,
46+
suffix='.aff', change_ext=False)
47+
4248
def _list_outputs(self):
4349
outputs = self.output_spec().get()
44-
outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz',
45-
'.aff')
50+
outputs['out_file_xfm'] = self._gen_outfilename()
4651
outputs['out_file'] = self.inputs.in_file.replace('.nii.gz',
4752
'_aff.nii.gz')
4853
return outputs
4954

55+
def _gen_fname(self, name):
56+
if name == 'out_file':
57+
return self._gen_outfilename()
58+
5059

5160
class AffineInputSpec(CommandLineInputSpec):
5261
in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image",

nipype/interfaces/dtitk/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class SVAdjustVoxSpInputSpec(CommandLineInputSpec):
117117
position=2, argstr="-target %s")
118118
in_voxsz = traits.Str(desc='resampled voxel size', exists=True,
119119
mandatory=False, position=3, argstr="-vsize %s")
120-
out_path = traits.Str(desc='output path', exists=True, mandatory=False,
120+
out_file = traits.Str(desc='output path', exists=True, mandatory=False,
121121
position=1, argstr="-out %s",
122122
name_source="in_file",
123123
name_template='%s_origmvd.nii.gz')
@@ -146,23 +146,23 @@ class SVAdjustVoxSpTask(CommandLineDtitk):
146146
_cmd = 'SVAdjustVoxelspace'
147147
_suffix = '_reslice'
148148

149+
def _gen_filename(self, name):
150+
if name == "out_file":
151+
return self._list_outputs()["out_file"]
152+
return None
153+
149154
def _list_outputs(self):
150155
outputs = self.output_spec().get()
151156
outputs['out_file'] = self.inputs.out_file
152157
if not isdefined(self.inputs.out_file):
153-
outputs["out_file"] = self._gen_fname(self.inputs.in_file,
158+
outputs["out_file"] = self._gen_filename(self.inputs.in_file,
154159
suffix=self._suffix,
155160
ext='.' + '.'.join(
156161
self.inputs.in_file.
157-
plit(".")[1:]))
162+
split(".")[1:]))
158163
outputs["out_file"] = os.path.abspath(outputs["out_file"])
159164
return outputs
160165

161-
def _gen_filename(self, name):
162-
if name == "out_file":
163-
return self._list_outputs()["out_file"]
164-
return None
165-
166166

167167
class TVResampleInputSpec(CommandLineInputSpec):
168168
in_file = traits.Str(desc="image to resample", exists=True,

0 commit comments

Comments
 (0)