Skip to content

Commit 8f8c19d

Browse files
committed
output_name example
1 parent 117b8d5 commit 8f8c19d

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

nipype/interfaces/mrtrix/preprocess.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def _gen_outfilename(self):
8484
class DWI2TensorInputSpec(CommandLineInputSpec):
8585
in_file = InputMultiPath(File(exists=True), argstr='%s', mandatory=True,
8686
position=-2, desc='Diffusion-weighted images')
87-
out_filename = File(genfile=True, argstr='%s', position=-1,
88-
desc='Output tensor filename')
87+
out_filename = File(name_template="%s_tensor.mif", name_source="in_file", output_name="tensor",
88+
argstr='%s', posidesc='Output tensor filename', position=-1)
8989
encoding_file = File(argstr='-grad %s', position= 2,
9090
desc=('Encoding file supplied as a 4xN text file with '
9191
'each line is in the format [ X Y Z b ], where '
@@ -114,27 +114,15 @@ class DWI2Tensor(CommandLine):
114114
>>> dwi2tensor = mrt.DWI2Tensor()
115115
>>> dwi2tensor.inputs.in_file = 'dwi.mif'
116116
>>> dwi2tensor.inputs.encoding_file = 'encoding.txt'
117+
>>> dwi2tensor.cmdline
118+
'dwi2tensor -grad encoding.txt dwi.mif dwi_tensor.mif'
117119
>>> dwi2tensor.run() # doctest: +SKIP
118120
"""
119121

120122
_cmd = 'dwi2tensor'
121123
input_spec=DWI2TensorInputSpec
122124
output_spec=DWI2TensorOutputSpec
123125

124-
def _list_outputs(self):
125-
outputs = self.output_spec().get()
126-
outputs['tensor'] = op.abspath(self._gen_outfilename())
127-
return outputs
128-
129-
def _gen_filename(self, name):
130-
if name is 'out_filename':
131-
return self._gen_outfilename()
132-
else:
133-
return None
134-
def _gen_outfilename(self):
135-
_, name , _ = split_filename(self.inputs.in_file[0])
136-
return name + '_tensor.mif'
137-
138126
class Tensor2VectorInputSpec(CommandLineInputSpec):
139127
in_file = File(exists=True, argstr='%s', mandatory=True, position=-2,
140128
desc='Diffusion tensor image')

0 commit comments

Comments
 (0)