|
4 | 4 |
|
5 | 5 | import os.path as op
|
6 | 6 |
|
7 |
| -from ..base import traits, TraitedSpec, File, Undefined, InputMultiObject |
| 7 | +from ..base import traits, TraitedSpec, File, InputMultiObject, isdefined |
8 | 8 | from .base import MRTrix3BaseInputSpec, MRTrix3Base
|
9 | 9 |
|
10 | 10 |
|
@@ -50,10 +50,18 @@ class FitTensorInputSpec(MRTrix3BaseInputSpec):
|
50 | 50 | "only applies to the non-linear methods"
|
51 | 51 | ),
|
52 | 52 | )
|
| 53 | + predicted_signal = File( |
| 54 | + argstr="-predicted_signal %s", |
| 55 | + desc=( |
| 56 | + "specify a file to contain the predicted signal from the tensor " |
| 57 | + "fits. This can be used to calculate the residual signal" |
| 58 | + ), |
| 59 | + ) |
53 | 60 |
|
54 | 61 |
|
55 | 62 | class FitTensorOutputSpec(TraitedSpec):
|
56 | 63 | out_file = File(exists=True, desc="the output DTI file")
|
| 64 | + predicted_signal = File(desc="Predicted signal from fitted tensors") |
57 | 65 |
|
58 | 66 |
|
59 | 67 | class FitTensor(MRTrix3Base):
|
@@ -81,6 +89,8 @@ class FitTensor(MRTrix3Base):
|
81 | 89 | def _list_outputs(self):
|
82 | 90 | outputs = self.output_spec().get()
|
83 | 91 | outputs["out_file"] = op.abspath(self.inputs.out_file)
|
| 92 | + if isdefined(self.inputs.predicted_signal): |
| 93 | + outputs["predicted_signal"] = op.abspath(self.inputs.predicted_signal) |
84 | 94 | return outputs
|
85 | 95 |
|
86 | 96 |
|
@@ -144,12 +154,23 @@ class EstimateFODInputSpec(MRTrix3BaseInputSpec):
|
144 | 154 | "[ az el ] pairs for the directions."
|
145 | 155 | ),
|
146 | 156 | )
|
| 157 | + predicted_signal = File( |
| 158 | + argstr="-predicted_signal %s", |
| 159 | + desc=( |
| 160 | + "specify a file to contain the predicted signal from the FOD " |
| 161 | + "estimates. This can be used to calculate the residual signal." |
| 162 | + "Note that this is only valid if algorithm == 'msmt_csd'. " |
| 163 | + "For single shell reconstructions use a combination of SHConv " |
| 164 | + "and SH2Amp instead." |
| 165 | + ), |
| 166 | + ) |
147 | 167 |
|
148 | 168 |
|
149 | 169 | class EstimateFODOutputSpec(TraitedSpec):
|
150 | 170 | wm_odf = File(argstr="%s", desc="output WM ODF")
|
151 | 171 | gm_odf = File(argstr="%s", desc="output GM ODF")
|
152 | 172 | csf_odf = File(argstr="%s", desc="output CSF ODF")
|
| 173 | + predicted_signal = File(desc="output predicted signal") |
153 | 174 |
|
154 | 175 |
|
155 | 176 | class EstimateFOD(MRTrix3Base):
|
@@ -183,10 +204,17 @@ class EstimateFOD(MRTrix3Base):
|
183 | 204 | def _list_outputs(self):
|
184 | 205 | outputs = self.output_spec().get()
|
185 | 206 | outputs["wm_odf"] = op.abspath(self.inputs.wm_odf)
|
186 |
| - if self.inputs.gm_odf != Undefined: |
| 207 | + if isdefined(self.inputs.gm_odf): |
187 | 208 | outputs["gm_odf"] = op.abspath(self.inputs.gm_odf)
|
188 |
| - if self.inputs.csf_odf != Undefined: |
| 209 | + if isdefined(self.inputs.csf_odf): |
189 | 210 | outputs["csf_odf"] = op.abspath(self.inputs.csf_odf)
|
| 211 | + if isdefined(self.inputs.predicted_signal): |
| 212 | + if self.inputs.algorithm != "msmt_csd": |
| 213 | + raise Exception( |
| 214 | + "'predicted_signal' option can only be used with " |
| 215 | + "the 'msmt_csd' algorithm" |
| 216 | + ) |
| 217 | + outputs["predicted_signal"] = op.abspath(self.inputs.predicted_signal) |
190 | 218 | return outputs
|
191 | 219 |
|
192 | 220 |
|
|
0 commit comments