@@ -73,7 +73,7 @@ def _list_outputs(self):
7373 return outputs
7474
7575
76- class DWI2FODInputSpec (MRTrix3BaseInputSpec ):
76+ class EstimateFODInputSpec (MRTrix3BaseInputSpec ):
7777 algorithm = traits .Enum ('csd' ,'msmt_csd' , argstr = '%s' , position = - 8 ,
7878 mandatory = True , desc = 'FOD algorithm' )
7979 dwi_file = File (exists = True , argstr = '%s' , position = - 7 ,
@@ -88,150 +88,41 @@ class DWI2FODInputSpec(MRTrix3BaseInputSpec):
8888 csf_odf = File ('csf.mif' , argstr = '%s' , position = - 1 , desc = 'output CSF ODF' )
8989 mask_file = File (exists = True , argstr = '-mask %s' , desc = 'mask image' )
9090
91-
92- class DWI2FODOutputSpec (TraitedSpec ):
93- wm_odf = File (argstr = '%s' , desc = 'output WM ODF' )
94- gm_odf = File (argstr = '%s' , desc = 'output GM ODF' )
95- csf_odf = File (argstr = '%s' , desc = 'output CSF ODF' )
96-
97-
98- class DWI2FOD (MRTrix3Base ):
99-
100- """
101- Estimate fibre orientation distributions from diffusion data using spherical deconvolution
102-
103- Example
104- -------
105-
106- >>> import nipype.interfaces.mrtrix3 as mrt
107- >>> fod = mrt.DWI2FOD()
108- >>> fod.inputs.algorithm = 'csd'
109- >>> fod.inputs.dwi_file = 'dwi.mif'
110- >>> fod.inputs.wm_txt = 'wm.txt'
111- >>> fod.inputs.grad_fsl = ('bvecs', 'bvals')
112- >>> fod.cmdline # doctest: +ELLIPSIS
113- 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif'
114- >>> fod.run() # doctest: +SKIP
115- """
116-
117- _cmd = 'dwi2fod'
118- input_spec = DWI2FODInputSpec
119- output_spec = DWI2FODOutputSpec
120-
121- def _list_outputs (self ):
122- outputs = self .output_spec ().get ()
123- outputs ['wm_odf' ] = op .abspath (self .inputs .wm_odf )
124- if self .inputs .gm_odf != Undefined :
125- outputs ['gm_odf' ] = op .abspath (self .inputs .gm_odf )
126- if self .inputs .csf_odf != Undefined :
127- outputs ['csf_odf' ] = op .abspath (self .inputs .csf_odf )
128- return outputs
129-
130-
131- class EstimateFODInputSpec (MRTrix3BaseInputSpec ):
132- in_file = File (exists = True , argstr = '%s' , mandatory = True , position = - 3 ,
133- desc = 'input diffusion weighted images' )
134- response = File (
135- exists = True , argstr = '%s' , mandatory = True , position = - 2 ,
136- desc = ('a text file containing the diffusion-weighted signal response '
137- 'function coefficients for a single fibre population' ))
138- out_file = File (
139- 'fods.mif' , argstr = '%s' , mandatory = True , position = - 1 ,
140- usedefault = True , desc = ('the output spherical harmonics coefficients'
141- ' image' ))
142-
14391 # DW Shell selection options
14492 shell = traits .List (traits .Float , sep = ',' , argstr = '-shell %s' ,
14593 desc = 'specify one or more dw gradient shells' )
146-
147- # Spherical deconvolution options
14894 max_sh = traits .Int (8 , argstr = '-lmax %d' ,
14995 desc = 'maximum harmonic degree of response function' )
150- in_mask = File (exists = True , argstr = '-mask %s' ,
151- desc = 'provide initial mask image' )
15296 in_dirs = File (
15397 exists = True , argstr = '-directions %s' ,
15498 desc = ('specify the directions over which to apply the non-negativity '
15599 'constraint (by default, the built-in 300 direction set is '
156100 'used). These should be supplied as a text file containing the '
157101 '[ az el ] pairs for the directions.' ))
158- sh_filter = File (
159- exists = True , argstr = '-filter %s' ,
160- desc = ('the linear frequency filtering parameters used for the initial '
161- 'linear spherical deconvolution step (default = [ 1 1 1 0 0 ]). '
162- 'These should be supplied as a text file containing the '
163- 'filtering coefficients for each even harmonic order.' ))
164-
165- neg_lambda = traits .Float (
166- 1.0 , argstr = '-neg_lambda %f' ,
167- desc = ('the regularisation parameter lambda that controls the strength'
168- ' of the non-negativity constraint' ))
169- thres = traits .Float (
170- 0.0 , argstr = '-threshold %f' ,
171- desc = ('the threshold below which the amplitude of the FOD is assumed '
172- 'to be zero, expressed as an absolute amplitude' ))
173-
174- n_iter = traits .Int (
175- 50 , argstr = '-niter %d' , desc = ('the maximum number of iterations '
176- 'to perform for each voxel' ))
177102
178103
179104class EstimateFODOutputSpec (TraitedSpec ):
180- out_file = File (exists = True , desc = 'the output response file' )
105+ wm_odf = File (argstr = '%s' , desc = 'output WM ODF' )
106+ gm_odf = File (argstr = '%s' , desc = 'output GM ODF' )
107+ csf_odf = File (argstr = '%s' , desc = 'output CSF ODF' )
181108
182109
183110class EstimateFOD (MRTrix3Base ):
184111
185112 """
186- Convert diffusion-weighted images to tensor images
187- (previous MRTrix releases)
188-
189- Note that this program makes use of implied symmetries in the diffusion
190- profile. First, the fact the signal attenuation profile is real implies
191- that it has conjugate symmetry, i.e. Y(l,-m) = Y(l,m)* (where * denotes
192- the complex conjugate). Second, the diffusion profile should be
193- antipodally symmetric (i.e. S(x) = S(-x)), implying that all odd l
194- components should be zero. Therefore, this program only computes the even
195- elements.
196-
197- Note that the spherical harmonics equations used here differ slightly from
198- those conventionally used, in that the (-1)^m factor has been omitted.
199- This should be taken into account in all subsequent calculations.
200- The spherical harmonic coefficients are stored as follows. First, since
201- the signal attenuation profile is real, it has conjugate symmetry, i.e.
202- Y(l,-m) = Y(l,m)* (where * denotes the complex conjugate). Second, the
203- diffusion profile should be antipodally symmetric (i.e. S(x) = S(-x)),
204- implying that all odd l components should be zero. Therefore, only the
205- even elements are computed.
206-
207- Note that the spherical harmonics equations used here differ slightly from
208- those conventionally used, in that the (-1)^m factor has been omitted.
209- This should be taken into account in all subsequent calculations.
210- Each volume in the output image corresponds to a different spherical
211- harmonic component. Each volume will correspond to the following:
212-
213- volume 0: l = 0, m = 0
214- volume 1: l = 2, m = -2 (imaginary part of m=2 SH)
215- volume 2: l = 2, m = -1 (imaginary part of m=1 SH)
216- volume 3: l = 2, m = 0
217- volume 4: l = 2, m = 1 (real part of m=1 SH)
218- volume 5: l = 2, m = 2 (real part of m=2 SH)
219- etc...
220-
221-
113+ Estimate fibre orientation distributions from diffusion data using spherical deconvolution
222114
223115 Example
224116 -------
225117
226118 >>> import nipype.interfaces.mrtrix3 as mrt
227119 >>> fod = mrt.EstimateFOD()
228- >>> fod.inputs.in_file = 'dwi.mif '
229- >>> fod.inputs.response = 'response.txt '
230- >>> fod.inputs.in_mask = 'mask.nii.gz '
120+ >>> fod.inputs.algorithm = 'csd '
121+ >>> fod.inputs.dwi_file = 'dwi.mif '
122+ >>> fod.inputs.wm_txt = 'wm.txt '
231123 >>> fod.inputs.grad_fsl = ('bvecs', 'bvals')
232124 >>> fod.cmdline # doctest: +ELLIPSIS
233- 'dwi2fod -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif response.txt\
234- fods.mif'
125+ 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif'
235126 >>> fod.run() # doctest: +SKIP
236127 """
237128
@@ -241,5 +132,12 @@ class EstimateFOD(MRTrix3Base):
241132
242133 def _list_outputs (self ):
243134 outputs = self .output_spec ().get ()
244- outputs ['out_file' ] = op .abspath (self .inputs .out_file )
135+ outputs ['wm_odf' ] = op .abspath (self .inputs .wm_odf )
136+ if self .inputs .gm_odf != Undefined :
137+ outputs ['gm_odf' ] = op .abspath (self .inputs .gm_odf )
138+ if self .inputs .csf_odf != Undefined :
139+ outputs ['csf_odf' ] = op .abspath (self .inputs .csf_odf )
245140 return outputs
141+
142+
143+
0 commit comments