nipype.interfaces.mrtrix3.reconst module

ConstrainedSphericalDeconvolution

Link to code

Bases: EstimateFOD

Wrapped executable: dwi2fod.

Estimate fibre orientation distributions from diffusion data using spherical deconvolution

This interface supersedes EstimateFOD. The old interface has contained a bug when using the CSD algorithm as opposed to the MSMT CSD algorithm, but fixing it could potentially break existing workflows. The new interface works the same, but does not populate the following inputs by default:

  • gm_odf
  • csf_odf
  • max_sh

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> fod = mrt.ConstrainedSphericalDeconvolution()
>>> fod.inputs.algorithm = 'csd'
>>> fod.inputs.in_file = 'dwi.mif'
>>> fod.inputs.wm_txt = 'wm.txt'
>>> fod.inputs.grad_fsl = ('bvecs', 'bvals')
>>> fod.cmdline
'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif'
>>> fod.run()  # doctest: +SKIP
algorithm : ‘csd’ or ‘msmt_csd’
FOD algorithm. Maps to a command-line argument: %s (position: -8).
in_file : a pathlike object or string representing an existing file
Input DWI image. Maps to a command-line argument: %s (position: -7).
wm_odf : a pathlike object or string representing a file
Output WM ODF. Maps to a command-line argument: %s (position: -5). (Nipype default value: wm.mif)
wm_txt : a pathlike object or string representing a file
WM response text file. Maps to a command-line argument: %s (position: -6).
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
bval_scale : ‘yes’ or ‘no’
Specifies whether the b - values should be scaled by the square of the corresponding DW gradient norm, as often required for multishell or DSI DW acquisition schemes. The default action can also be set in the MRtrix config file, under the BValueScaling entry. Valid choices are yes / no, true / false, 0 / 1 (default: true). Maps to a command-line argument: -bvalue_scaling %s.
csf_odf : a pathlike object or string representing a file
Output CSF ODF. Maps to a command-line argument: %s (position: -1).
csf_txt : a pathlike object or string representing a file
CSF response text file. Maps to a command-line argument: %s (position: -2).
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
gm_odf : a pathlike object or string representing a file
Output GM ODF. Maps to a command-line argument: %s (position: -3).
gm_txt : a pathlike object or string representing a file
GM response text file. Maps to a command-line argument: %s (position: -4).
grad_file : a pathlike object or string representing an existing file
Dw gradient scheme (MRTrix format). Maps to a command-line argument: -grad %s. Mutually exclusive with inputs: grad_fsl.
grad_fsl : a tuple of the form: (a pathlike object or string representing an existing file, a pathlike object or string representing an existing file)
(bvecs, bvals) dw gradient scheme (FSL format). Maps to a command-line argument: -fslgrad %s %s. Mutually exclusive with inputs: grad_file.
in_bval : a pathlike object or string representing an existing file
Bvals file in FSL format.
in_bvec : a pathlike object or string representing an existing file
Bvecs file in FSL format. Maps to a command-line argument: -fslgrad %s %s.
in_dirs : a pathlike object or string representing an existing file
Specify the directions over which to apply the non-negativity constraint (by default, the built-in 300 direction set is used). These should be supplied as a text file containing the [ az el ] pairs for the directions. Maps to a command-line argument: -directions %s.
mask_file : a pathlike object or string representing an existing file
Mask image. Maps to a command-line argument: -mask %s.
max_sh : a list of items which are an integer (int or long)
Maximum harmonic degree of response function - single value for single-shell response, list for multi-shell response. Maps to a command-line argument: -lmax %s.
nthreads : an integer (int or long)
Number of threads. if zero, the number of available cpus will be used. Maps to a command-line argument: -nthreads %d.
shell : a list of items which are a float
Specify one or more dw gradient shells. Maps to a command-line argument: -shell %s.
csf_odf : a pathlike object or string representing a file
Output CSF ODF. Maps to a command-line argument: %s.
gm_odf : a pathlike object or string representing a file
Output GM ODF. Maps to a command-line argument: %s.
wm_odf : a pathlike object or string representing a file
Output WM ODF. Maps to a command-line argument: %s.

EstimateFOD

Link to code

Bases: MRTrix3Base

Wrapped executable: dwi2fod.

Estimate fibre orientation distributions from diffusion data using spherical deconvolution

Warning

The CSD algorithm does not work as intended, but fixing it in this interface could break existing workflows. This interface has been superseded by ConstrainedSphericalDecomposition.

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> fod = mrt.EstimateFOD()
>>> fod.inputs.algorithm = 'msmt_csd'
>>> fod.inputs.in_file = 'dwi.mif'
>>> fod.inputs.wm_txt = 'wm.txt'
>>> fod.inputs.grad_fsl = ('bvecs', 'bvals')
>>> fod.cmdline
'dwi2fod -fslgrad bvecs bvals -lmax 8 msmt_csd dwi.mif wm.txt wm.mif gm.mif csf.mif'
>>> fod.run()  # doctest: +SKIP
algorithm : ‘csd’ or ‘msmt_csd’
FOD algorithm. Maps to a command-line argument: %s (position: -8).
in_file : a pathlike object or string representing an existing file
Input DWI image. Maps to a command-line argument: %s (position: -7).
wm_odf : a pathlike object or string representing a file
Output WM ODF. Maps to a command-line argument: %s (position: -5). (Nipype default value: wm.mif)
wm_txt : a pathlike object or string representing a file
WM response text file. Maps to a command-line argument: %s (position: -6).
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
bval_scale : ‘yes’ or ‘no’
Specifies whether the b - values should be scaled by the square of the corresponding DW gradient norm, as often required for multishell or DSI DW acquisition schemes. The default action can also be set in the MRtrix config file, under the BValueScaling entry. Valid choices are yes / no, true / false, 0 / 1 (default: true). Maps to a command-line argument: -bvalue_scaling %s.
csf_odf : a pathlike object or string representing a file
Output CSF ODF. Maps to a command-line argument: %s (position: -1). (Nipype default value: csf.mif)
csf_txt : a pathlike object or string representing a file
CSF response text file. Maps to a command-line argument: %s (position: -2).
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
gm_odf : a pathlike object or string representing a file
Output GM ODF. Maps to a command-line argument: %s (position: -3). (Nipype default value: gm.mif)
gm_txt : a pathlike object or string representing a file
GM response text file. Maps to a command-line argument: %s (position: -4).
grad_file : a pathlike object or string representing an existing file
Dw gradient scheme (MRTrix format). Maps to a command-line argument: -grad %s. Mutually exclusive with inputs: grad_fsl.
grad_fsl : a tuple of the form: (a pathlike object or string representing an existing file, a pathlike object or string representing an existing file)
(bvecs, bvals) dw gradient scheme (FSL format). Maps to a command-line argument: -fslgrad %s %s. Mutually exclusive with inputs: grad_file.
in_bval : a pathlike object or string representing an existing file
Bvals file in FSL format.
in_bvec : a pathlike object or string representing an existing file
Bvecs file in FSL format. Maps to a command-line argument: -fslgrad %s %s.
in_dirs : a pathlike object or string representing an existing file
Specify the directions over which to apply the non-negativity constraint (by default, the built-in 300 direction set is used). These should be supplied as a text file containing the [ az el ] pairs for the directions. Maps to a command-line argument: -directions %s.
mask_file : a pathlike object or string representing an existing file
Mask image. Maps to a command-line argument: -mask %s.
max_sh : a list of items which are an integer (int or long)
Maximum harmonic degree of response function - single value for single-shell response, list for multi-shell response. Maps to a command-line argument: -lmax %s. (Nipype default value: [8])
nthreads : an integer (int or long)
Number of threads. if zero, the number of available cpus will be used. Maps to a command-line argument: -nthreads %d.
shell : a list of items which are a float
Specify one or more dw gradient shells. Maps to a command-line argument: -shell %s.
csf_odf : a pathlike object or string representing a file
Output CSF ODF. Maps to a command-line argument: %s.
gm_odf : a pathlike object or string representing a file
Output GM ODF. Maps to a command-line argument: %s.
wm_odf : a pathlike object or string representing a file
Output WM ODF. Maps to a command-line argument: %s.

FitTensor

Link to code

Bases: MRTrix3Base

Wrapped executable: dwi2tensor.

Convert diffusion-weighted images to tensor images

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> tsr = mrt.FitTensor()
>>> tsr.inputs.in_file = 'dwi.mif'
>>> tsr.inputs.in_mask = 'mask.nii.gz'
>>> tsr.inputs.grad_fsl = ('bvecs', 'bvals')
>>> tsr.cmdline                               # doctest: +ELLIPSIS
'dwi2tensor -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif dti.mif'
>>> tsr.run()                                 # doctest: +SKIP
in_file : a pathlike object or string representing an existing file
Input diffusion weighted images. Maps to a command-line argument: %s (position: -2).
out_file : a pathlike object or string representing a file
The output diffusion tensor image. Maps to a command-line argument: %s (position: -1). (Nipype default value: dti.mif)
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
bval_scale : ‘yes’ or ‘no’
Specifies whether the b - values should be scaled by the square of the corresponding DW gradient norm, as often required for multishell or DSI DW acquisition schemes. The default action can also be set in the MRtrix config file, under the BValueScaling entry. Valid choices are yes / no, true / false, 0 / 1 (default: true). Maps to a command-line argument: -bvalue_scaling %s.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
grad_file : a pathlike object or string representing an existing file
Dw gradient scheme (MRTrix format). Maps to a command-line argument: -grad %s. Mutually exclusive with inputs: grad_fsl.
grad_fsl : a tuple of the form: (a pathlike object or string representing an existing file, a pathlike object or string representing an existing file)
(bvecs, bvals) dw gradient scheme (FSL format). Maps to a command-line argument: -fslgrad %s %s. Mutually exclusive with inputs: grad_file.
in_bval : a pathlike object or string representing an existing file
Bvals file in FSL format.
in_bvec : a pathlike object or string representing an existing file
Bvecs file in FSL format. Maps to a command-line argument: -fslgrad %s %s.
in_mask : a pathlike object or string representing an existing file
Only perform computation within the specified binary brain mask image. Maps to a command-line argument: -mask %s.
method : ‘nonlinear’ or ‘loglinear’ or ‘sech’ or ‘rician’
Select method used to perform the fitting. Maps to a command-line argument: -method %s.
nthreads : an integer (int or long)
Number of threads. if zero, the number of available cpus will be used. Maps to a command-line argument: -nthreads %d.
reg_term : a float
Specify the strength of the regularisation term on the magnitude of the tensor elements (default = 5000). This only applies to the non-linear methods. Maps to a command-line argument: -regularisation %f.
out_file : a pathlike object or string representing an existing file
The output DTI file.