interfaces.mrtrix3.preprocess

DWIDenoise

Link to code

Wraps command dwidenoise

Denoise DWI data and estimate the noise level based on the optimal threshold for PCA.

DWI data denoising and noise map estimation by exploiting data redundancy in the PCA domain using the prior knowledge that the eigenspectrum of random covariance matrices is described by the universal Marchenko Pastur distribution.

Important note: image denoising must be performed as the first step of the image processing pipeline. The routine will fail if interpolation or smoothing has been applied to the data prior to denoising.

Note that this function does not correct for non-Gaussian noise biases.

For more information, see <https://mrtrix.readthedocs.io/en/latest/reference/commands/dwidenoise.html>

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> denoise = mrt.DWIDenoise()
>>> denoise.inputs.in_file = 'dwi.mif'
>>> denoise.inputs.mask = 'mask.mif'
>>> denoise.cmdline                               
'dwidenoise -mask mask.mif dwi.mif dwi_denoised.mif'
>>> denoise.run()                                 

Inputs:

[Mandatory]
in_file: (an existing file name)
        input DWI image
        flag: %s, position: -2

[Optional]
args: (a unicode string)
        Additional parameters to the command
        flag: %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).
        flag: -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', nipype default value: {})
        Environment variables
extent: (a tuple of the form: (an integer (int or long), an integer
         (int or long), an integer (int or long)))
        set the window size of the denoising filter. (default = 5,5,5)
        flag: -extent %d,%d,%d
grad_file: (an existing file name)
        dw gradient scheme (MRTrix format
        flag: -grad %s
grad_fsl: (a tuple of the form: (an existing file name, an existing
         file name))
        (bvecs, bvals) dw gradient scheme (FSL format
        flag: -fslgrad %s %s
in_bval: (an existing file name)
        bvals file in FSL format
in_bvec: (an existing file name)
        bvecs file in FSL format
        flag: -fslgrad %s %s
mask: (an existing file name)
        mask image
        flag: -mask %s, position: 1
noise: (a file name)
        noise map
        flag: -noise %s
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        flag: -nthreads %d
out_file: (a file name)
        the output denoised DWI image
        flag: %s, position: -1

Outputs:

out_file: (an existing file name)
        the output denoised DWI image

ResponseSD

Link to code

Wraps command dwi2response

Estimate response function(s) for spherical deconvolution using the specified algorithm.

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> resp = mrt.ResponseSD()
>>> resp.inputs.in_file = 'dwi.mif'
>>> resp.inputs.algorithm = 'tournier'
>>> resp.inputs.grad_fsl = ('bvecs', 'bvals')
>>> resp.cmdline                               
'dwi2response tournier -fslgrad bvecs bvals -lmax 8 dwi.mif wm.txt'
>>> resp.run()                                 

# We can also pass in multiple harmonic degrees in the case of multi-shell >>> resp.inputs.max_sh = [6,8,10] >>> resp.cmdline ‘dwi2response tournier -fslgrad bvecs bvals -lmax 6,8,10 dwi.mif wm.txt’

Inputs:

[Mandatory]
algorithm: ('msmt_5tt' or 'dhollander' or 'tournier' or 'tax')
        response estimation algorithm (multi-tissue)
        flag: %s, position: 1
in_file: (an existing file name)
        input DWI image
        flag: %s, position: -5

[Optional]
args: (a unicode string)
        Additional parameters to the command
        flag: %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).
        flag: -bvalue_scaling %s
csf_file: (a file name)
        output CSF response text file
        flag: %s, position: -1
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', nipype default value: {})
        Environment variables
gm_file: (a file name)
        output GM response text file
        flag: %s, position: -2
grad_file: (an existing file name)
        dw gradient scheme (MRTrix format
        flag: -grad %s
grad_fsl: (a tuple of the form: (an existing file name, an existing
         file name))
        (bvecs, bvals) dw gradient scheme (FSL format
        flag: -fslgrad %s %s
in_bval: (an existing file name)
        bvals file in FSL format
in_bvec: (an existing file name)
        bvecs file in FSL format
        flag: -fslgrad %s %s
in_mask: (an existing file name)
        provide initial mask image
        flag: -mask %s
max_sh: (a list of items which are an integer (int or long), nipype
         default value: [8])
        maximum harmonic degree of response function - single value for
        single-shell response, list for multi-shell response
        flag: -lmax %s
mtt_file: (a file name)
        input 5tt image
        flag: %s, position: -4
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        flag: -nthreads %d
wm_file: (a file name, nipype default value: wm.txt)
        output WM response text file
        flag: %s, position: -3

Outputs:

csf_file: (a file name)
        output CSF response text file
        flag: %s
gm_file: (a file name)
        output GM response text file
        flag: %s
wm_file: (a file name)
        output WM response text file
        flag: %s