nipype.interfaces.mrtrix3.preprocess module¶
ACTPrepareFSL¶
Bases: CommandLine
Wrapped executable:
act_anat_prepare_fsl
.Generate anatomical information necessary for Anatomically Constrained Tractography (ACT).
Example
>>> import nipype.interfaces.mrtrix3 as mrt >>> prep = mrt.ACTPrepareFSL() >>> prep.inputs.in_file = 'T1.nii.gz' >>> prep.cmdline 'act_anat_prepare_fsl T1.nii.gz act_5tt.mif' >>> prep.run()
- in_filea pathlike object or string representing an existing file
Input anatomical image. Maps to a command-line argument:
%s
(position: -2).- out_filea pathlike object or string representing a file
Output file after processing. Maps to a command-line argument:
%s
(position: -1). (Nipype default value:act_5tt.mif
)
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- environa 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_filea pathlike object or string representing an existing file
The output response file.
DWIBiasCorrect¶
Bases: 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>
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()
- in_filea pathlike object or string representing an existing file
Input DWI image. Maps to a command-line argument:
%s
(position: -2).- use_antsa boolean
Use ANTS N4 to estimate the inhomogeneity field. Maps to a command-line argument:
ants
(position: 0). Mutually exclusive with inputs:use_fsl
.- use_fsla boolean
Use FSL FAST to estimate the inhomogeneity field. Maps to a command-line argument:
fsl
(position: 0). Mutually exclusive with inputs:use_ants
.
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- biasa 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
.- environa 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_filea 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_fsla 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_bvala pathlike object or string representing an existing file
Bvals file in FSL format.
- in_bveca pathlike object or string representing an existing file
Bvecs file in FSL format. Maps to a command-line argument:
-fslgrad %s %s
.- in_maska pathlike object or string representing a file
Input mask image for bias field estimation. Maps to a command-line argument:
-mask %s
.- nthreadsan 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
.- out_filea pathlike object or string representing a file
The output bias corrected DWI image. Maps to a command-line argument:
%s
(position: -1).
- biasa pathlike object or string representing an existing file
The output bias field.
- out_filea pathlike object or string representing an existing file
The output bias corrected DWI image.
DWIDenoise¶
Bases: 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>
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 'dwidenoise -mask mask.mif -noise noise.mif dwi.mif dwi_denoised.mif' >>> denoise.run()
- in_filea pathlike object or string representing an existing file
Input DWI image. Maps to a command-line argument:
%s
(position: -2).
- argsa 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
.- environa 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:
{}
)- extenta 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). Maps to a command-line argument:
-extent %d,%d,%d
.- grad_filea 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_fsla 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_bvala pathlike object or string representing an existing file
Bvals file in FSL format.
- in_bveca pathlike object or string representing an existing file
Bvecs file in FSL format. Maps to a command-line argument:
-fslgrad %s %s
.- maska pathlike object or string representing an existing file
Mask image. Maps to a command-line argument:
-mask %s
(position: 1).- noisea pathlike object or string representing a file
The output noise map. Maps to a command-line argument:
-noise %s
.- nthreadsan 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
.- out_filea pathlike object or string representing a file
The output denoised DWI image. Maps to a command-line argument:
%s
(position: -1).
- noisea pathlike object or string representing an existing file
The output noise map.
- out_filea pathlike object or string representing an existing file
The output denoised DWI image.
MRDeGibbs¶
Bases: MRTrix3Base
Wrapped executable:
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()
- in_filea pathlike object or string representing an existing file
Input DWI image. Maps to a command-line argument:
%s
(position: -2).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- axesa list of items which are a value of class ‘int’
Indicate the plane in which the data was acquired (axial = 0,1; coronal = 0,2; sagittal = 1,2. Maps to a command-line argument:
-axes %s
. (Nipype default value:[0, 1]
)- 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
.- environa 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_filea 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_fsla 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_bvala pathlike object or string representing an existing file
Bvals file in FSL format.
- in_bveca pathlike object or string representing an existing file
Bvecs file in FSL format. Maps to a command-line argument:
-fslgrad %s %s
.- maxWan integer (int or long)
Right border of window used for total variation (TV) computation (default = 3). Maps to a command-line argument:
-maxW %d
. (Nipype default value:3
)- minWan integer (int or long)
Left border of window used for total variation (TV) computation (default = 1). Maps to a command-line argument:
-minW %d
. (Nipype default value:1
)- nshiftsan integer (int or long)
Discretization of subpixel spacing (default = 20). Maps to a command-line argument:
-nshifts %d
. (Nipype default value:20
)- nthreadsan 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
.- out_filea pathlike object or string representing a file
The output unringed DWI image. Maps to a command-line argument:
%s
(position: -1).
- out_filea pathlike object or string representing an existing file
The output unringed DWI image.
ReplaceFSwithFIRST¶
Bases: CommandLine
Wrapped executable:
fs_parc_replace_sgm_first
.Replace deep gray matter structures segmented with FSL FIRST in a FreeSurfer parcellation.
Example
>>> import nipype.interfaces.mrtrix3 as mrt >>> prep = mrt.ReplaceFSwithFIRST() >>> prep.inputs.in_file = 'aparc+aseg.nii' >>> prep.inputs.in_t1w = 'T1.nii.gz' >>> prep.inputs.in_config = 'mrtrix3_labelconfig.txt' >>> prep.cmdline 'fs_parc_replace_sgm_first aparc+aseg.nii T1.nii.gz mrtrix3_labelconfig.txt aparc+first.mif' >>> prep.run()
- in_filea pathlike object or string representing an existing file
Input anatomical image. Maps to a command-line argument:
%s
(position: -4).- in_t1wa pathlike object or string representing an existing file
Input T1 image. Maps to a command-line argument:
%s
(position: -3).- out_filea pathlike object or string representing a file
Output file after processing. Maps to a command-line argument:
%s
(position: -1). (Nipype default value:aparc+first.mif
)
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- environa 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:
{}
)- in_configa pathlike object or string representing an existing file
Connectome configuration file. Maps to a command-line argument:
%s
(position: -2).
- out_filea pathlike object or string representing an existing file
The output response file.
ResponseSD¶
Bases: MRTrix3Base
Wrapped executable:
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 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’
- algorithm‘msmt_5tt’ or ‘dhollander’ or ‘tournier’ or ‘tax’
Response estimation algorithm (multi-tissue). Maps to a command-line argument:
%s
(position: 1).- in_filea pathlike object or string representing an existing file
Input DWI image. Maps to a command-line argument:
%s
(position: -5).
- argsa 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_filea pathlike object or string representing a file
Output CSF response text file. Maps to a command-line argument:
%s
(position: -1).- environa 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_filea pathlike object or string representing a file
Output GM response text file. Maps to a command-line argument:
%s
(position: -2).- grad_filea 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_fsla 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_bvala pathlike object or string representing an existing file
Bvals file in FSL format.
- in_bveca pathlike object or string representing an existing file
Bvecs file in FSL format. Maps to a command-line argument:
-fslgrad %s %s
.- in_maska pathlike object or string representing an existing file
Provide initial mask image. Maps to a command-line argument:
-mask %s
.- max_sha 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
.- mtt_filea pathlike object or string representing a file
Input 5tt image. Maps to a command-line argument:
%s
(position: -4).- nthreadsan 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
.- wm_filea pathlike object or string representing a file
Output WM response text file. Maps to a command-line argument:
%s
(position: -3). (Nipype default value:wm.txt
)
- csf_filea pathlike object or string representing a file
Output CSF response text file. Maps to a command-line argument:
%s
.- gm_filea pathlike object or string representing a file
Output GM response text file. Maps to a command-line argument:
%s
.- wm_filea pathlike object or string representing a file
Output WM response text file. Maps to a command-line argument:
%s
.