@@ -85,6 +85,8 @@ class DTIFitOutputSpec(TraitedSpec):
85
85
'diffusion weighting' ))
86
86
tensor = File (
87
87
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' )
88
90
89
91
90
92
class DTIFit (FSLCommand ):
@@ -111,13 +113,21 @@ class DTIFit(FSLCommand):
111
113
output_spec = DTIFitOutputSpec
112
114
113
115
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
+
114
128
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 )
121
131
return outputs
122
132
123
133
0 commit comments