Skip to content

Commit 39675df

Browse files
authored
Merge pull request #2749 from divetea/dtifit
ENH: Add 'sse' output to FSL DTIFit interface
2 parents a10963c + 2cbfea6 commit 39675df

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

nipype/interfaces/fsl/dti.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class DTIFitOutputSpec(TraitedSpec):
8585
'diffusion weighting'))
8686
tensor = File(
8787
exists=True, desc='path/name of file with the 4D tensor volume')
88+
sse = File(
89+
exists=True, desc='path/name of file with the summed squared error')
8890

8991

9092
class DTIFit(FSLCommand):
@@ -111,13 +113,21 @@ class DTIFit(FSLCommand):
111113
output_spec = DTIFitOutputSpec
112114

113115
def _list_outputs(self):
116+
keys_to_ignore = {'outputtype', 'environ', 'args'}
117+
# Optional output: Map output name to input flag
118+
opt_output = {'tensor': self.inputs.save_tensor,
119+
'sse': self.inputs.sse}
120+
# Ignore optional output, whose corresponding input-flag is not defined
121+
# or set to False
122+
for output, input_flag in opt_output.items():
123+
if isdefined(input_flag) and input_flag:
124+
# this is wanted output, do not ignore
125+
continue
126+
keys_to_ignore.add(output)
127+
114128
outputs = self.output_spec().get()
115-
for k in list(outputs.keys()):
116-
if k not in ('outputtype', 'environ', 'args'):
117-
if k != 'tensor' or (isdefined(self.inputs.save_tensor)
118-
and self.inputs.save_tensor):
119-
outputs[k] = self._gen_fname(
120-
self.inputs.base_name, suffix='_' + k)
129+
for k in set(outputs.keys()) - keys_to_ignore:
130+
outputs[k] = self._gen_fname(self.inputs.base_name, suffix='_' + k)
121131
return outputs
122132

123133

nipype/interfaces/fsl/tests/test_auto_DTIFit.py

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_DTIFit_outputs():
6666
V2=dict(),
6767
V3=dict(),
6868
tensor=dict(),
69+
sse=dict(),
6970
)
7071
outputs = DTIFit.output_spec()
7172

0 commit comments

Comments
 (0)