nipype.interfaces.mrtrix3.utils module

BrainMask

Link to code

Bases: CommandLine

Wrapped executable: dwi2mask.

Convert a mesh surface to a partial volume estimation image

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> bmsk = mrt.BrainMask()
>>> bmsk.inputs.in_file = 'dwi.mif'
>>> bmsk.cmdline                               
'dwi2mask dwi.mif brainmask.mif'
>>> bmsk.run()                                 
in_filea pathlike object or string representing an existing file

Input diffusion weighted images. Maps to a command-line argument: %s (position: -2).

out_filea pathlike object or string representing a file

Output brain mask. Maps to a command-line argument: %s (position: -1). (Nipype default value: brainmask.mif)

argsa 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: {})

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.

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca 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_filea pathlike object or string representing an existing file

The output response file.

ComputeTDI

Link to code

Bases: MRTrix3Base

Wrapped executable: tckmap.

Use track data as a form of contrast for producing a high-resolution image.

References

  • For TDI or DEC TDI: Calamante, F.; Tournier, J.-D.; Jackson, G. D. & Connelly, A. Track-density imaging (TDI): Super-resolution white matter imaging using whole-brain track-density mapping. NeuroImage, 2010, 53, 1233-1243

  • If using -contrast length and -stat_vox mean: Pannek, K.; Mathias, J. L.; Bigler, E. D.; Brown, G.; Taylor, J. D. & Rose, S. E. The average pathlength map: A diffusion MRI tractography-derived index for studying brain pathology. NeuroImage, 2011, 55, 133-141

  • If using -dixel option with TDI contrast only: Smith, R.E., Tournier, J-D., Calamante, F., Connelly, A. A novel paradigm for automated segmentation of very large whole-brain probabilistic tractography data sets. In proc. ISMRM, 2011, 19, 673

  • If using -dixel option with any other contrast: Pannek, K., Raffelt, D., Salvado, O., Rose, S. Incorporating directional information in diffusion tractography derived maps: angular track imaging (ATI). In Proc. ISMRM, 2012, 20, 1912

  • If using -tod option: Dhollander, T., Emsell, L., Van Hecke, W., Maes, F., Sunaert, S., Suetens, P. Track Orientation Density Imaging (TODI) and Track Orientation Distribution (TOD) based tractography. NeuroImage, 2014, 94, 312-336

  • If using other contrasts / statistics: Calamante, F.; Tournier, J.-D.; Smith, R. E. & Connelly, A. A generalised framework for super-resolution track-weighted imaging. NeuroImage, 2012, 59, 2494-2503

  • If using -precise mapping option: Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT: Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013, 67, 298-312 (Appendix 3)

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> tdi = mrt.ComputeTDI()
>>> tdi.inputs.in_file = 'dti.mif'
>>> tdi.cmdline                               
'tckmap dti.mif tdi.mif'
>>> tdi.run()                                 
in_filea pathlike object or string representing an existing file

Input tractography. Maps to a command-line argument: %s (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

contrast‘tdi’ or ‘length’ or ‘invlength’ or ‘scalar_map’ or ‘scalar_map_conut’ or ‘fod_amp’ or ‘curvature’

Define the desired form of contrast for the output image. Maps to a command-line argument: -constrast %s.

data_type‘float’ or ‘unsigned int’

Specify output image data type. Maps to a command-line argument: -datatype %s.

dixela pathlike object or string representing a file

Map streamlines todixels within each voxel. Directions are stored asazimuth elevation pairs. Maps to a command-line argument: -dixel %s.

ends_onlya boolean

Only map the streamline endpoints to the image. Maps to a command-line argument: -ends_only.

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: {})

fwhm_tcka float

Define the statistic for choosing the contribution to be made by each streamline as a function of the samples taken along their lengths. Maps to a command-line argument: -fwhm_tck %f.

in_mapa pathlike object or string representing an existing file

Provide thescalar image map for generating images with ‘scalar_map’ contrasts, or the SHs image for fod_amp. Maps to a command-line argument: -image %s.

map_zeroa boolean

If a streamline has zero contribution based on the contrast & statistic, typically it is not mapped; use this option to still contribute to the map even if this is the case (these non-contributing voxels can then influence the mean value in each voxel of the map). Maps to a command-line argument: -map_zero.

max_todan integer

Generate a Track Orientation Distribution (TOD) in each voxel. Maps to a command-line argument: -tod %d.

nthreadsan integer

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

Output TDI file. Maps to a command-line argument: %s (position: -1). (Nipype default value: tdi.mif)

precisea boolean

Use a more precise streamline mapping strategy, that accurately quantifies the length through each voxel (these lengths are then taken into account during TWI calculation). Maps to a command-line argument: -precise.

referencea pathlike object or string representing an existing file

A referenceimage to be used as template. Maps to a command-line argument: -template %s.

stat_tck‘mean’ or ‘sum’ or ‘min’ or ‘max’ or ‘median’ or ‘mean_nonzero’ or ‘gaussian’ or ‘ends_min’ or ‘ends_mean’ or ‘ends_max’ or ‘ends_prod’

Define the statistic for choosing the contribution to be made by each streamline as a function of the samples taken along their lengths. Maps to a command-line argument: -stat_tck %s.

stat_vox‘sum’ or ‘min’ or ‘mean’ or ‘max’

Define the statistic for choosing the finalvoxel intesities for a given contrast. Maps to a command-line argument: -stat_vox %s.

tck_weightsa pathlike object or string representing an existing file

Specify a text scalar file containing the streamline weights. Maps to a command-line argument: -tck_weights_in %s.

upsamplean integer

Upsample the tracks by some ratio using Hermite interpolation before mappping. Maps to a command-line argument: -upsample %d.

use_deca boolean

Perform mapping in DEC space. Maps to a command-line argument: -dec.

vox_sizea list of items which are an integer

Voxel dimensions. Maps to a command-line argument: -vox %s.

out_filea pathlike object or string representing a file

Output TDI file.

DWIExtract

Link to code

Bases: MRTrix3Base

Wrapped executable: dwiextract.

Extract diffusion-weighted volumes, b=0 volumes, or certain shells from a DWI dataset

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> dwiextract = mrt.DWIExtract()
>>> dwiextract.inputs.in_file = 'dwi.mif'
>>> dwiextract.inputs.bzero = True
>>> dwiextract.inputs.out_file = 'b0vols.mif'
>>> dwiextract.inputs.grad_fsl = ('bvecs', 'bvals')
>>> dwiextract.cmdline                             
'dwiextract -bzero -fslgrad bvecs bvals dwi.mif b0vols.mif'
>>> dwiextract.run()                               
in_filea pathlike object or string representing an existing file

Input image. Maps to a command-line argument: %s (position: -2).

out_filea pathlike object or string representing a file

Output image. Maps to a command-line argument: %s (position: -1).

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

bzeroa boolean

Extract b=0 volumes. Maps to a command-line argument: -bzero.

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.

nobzeroa boolean

Extract non b=0 volumes. Maps to a command-line argument: -no_bzero.

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca pathlike object or string representing a file

Export bvec file in FSL format. Maps to a command-line argument: -export_grad_fsl %s %s.

shella list of items which are a float

Specify one or more gradient shells. Maps to a command-line argument: -shell %s.

singleshella boolean

Extract volumes with a specific shell. Maps to a command-line argument: -singleshell.

out_filea pathlike object or string representing an existing file

Output image.

Generate5tt

Link to code

Bases: MRTrix3Base

Wrapped executable: 5ttgen.

Generate a 5TT image suitable for ACT using the selected algorithm

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> gen5tt = mrt.Generate5tt()
>>> gen5tt.inputs.in_file = 'T1.nii.gz'
>>> gen5tt.inputs.algorithm = 'fsl'
>>> gen5tt.inputs.out_file = '5tt.mif'
>>> gen5tt.cmdline                             
'5ttgen fsl T1.nii.gz 5tt.mif'
>>> gen5tt.run()                               
algorithm‘fsl’ or ‘gif’ or ‘freesurfer’

Tissue segmentation algorithm. Maps to a command-line argument: %s (position: -3).

in_filea pathlike object or string representing an existing file

Input image. Maps to a command-line argument: %s (position: -2).

out_filea pathlike object or string representing a file

Output image. Maps to a command-line argument: %s (position: -1).

argsa 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: {})

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.

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca 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_filea pathlike object or string representing an existing file

Output image.

MRCat

Link to code

Bases: CommandLine

Wrapped executable: mrcat.

Concatenate several images into one

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> mrcat = mrt.MRCat()
>>> mrcat.inputs.in_files = ['dwi.mif','mask.mif']
>>> mrcat.cmdline                               
'mrcat dwi.mif mask.mif concatenated.mif'
>>> mrcat.run()                                 
in_filesa list of items which are a pathlike object or string representing an existing file

Files to concatenate. Maps to a command-line argument: %s (position: -2).

out_filea pathlike object or string representing a file

Output concatenated image. Maps to a command-line argument: %s (position: -1). (Nipype default value: concatenated.mif)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

axisan integer
Specify axis along which concatenation should be performed. By default,

the program will use the last non-singleton, non-spatial axis of any of the input images - in other words axis 3 or whichever axis (greater than 3) of the input images has size greater than one.

Maps to a command-line argument: -axis %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.

datatype‘float32’ or ‘float32le’ or ‘float32be’ or ‘float64’ or ‘float64le’ or ‘float64be’ or ‘int64’ or ‘uint64’ or ‘int64le’ or ‘uint64le’ or ‘int64be’ or ‘uint64be’ or ‘int32’ or ‘uint32’ or ‘int32le’ or ‘uint32le’ or ‘int32be’ or ‘uint32be’ or ‘int16’ or ‘uint16’ or ‘int16le’ or ‘uint16le’ or ‘int16be’ or ‘uint16be’ or ‘cfloat32’ or ‘cfloat32le’ or ‘cfloat32be’ or ‘cfloat64’ or ‘cfloat64le’ or ‘cfloat64be’ or ‘int8’ or ‘uint8’ or ‘bit’

Specify output image data type. Maps to a command-line argument: -datatype %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.

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca 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_filea pathlike object or string representing an existing file

The output concatenated image.

MRConvert

Link to code

Bases: MRTrix3Base

Wrapped executable: mrconvert.

Perform conversion between different file types and optionally extract a subset of the input image

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> mrconvert = mrt.MRConvert()
>>> mrconvert.inputs.in_file = 'dwi.nii.gz'
>>> mrconvert.inputs.grad_fsl = ('bvecs', 'bvals')
>>> mrconvert.cmdline                             
'mrconvert -fslgrad bvecs bvals dwi.nii.gz dwi.mif'
>>> mrconvert.run()                               
in_filea pathlike object or string representing an existing file

Input image. Maps to a command-line argument: %s (position: -2).

out_filea pathlike object or string representing a file

Output image. Maps to a command-line argument: %s (position: -1). (Nipype default value: dwi.mif)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

axesa list of items which are an integer

Specify the axes that will be used. 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.

coorda list of items which are an integer

Extract data at the specified coordinates. Maps to a command-line argument: -coord %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.

json_exporta pathlike object or string representing a file

Export data from an image header key-value pairs into a JSON file. Maps to a command-line argument: -json_export %s.

json_importa pathlike object or string representing an existing file

Import data from a JSON file into header key-value pairs. Maps to a command-line argument: -json_import %s.

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca pathlike object or string representing a file

Export bvec file in FSL format. Maps to a command-line argument: -export_grad_fsl %s %s.

scalinga list of items which are a float

Specify the data scaling parameter. Maps to a command-line argument: -scaling %s.

voxa list of items which are a float

Change the voxel dimensions. Maps to a command-line argument: -vox %s.

json_exporta pathlike object or string representing an existing file

Exported data from an image header key-value pairs in a JSON file.

out_bvala pathlike object or string representing an existing file

Export bvec file in FSL format.

out_bveca pathlike object or string representing an existing file

Export bvec file in FSL format.

out_filea pathlike object or string representing an existing file

Output image.

MRMath

Link to code

Bases: MRTrix3Base

Wrapped executable: mrmath.

Compute summary statistic on image intensities along a specified axis of a single image

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> mrmath = mrt.MRMath()
>>> mrmath.inputs.in_file = 'dwi.mif'
>>> mrmath.inputs.operation = 'mean'
>>> mrmath.inputs.axis = 3
>>> mrmath.inputs.out_file = 'dwi_mean.mif'
>>> mrmath.inputs.grad_fsl = ('bvecs', 'bvals')
>>> mrmath.cmdline                             
'mrmath -axis 3 -fslgrad bvecs bvals dwi.mif mean dwi_mean.mif'
>>> mrmath.run()                               
in_filea pathlike object or string representing an existing file

Input image. Maps to a command-line argument: %s (position: -3).

operation‘mean’ or ‘median’ or ‘sum’ or ‘product’ or ‘rms’ or ‘norm’ or ‘var’ or ‘std’ or ‘min’ or ‘max’ or ‘absmax’ or ‘magmax’

Operation to computer along a specified axis. Maps to a command-line argument: %s (position: -2).

out_filea pathlike object or string representing a file

Output image. Maps to a command-line argument: %s (position: -1).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

axisan integer

Specfied axis to perform the operation along. Maps to a command-line argument: -axis %d.

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.

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca 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_filea pathlike object or string representing an existing file

Output image.

MRResize

Link to code

Bases: MRTrix3Base

Wrapped executable: mrresize.

Resize an image by defining the new image resolution, voxel size or a scale factor. If the image is 4D, then only the first 3 dimensions can be resized. Also, if the image is down-sampled, the appropriate smoothing is automatically applied using Gaussian smoothing. For more information, see <https://mrtrix.readthedocs.io/en/latest/reference/commands/mrresize.html>

Example

>>> import nipype.interfaces.mrtrix3 as mrt

Defining the new image resolution: >>> image_resize = mrt.MRResize() >>> image_resize.inputs.in_file = ‘dwi.mif’ >>> image_resize.inputs.image_size = (256, 256, 144) >>> image_resize.cmdline # doctest: +ELLIPSIS ‘mrresize -size 256,256,144 -interp cubic dwi.mif dwi_resized.mif’ >>> image_resize.run() # doctest: +SKIP

Defining the new image’s voxel size: >>> voxel_resize = mrt.MRResize() >>> voxel_resize.inputs.in_file = ‘dwi.mif’ >>> voxel_resize.inputs.voxel_size = (1, 1, 1) >>> voxel_resize.cmdline # doctest: +ELLIPSIS ‘mrresize -interp cubic -voxel 1,1,1 dwi.mif dwi_resized.mif’ >>> voxel_resize.run() # doctest: +SKIP

Defining the scale factor of each image dimension: >>> scale_resize = mrt.MRResize() >>> scale_resize.inputs.in_file = ‘dwi.mif’ >>> scale_resize.inputs.scale_factor = (0.5,0.5,0.5) >>> scale_resize.cmdline # doctest: +ELLIPSIS ‘mrresize -interp cubic -scale 0.5,0.5,0.5 dwi.mif dwi_resized.mif’ >>> scale_resize.run() # doctest: +SKIP

image_sizea tuple of the form: (an integer, an integer, an integer)

Number of voxels in each dimension of output image. Maps to a command-line argument: -size %d,%d,%d. Mutually exclusive with inputs: voxel_size, scale_factor.

in_filea pathlike object or string representing an existing file

Input DWI image. Maps to a command-line argument: %s (position: -2).

scale_factora tuple of the form: (a float, a float, a float)

Scale factors to rescale the image by in each dimension. Maps to a command-line argument: -scale %g,%g,%g. Mutually exclusive with inputs: image_size, voxel_size.

voxel_sizea tuple of the form: (a float, a float, a float)

Desired voxel size in mm for the output image. Maps to a command-line argument: -voxel %g,%g,%g. Mutually exclusive with inputs: image_size, scale_factor.

argsa 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: {})

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.

interpolation‘cubic’ or ‘nearest’ or ‘linear’ or ‘sinc’

Set the interpolation method to use when resizing (choices: nearest, linear, cubic, sinc. Default: cubic). Maps to a command-line argument: -interp %s. (Nipype default value: cubic)

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca 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_filea pathlike object or string representing a file

The output resized DWI image. Maps to a command-line argument: %s (position: -1).

out_filea pathlike object or string representing an existing file

The output resized DWI image.

MRTransform

Link to code

Bases: MRTrix3Base

Wrapped executable: mrtransform.

Apply spatial transformations or reslice images

Example

>>> MRxform = MRTransform()
>>> MRxform.inputs.in_files = 'anat_coreg.mif'
>>> MRxform.run()                                   
in_filesa list of items which are a pathlike object or string representing an existing file

Input images to be transformed. Maps to a command-line argument: %s (position: -2).

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

debuga boolean

Display debugging messages. Maps to a command-line argument: -debug (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: {})

flip_xa boolean

Assume the transform is supplied assuming a coordinate system with the x-axis reversed relative to the MRtrix convention (i.e. x increases from right to left). This is required to handle transform matrices produced by FSL’s FLIRT command. This is only used in conjunction with the -reference option. Maps to a command-line argument: -flipx (position: 1).

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.

inverta boolean

Invert the specified transform before using it. Maps to a command-line argument: -inverse (position: 1).

linear_transforma pathlike object or string representing an existing file

Specify a linear transform to apply, in the form of a 3x4 or 4x4 ascii file. Note the standard reverse convention is used, where the transform maps points in the template image to the moving image. Note that the reverse convention is still assumed even if no -template image is supplied. Maps to a command-line argument: -linear %s (position: 1).

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca 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_filea pathlike object or string representing a file

Output image. Maps to a command-line argument: %s (position: -1).

quieta boolean

Do not display information messages or progress status. Maps to a command-line argument: -quiet (position: 1).

reference_imagea pathlike object or string representing an existing file

In case the transform supplied maps from the input image onto a reference image, use this option to specify the reference. Note that this implicitly sets the -replace option. Maps to a command-line argument: -reference %s (position: 1).

replace_transforma boolean

Replace the current transform by that specified, rather than applying it to the current transform. Maps to a command-line argument: -replace (position: 1).

template_imagea pathlike object or string representing an existing file

Reslice the input image to match the specified template image. Maps to a command-line argument: -template %s (position: 1).

transformation_filea pathlike object or string representing an existing file

The transform to apply, in the form of a 4x4 ascii file. Maps to a command-line argument: -transform %s (position: 1).

out_filea pathlike object or string representing an existing file

The output image of the transformation.

Mesh2PVE

Link to code

Bases: CommandLine

Wrapped executable: mesh2pve.

Convert a mesh surface to a partial volume estimation image

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> m2p = mrt.Mesh2PVE()
>>> m2p.inputs.in_file = 'surf1.vtk'
>>> m2p.inputs.reference = 'dwi.mif'
>>> m2p.inputs.in_first = 'T1.nii.gz'
>>> m2p.cmdline                               
'mesh2pve -first T1.nii.gz surf1.vtk dwi.mif mesh2volume.nii.gz'
>>> m2p.run()                                 
in_filea pathlike object or string representing an existing file

Input mesh. Maps to a command-line argument: %s (position: -3).

out_filea pathlike object or string representing a file

Output file containing SH coefficients. Maps to a command-line argument: %s (position: -1). (Nipype default value: mesh2volume.nii.gz)

referencea pathlike object or string representing an existing file

Input reference image. Maps to a command-line argument: %s (position: -2).

argsa 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_firsta pathlike object or string representing an existing file

Indicates that the mesh file is provided by FSL FIRST. Maps to a command-line argument: -first %s.

out_filea pathlike object or string representing an existing file

The output response file.

SH2Amp

Link to code

Bases: CommandLine

Wrapped executable: sh2amp.

Sample spherical harmonics on a set of gradient orientations. Useful for checking residuals of ODF estimates.

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> sh = mrt.SH2Amp()
>>> sh.inputs.in_file = 'sh.mif'
>>> sh.inputs.directions = 'grads.txt'
>>> sh.cmdline
'sh2amp sh.mif grads.txt sh_amp.mif'
>>> sh.run()                                 
directionsa pathlike object or string representing an existing file

The gradient directions along which to sample the spherical harmonics MRtrix format. Maps to a command-line argument: %s (position: -2).

in_filea pathlike object or string representing an existing file

Input ODF image. Maps to a command-line argument: %s (position: -3).

argsa 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: {})

nonnegativea boolean

Cap all negative amplitudes to zero. Maps to a command-line argument: -nonnegative.

out_filea pathlike object or string representing a file

The output spherical harmonics. Maps to a command-line argument: %s (position: -1). (Nipype default value: <undefined>)

out_filea pathlike object or string representing an existing file

The output convoluted spherical harmonics file.

SHConv

Link to code

Bases: CommandLine

Wrapped executable: shconv.

Convolve spherical harmonics with a tissue response function. Useful for checking residuals of ODF estimates.

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> sh = mrt.SHConv()
>>> sh.inputs.in_file = 'csd.mif'
>>> sh.inputs.response = 'response.txt'
>>> sh.cmdline
'shconv csd.mif response.txt csd_shconv.mif'
>>> sh.run()                                 
in_filea pathlike object or string representing an existing file

Input ODF image. Maps to a command-line argument: %s (position: -3).

responsea pathlike object or string representing an existing file

The response function. Maps to a command-line argument: %s (position: -2).

argsa 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 a file

The output spherical harmonics. Maps to a command-line argument: %s (position: -1). (Nipype default value: <undefined>)

out_filea pathlike object or string representing an existing file

The output convoluted spherical harmonics file.

TCK2VTK

Link to code

Bases: MRTrix3Base

Wrapped executable: tck2vtk.

Convert a track file to a vtk format, cave: coordinates are in XYZ coordinates not reference

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> vtk = mrt.TCK2VTK()
>>> vtk.inputs.in_file = 'tracks.tck'
>>> vtk.inputs.reference = 'b0.nii'
>>> vtk.cmdline                               
'tck2vtk -image b0.nii tracks.tck tracks.vtk'
>>> vtk.run()                                 
in_filea pathlike object or string representing an existing file

Input tractography. Maps to a command-line argument: %s (position: -2).

argsa 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: {})

nthreadsan integer

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

Output VTK file. Maps to a command-line argument: %s (position: -1). (Nipype default value: tracks.vtk)

referencea pathlike object or string representing an existing file

If specified, the properties of this image will be used to convert track point positions from real (scanner) coordinates into image coordinates (in mm). Maps to a command-line argument: -image %s.

voxela pathlike object or string representing an existing file

If specified, the properties of this image will be used to convert track point positions from real (scanner) coordinates into image coordinates. Maps to a command-line argument: -image %s.

out_filea pathlike object or string representing a file

Output VTK file.

TensorMetrics

Link to code

Bases: CommandLine

Wrapped executable: tensor2metric.

Compute metrics from tensors

Example

>>> import nipype.interfaces.mrtrix3 as mrt
>>> comp = mrt.TensorMetrics()
>>> comp.inputs.in_file = 'dti.mif'
>>> comp.inputs.out_fa = 'fa.mif'
>>> comp.cmdline                               
'tensor2metric -num 1 -fa fa.mif dti.mif'
>>> comp.run()                                 
in_filea pathlike object or string representing an existing file

Input DTI image. Maps to a command-line argument: %s (position: -1).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

componenta list of items which are any value

Specify the desired eigenvalue/eigenvector(s). Note that several eigenvalues can be specified as a number sequence. Maps to a command-line argument: -num %s. (Nipype default value: [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: {})

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

modulate‘FA’ or ‘none’ or ‘eval’

How to modulate the magnitude of the eigenvectors. Maps to a command-line argument: -modulate %s.

out_ada pathlike object or string representing a file

Output AD file. Maps to a command-line argument: -ad %s.

out_adca pathlike object or string representing a file

Output ADC file. Maps to a command-line argument: -adc %s.

out_cla pathlike object or string representing a file

Output CL file. Maps to a command-line argument: -cl %s.

out_cpa pathlike object or string representing a file

Output CP file. Maps to a command-line argument: -cp %s.

out_csa pathlike object or string representing a file

Output CS file. Maps to a command-line argument: -cs %s.

out_evala pathlike object or string representing a file

Output selected eigenvalue(s) file. Maps to a command-line argument: -value %s.

out_eveca pathlike object or string representing a file

Output selected eigenvector(s) file. Maps to a command-line argument: -vector %s.

out_faa pathlike object or string representing a file

Output FA file. Maps to a command-line argument: -fa %s.

out_rda pathlike object or string representing a file

Output RD file. Maps to a command-line argument: -rd %s.

out_ada pathlike object or string representing a file

Output AD file.

out_adca pathlike object or string representing a file

Output ADC file.

out_cla pathlike object or string representing a file

Output CL file.

out_cpa pathlike object or string representing a file

Output CP file.

out_csa pathlike object or string representing a file

Output CS file.

out_evala pathlike object or string representing a file

Output selected eigenvalue(s) file.

out_eveca pathlike object or string representing a file

Output selected eigenvector(s) file.

out_faa pathlike object or string representing a file

Output FA file.

out_rda pathlike object or string representing a file

Output RD file.

TransformFSLConvert

Link to code

Bases: MRTrix3Base

Wrapped executable: transformconvert.

Perform conversion between FSL’s transformation matrix format to mrtrix3’s.

flirt_importa boolean

Import transform from FSL’s FLIRT. Maps to a command-line argument: flirt_import (position: -2). (Nipype default value: True)

in_filea pathlike object or string representing an existing file

FLIRT input image. Maps to a command-line argument: %s (position: 1).

in_transforma pathlike object or string representing an existing file

FLIRT output transformation matrix. Maps to a command-line argument: %s (position: 0).

out_transforma pathlike object or string representing a file

Output transformed affine in mrtrix3’s format. Maps to a command-line argument: %s (position: -1). (Nipype default value: transform_mrtrix.txt)

referencea pathlike object or string representing an existing file

FLIRT reference image. Maps to a command-line argument: %s (position: 2).

argsa 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: {})

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.

nthreadsan integer

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

out_bvala pathlike object or string representing a file

Export bval file in FSL format.

out_bveca 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_transforma pathlike object or string representing an existing file

Output transformed affine in mrtrix3’s format.