@@ -108,9 +108,13 @@ class EstimateFODInputSpec(MRTrix3BaseInputSpec):
108108 desc = "output WM ODF" ,
109109 )
110110 gm_txt = File (argstr = "%s" , position = - 4 , desc = "GM response text file" )
111- gm_odf = File (argstr = "%s" , position = - 3 , desc = "output GM ODF" )
111+ gm_odf = File (
112+ "gm.mif" , usedefault = True , argstr = "%s" , position = - 3 , desc = "output GM ODF"
113+ )
112114 csf_txt = File (argstr = "%s" , position = - 2 , desc = "CSF response text file" )
113- csf_odf = File (argstr = "%s" , position = - 1 , desc = "output CSF ODF" )
115+ csf_odf = File (
116+ "csf.mif" , usedefault = True , argstr = "%s" , position = - 1 , desc = "output CSF ODF"
117+ )
114118 mask_file = File (exists = True , argstr = "-mask %s" , desc = "mask image" )
115119
116120 # DW Shell selection options
@@ -122,6 +126,8 @@ class EstimateFODInputSpec(MRTrix3BaseInputSpec):
122126 )
123127 max_sh = InputMultiObject (
124128 traits .Int ,
129+ value = [8 ],
130+ usedefault = True ,
125131 argstr = "-lmax %s" ,
126132 sep = "," ,
127133 desc = (
@@ -150,18 +156,24 @@ class EstimateFOD(MRTrix3Base):
150156 """
151157 Estimate fibre orientation distributions from diffusion data using spherical deconvolution
152158
159+ .. warning::
160+
161+ The CSD algorithm does not work as intended, but fixing it in this interface could break
162+ existing workflows. This interface has been superseded by
163+ :py:class:`.ConstrainedSphericalDecomposition`.
164+
153165 Example
154166 -------
155167
156168 >>> import nipype.interfaces.mrtrix3 as mrt
157169 >>> fod = mrt.EstimateFOD()
158- >>> fod.inputs.algorithm = 'csd '
170+ >>> fod.inputs.algorithm = 'msmt_csd '
159171 >>> fod.inputs.in_file = 'dwi.mif'
160172 >>> fod.inputs.wm_txt = 'wm.txt'
161173 >>> fod.inputs.grad_fsl = ('bvecs', 'bvals')
162- >>> fod.cmdline # doctest: +ELLIPSIS
163- 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif'
164- >>> fod.run() # doctest: +SKIP
174+ >>> fod.cmdline
175+ 'dwi2fod -fslgrad bvecs bvals -lmax 8 msmt_csd dwi.mif wm.txt wm.mif gm.mif csf .mif'
176+ >>> fod.run() # doctest: +SKIP
165177 """
166178
167179 _cmd = "dwi2fod"
@@ -176,3 +188,46 @@ def _list_outputs(self):
176188 if self .inputs .csf_odf != Undefined :
177189 outputs ["csf_odf" ] = op .abspath (self .inputs .csf_odf )
178190 return outputs
191+
192+
193+ class ConstrainedSphericalDeconvolutionInputSpec (EstimateFODInputSpec ):
194+ gm_odf = File (argstr = "%s" , position = - 3 , desc = "output GM ODF" )
195+ csf_odf = File (argstr = "%s" , position = - 1 , desc = "output CSF ODF" )
196+ max_sh = InputMultiObject (
197+ traits .Int ,
198+ argstr = "-lmax %s" ,
199+ sep = "," ,
200+ desc = (
201+ "maximum harmonic degree of response function - single value for single-shell response, list for multi-shell response"
202+ ),
203+ )
204+
205+
206+ class ConstrainedSphericalDeconvolution (EstimateFOD ):
207+ """
208+ Estimate fibre orientation distributions from diffusion data using spherical deconvolution
209+
210+ This interface supersedes :py:class:`.EstimateFOD`.
211+ The old interface has contained a bug when using the CSD algorithm as opposed to the MSMT CSD
212+ algorithm, but fixing it could potentially break existing workflows. The new interface works
213+ the same, but does not populate the following inputs by default:
214+
215+ * ``gm_odf``
216+ * ``csf_odf``
217+ * ``max_sh``
218+
219+ Example
220+ -------
221+
222+ >>> import nipype.interfaces.mrtrix3 as mrt
223+ >>> fod = mrt.ConstrainedSphericalDeconvolution()
224+ >>> fod.inputs.algorithm = 'csd'
225+ >>> fod.inputs.in_file = 'dwi.mif'
226+ >>> fod.inputs.wm_txt = 'wm.txt'
227+ >>> fod.inputs.grad_fsl = ('bvecs', 'bvals')
228+ >>> fod.cmdline
229+ 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif'
230+ >>> fod.run() # doctest: +SKIP
231+ """
232+
233+ input_spec = ConstrainedSphericalDeconvolutionInputSpec
0 commit comments