qsiprep.interfaces.mrtrix module

MRtrix3 Interfaces

class qsiprep.interfaces.mrtrix.ComplexToMagnitude(command=None, terminal_output=None, write_cmdline=False, **inputs)[source]

Bases: CommandLine

Wrapped executable: mrcalc.

Extract the magnitude portion of a complex image using mrcalc.

Mandatory Inputs:

complex_file (a string or os.PathLike object referring to an existing file) – Maps to a command-line argument: %s (position: 0).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line 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’) – Environment variables. (Nipype default value: {})

  • out_file (a string or os.PathLike object) – Maps to a command-line argument: -abs %s (position: -1).

Outputs:

out_file (a pathlike object or string representing an existing file)

class qsiprep.interfaces.mrtrix.DWIBiasCorrect(**kwargs)[source]

Bases: SeriesPreprocReport, MRTrix3Base

Wrapped executable: 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> .. admonition:: Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> bias_correct = mrt.DWIBiasCorrect()
>>> bias_correct.inputs.in_file = 'dwi.mif'
>>> bias_correct.inputs.method = 'ants'
>>> bias_correct.cmdline
'dwibiascorrect ants dwi.mif dwi_biascorr.mif'
>>> bias_correct.run()                             
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Input DWI image. Maps to a command-line argument: %s (position: -2).

Optional Inputs:
  • ants_b (a string) – Maps to a command-line argument: -ants.b %s. (Nipype default value: [150,3])

  • ants_c (a string) – Maps to a command-line argument: -ants.c %s. (Nipype default value: [200x200,1e-6])

  • ants_s (a string) – Maps to a command-line argument: -ants.s %s.

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • bias_image (a pathlike object or string representing a file) – Bias field. Maps to a command-line argument: -bias %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.

  • bzero_max (an integer) – Maximum b-value that can be considered a b=0. Maps to a command-line argument: -config BZeroThreshold %d.

  • 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.

  • mask (a pathlike object or string representing a file) – Input mask image for bias field estimation. Maps to a command-line argument: -mask %s.

  • method (‘ants’ or ‘fsl’) – Maps to a command-line argument: %s (position: 1). (Nipype default value: ants)

  • nmse_text (a string or os.PathLike object)

  • nthreads (an integer) – Number of threads. if zero, the number of available cpus will be used. Maps to a command-line argument: -nthreads %d.

  • out_bval (a pathlike object or string representing a file) – Export bval file in FSL format.

  • out_bvec (a pathlike object or string representing a file) – Export bvec file in FSL format. Maps to a command-line argument: -export_grad_fsl %s %s.

  • out_file (a pathlike object or string representing a file) – The output bias corrected DWI image. Maps to a command-line argument: %s (position: -1).

  • out_report (a pathlike object or string representing a file) – Filename for the visual report. (Nipype default value: n4_report.svg)

Outputs:
  • bias_image (a pathlike object or string representing an existing file) – The output bias field.

  • nmse_text (a string or os.PathLike object) – Nmse between input and output volumes.

  • out_file (a pathlike object or string representing an existing file) – The output bias corrected DWI image.

  • out_report (a pathlike object or string representing a file) – Filename for the visual report.

class qsiprep.interfaces.mrtrix.DWIDenoise(**kwargs)[source]

Bases: SeriesPreprocReport, MRTrix3Base

Wrapped executable: 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>

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Input DWI image. Maps to a command-line argument: %s (position: -2).

Optional Inputs:
  • args (a 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: {})

  • extent (a tuple of the form: (an integer, an integer, an integer)) – Set the window size of the denoising filter. (default = 5,5,5). Maps to a command-line argument: -extent %d,%d,%d.

  • 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.

  • mask (a pathlike object or string representing an existing file) – Mask image. Maps to a command-line argument: -mask %s (position: 1).

  • nmse_text (a string or os.PathLike object)

  • noise_image (a pathlike object or string representing a file) – The output noise map. Maps to a command-line argument: -noise %s.

  • nthreads (an integer) – Number of threads. if zero, the number of available cpus will be used. Maps to a command-line argument: -nthreads %d.

  • out_bval (a pathlike object or string representing a file) – Export bval file in FSL format.

  • out_bvec (a pathlike object or string representing a file) – Export bvec file in FSL format. Maps to a command-line argument: -export_grad_fsl %s %s.

  • out_file (a pathlike object or string representing a file) – The output denoised DWI image. Maps to a command-line argument: %s (position: -1).

  • out_report (a pathlike object or string representing a file) – Filename for the visual report. (Nipype default value: dwidenoise_report.svg)

Outputs:
  • nmse_text (a string or os.PathLike object) – Nmse between input and output volumes.

  • noise_image (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.

  • out_report (a pathlike object or string representing a file) – Filename for the visual report.

class qsiprep.interfaces.mrtrix.ITKTransformConvert(command=None, terminal_output=None, write_cmdline=False, **inputs)[source]

Bases: CommandLine

Wrapped executable: transformconvert.

Mandatory Inputs:

in_transform (a string or os.PathLike object referring to an existing file) – Maps to a command-line argument: %s (position: 0).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line 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’) – Environment variables. (Nipype default value: {})

  • operation (‘itk_import’) – Maps to a command-line argument: %s. (Nipype default value: itk_import)

  • out_transform (a string or os.PathLike object) – Maps to a command-line argument: %s (position: -1).

Outputs:

out_transform (a string or os.PathLike object referring to an existing file)

class qsiprep.interfaces.mrtrix.MRDeGibbs(**kwargs)[source]

Bases: SeriesPreprocReport, MRTrix3Base

Wrapped executable: mrdegibbs.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Input DWI image. Maps to a command-line argument: %s (position: -2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • axes (‘0,1’ or ‘0,2’ or ‘1,2’) – Select the slice axes (default: 0,1 - i.e. x-y). Maps to a command-line argument: -axes %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.

  • mask (a pathlike object or string representing a file) – Input mask image for the visual report.

  • maxw (an integer) – Right border of window used for TV computation. Maps to a command-line argument: -maxW %d.

  • minw (an integer) – Left border of window used for TV computation. Maps to a command-line argument: -minW %d.

  • nmse_text (a string or os.PathLike object)

  • nshifts (an integer) – Discretization of subpixel spacing. Maps to a command-line argument: -nshifts %d.

  • nthreads (an integer) – Number of threads. if zero, the number of available cpus will be used. Maps to a command-line argument: -nthreads %d.

  • out_bval (a pathlike object or string representing a file) – Export bval file in FSL format.

  • out_bvec (a pathlike object or string representing a file) – Export bvec file in FSL format. Maps to a command-line argument: -export_grad_fsl %s %s.

  • out_file (a pathlike object or string representing a file) – The output de-Gibbs’d DWI image. Maps to a command-line argument: %s (position: -1).

  • out_report (a pathlike object or string representing a file) – Filename for the visual report. (Nipype default value: degibbs_report.svg)

Outputs:
  • nmse_text (a string or os.PathLike object) – Nmse between input and output volumes.

  • out_file (a pathlike object or string representing a file) – The output de-Gibbs’d DWI image.

  • out_report (a pathlike object or string representing a file) – Filename for the visual report.

class qsiprep.interfaces.mrtrix.MRTrixGradientTable(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:
  • bval_file (a pathlike object or string representing an existing file)

  • bvec_file (a pathlike object or string representing an existing file)

Outputs:

gradient_file (a pathlike object or string representing an existing file)

class qsiprep.interfaces.mrtrix.MRTrixIngress(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

dwi_file (a pathlike object or string representing an existing file)

Optional Inputs:
  • b_file (a pathlike object or string representing an existing file)

  • bval_file (a pathlike object or string representing an existing file)

  • bvec_file (a pathlike object or string representing an existing file)

  • suffix (a string) – (Nipype default value: "")

Outputs:

mif_file (a pathlike object or string representing a file)

class qsiprep.interfaces.mrtrix.PolarToComplex(command=None, terminal_output=None, write_cmdline=False, **inputs)[source]

Bases: CommandLine

Wrapped executable: mrcalc.

Convert a magnitude and phase image pair to a single complex image using mrcalc.

Mandatory Inputs:
  • mag_file (a string or os.PathLike object referring to an existing file) – Maps to a command-line argument: %s (position: 0).

  • phase_file (a string or os.PathLike object referring to an existing file) – Maps to a command-line argument: %s (position: 1).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line 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’) – Environment variables. (Nipype default value: {})

  • out_file (a string or os.PathLike object) – Maps to a command-line argument: -polar %s (position: -1).

Outputs:

out_file (a pathlike object or string representing an existing file)

class qsiprep.interfaces.mrtrix.TransformHeader(command=None, terminal_output=None, write_cmdline=False, **inputs)[source]

Bases: CommandLine

Wrapped executable: mrtransform -strides -1,-2,3.

Mandatory Inputs:
  • in_image (a string or os.PathLike object referring to an existing file) – Maps to a command-line argument: %s (position: 1).

  • transform_file (a string or os.PathLike object referring to an existing file) – Maps to a command-line argument: -linear %s (position: 0).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line 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’) – Environment variables. (Nipype default value: {})

  • out_image (a string or os.PathLike object) – Maps to a command-line argument: %s (position: -1).

Outputs:

out_image (a pathlike object or string representing an existing file)