interfaces.mrtrix3.preprocess

DWIBiasCorrect

Link to code

Wraps the executable command dwibiascorrect.

Perform B1 field inhomogeneity correction for a DWI volume series.

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

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> bias_correct = mrt.DWIBiasCorrect()
>>> bias_correct.inputs.in_file = 'dwi.mif'
>>> bias_correct.inputs.use_ants = True
>>> bias_correct.cmdline
'dwibiascorrect -ants dwi.mif dwi_biascorr.mif'
>>> bias_correct.run()                             # doctest: +SKIP

Inputs:

[Mandatory]
in_file: (a pathlike object or string representing an existing file)
        input DWI image
        argument: ``%s``, position: -2
use_ants: (a boolean)
        use ANTS N4 to estimate the inhomogeneity field
        argument: ``-ants``
        mutually_exclusive: use_fsl
use_fsl: (a boolean)
        use FSL FAST to estimate the inhomogeneity field
        argument: ``-fsl``
        mutually_exclusive: use_ants

[Optional]
in_mask: (a pathlike object or string representing a file)
        input mask image for bias field estimation
        argument: ``-mask %s``
bias: (a pathlike object or string representing a file)
        bias field
        argument: ``-bias %s``
out_file: (a pathlike object or string representing a file)
        the output bias corrected DWI image
        argument: ``%s``, position: -1
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
grad_file: (a pathlike object or string representing an existing
          file)
        dw gradient scheme (MRTrix format)
        argument: ``-grad %s``
        mutually_exclusive: 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)
        argument: ``-fslgrad %s %s``
        mutually_exclusive: grad_file
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).
        argument: ``-bvalue_scaling %s``
in_bvec: (a pathlike object or string representing an existing file)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (a pathlike object or string representing an existing file)
        bvals file in FSL format
args: (a unicode string)
        Additional parameters to the command
        argument: ``%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

Outputs:

bias: (a pathlike object or string representing an existing file)
        the output bias field
out_file: (a pathlike object or string representing an existing file)
        the output bias corrected DWI image

DWIDenoise

Link to code

Wraps the executable 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.inputs.noise = 'noise.mif'
>>> denoise.cmdline                               # doctest: +ELLIPSIS
'dwidenoise -mask mask.mif -noise noise.mif dwi.mif dwi_denoised.mif'
>>> denoise.run()                                 # doctest: +SKIP

Inputs:

[Mandatory]
in_file: (a pathlike object or string representing an existing file)
        input DWI image
        argument: ``%s``, position: -2

[Optional]
mask: (a pathlike object or string representing an existing file)
        mask image
        argument: ``-mask %s``, position: 1
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)
        argument: ``-extent %d,%d,%d``
noise: (a pathlike object or string representing a file)
        the output noise map
        argument: ``-noise %s``
out_file: (a pathlike object or string representing a file)
        the output denoised DWI image
        argument: ``%s``, position: -1
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
grad_file: (a pathlike object or string representing an existing
          file)
        dw gradient scheme (MRTrix format)
        argument: ``-grad %s``
        mutually_exclusive: 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)
        argument: ``-fslgrad %s %s``
        mutually_exclusive: grad_file
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).
        argument: ``-bvalue_scaling %s``
in_bvec: (a pathlike object or string representing an existing file)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (a pathlike object or string representing an existing file)
        bvals file in FSL format
args: (a unicode string)
        Additional parameters to the command
        argument: ``%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

Outputs:

noise: (a pathlike object or string representing an existing file)
        the output noise map
out_file: (a pathlike object or string representing an existing file)
        the output denoised DWI image

MRDeGibbs

Link to code

Wraps the executable command mrdegibbs.

Remove Gibbs ringing artifacts.

This application attempts to remove Gibbs ringing artefacts from MRI images using the method of local subvoxel-shifts proposed by Kellner et al.

This command is designed to run on data directly after it has been reconstructed by the scanner, before any interpolation of any kind has taken place. You should not run this command after any form of motion correction (e.g. not after dwipreproc). Similarly, if you intend running dwidenoise, you should run this command afterwards, since it has the potential to alter the noise structure, which would impact on dwidenoise’s performance.

Note that this method is designed to work on images acquired with full k-space coverage. Running this method on partial Fourier (‘half-scan’) data may lead to suboptimal and/or biased results, as noted in the original reference below. There is currently no means of dealing with this; users should exercise caution when using this method on partial Fourier data, and inspect its output for any obvious artefacts.

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

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> unring = mrt.MRDeGibbs()
>>> unring.inputs.in_file = 'dwi.mif'
>>> unring.cmdline
'mrdegibbs -axes 0,1 -maxW 3 -minW 1 -nshifts 20 dwi.mif dwi_unr.mif'
>>> unring.run()                                 # doctest: +SKIP

Inputs:

[Mandatory]
in_file: (a pathlike object or string representing an existing file)
        input DWI image
        argument: ``%s``, position: -2

[Optional]
axes: (a list of items which are a value of class 'int', nipype
          default value: [0, 1])
        indicate the plane in which the data was acquired (axial = 0,1;
        coronal = 0,2; sagittal = 1,2
        argument: ``-axes %s``
nshifts: (an integer (int or long), nipype default value: 20)
        discretization of subpixel spacing (default = 20)
        argument: ``-nshifts %d``
minW: (an integer (int or long), nipype default value: 1)
        left border of window used for total variation (TV) computation
        (default = 1)
        argument: ``-minW %d``
maxW: (an integer (int or long), nipype default value: 3)
        right border of window used for total variation (TV) computation
        (default = 3)
        argument: ``-maxW %d``
out_file: (a pathlike object or string representing a file)
        the output unringed DWI image
        argument: ``%s``, position: -1
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
grad_file: (a pathlike object or string representing an existing
          file)
        dw gradient scheme (MRTrix format)
        argument: ``-grad %s``
        mutually_exclusive: 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)
        argument: ``-fslgrad %s %s``
        mutually_exclusive: grad_file
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).
        argument: ``-bvalue_scaling %s``
in_bvec: (a pathlike object or string representing an existing file)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (a pathlike object or string representing an existing file)
        bvals file in FSL format
args: (a unicode string)
        Additional parameters to the command
        argument: ``%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

Outputs:

out_file: (a pathlike object or string representing an existing file)
        the output unringed DWI image

ResponseSD

Link to code

Wraps the executable 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                               # doctest: +ELLIPSIS
'dwi2response tournier -fslgrad bvecs bvals dwi.mif wm.txt'
>>> resp.run()                                 # doctest: +SKIP

# 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)
        argument: ``%s``, position: 1
in_file: (a pathlike object or string representing an existing file)
        input DWI image
        argument: ``%s``, position: -5

[Optional]
mtt_file: (a pathlike object or string representing a file)
        input 5tt image
        argument: ``%s``, position: -4
wm_file: (a pathlike object or string representing a file, nipype
          default value: wm.txt)
        output WM response text file
        argument: ``%s``, position: -3
gm_file: (a pathlike object or string representing a file)
        output GM response text file
        argument: ``%s``, position: -2
csf_file: (a pathlike object or string representing a file)
        output CSF response text file
        argument: ``%s``, position: -1
in_mask: (a pathlike object or string representing an existing file)
        provide initial mask image
        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
        argument: ``-lmax %s``
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
grad_file: (a pathlike object or string representing an existing
          file)
        dw gradient scheme (MRTrix format)
        argument: ``-grad %s``
        mutually_exclusive: 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)
        argument: ``-fslgrad %s %s``
        mutually_exclusive: grad_file
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).
        argument: ``-bvalue_scaling %s``
in_bvec: (a pathlike object or string representing an existing file)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (a pathlike object or string representing an existing file)
        bvals file in FSL format
args: (a unicode string)
        Additional parameters to the command
        argument: ``%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

Outputs:

wm_file: (a pathlike object or string representing a file)
        output WM response text file
        argument: ``%s``
gm_file: (a pathlike object or string representing a file)
        output GM response text file
        argument: ``%s``
csf_file: (a pathlike object or string representing a file)
        output CSF response text file
        argument: ``%s``