interfaces.mrtrix3.utils

BrainMask

Link to code

Wraps the executable command 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()                                 

Inputs:

[Mandatory]
in_file: (an existing file name)
        input diffusion weighted images
        argument: ``%s``, position: -2
out_file: (a file name, nipype default value: brainmask.mif)
        output brain mask
        argument: ``%s``, position: -1

[Optional]
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
grad_file: (an existing file name)
        dw gradient scheme (MRTrix format
        argument: ``-grad %s``
grad_fsl: (a tuple of the form: (an existing file name, an existing
          file name))
        (bvecs, bvals) dw gradient scheme (FSL format
        argument: ``-fslgrad %s %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).
        argument: ``-bvalue_scaling %s``
in_bvec: (an existing file name)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (an existing file name)
        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: (an existing file name)
        the output response file

ComputeTDI

Link to code

Wraps the executable command 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()                                 

Inputs:

[Mandatory]
in_file: (an existing file name)
        input tractography
        argument: ``%s``, position: -2

[Optional]
out_file: (a file name, nipype default value: tdi.mif)
        output TDI file
        argument: ``%s``, position: -1
reference: (an existing file name)
        a referenceimage to be used as template
        argument: ``-template %s``
vox_size: (a list of items which are an integer (int or long))
        voxel dimensions
        argument: ``-vox %s``
data_type: ('float' or 'unsigned int')
        specify output image data type
        argument: ``-datatype %s``
use_dec: (a boolean)
        perform mapping in DEC space
        argument: ``-dec``
dixel: (a file name)
        map streamlines todixels within each voxel. Directions are stored
        asazimuth elevation pairs.
        argument: ``-dixel %s``
max_tod: (an integer (int or long))
        generate a Track Orientation Distribution (TOD) in each voxel.
        argument: ``-tod %d``
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
        argument: ``-constrast %s``
in_map: (an existing file name)
        provide thescalar image map for generating images with 'scalar_map'
        contrasts, or the SHs image for fod_amp
        argument: ``-image %s``
stat_vox: ('sum' or 'min' or 'mean' or 'max')
        define the statistic for choosing the finalvoxel intesities for a
        given contrast
        argument: ``-stat_vox %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.
        argument: ``-stat_tck %s``
fwhm_tck: (a float)
        define the statistic for choosing the contribution to be made by
        each streamline as a function of the samples taken along their
        lengths
        argument: ``-fwhm_tck %f``
map_zero: (a 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)
        argument: ``-map_zero``
upsample: (an integer (int or long))
        upsample the tracks by some ratio using Hermite interpolation before
        mappping
        argument: ``-upsample %d``
precise: (a 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)
        argument: ``-precise``
ends_only: (a boolean)
        only map the streamline endpoints to the image
        argument: ``-ends_only``
tck_weights: (an existing file name)
        specify a text scalar file containing the streamline weights
        argument: ``-tck_weights_in %s``
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
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 file name)
        output TDI file

DWIExtract

Link to code

Wraps the executable command 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()                               

Inputs:

[Mandatory]
in_file: (an existing file name)
        input image
        argument: ``%s``, position: -2
out_file: (a file name)
        output image
        argument: ``%s``, position: -1

[Optional]
bzero: (a boolean)
        extract b=0 volumes
        argument: ``-bzero``
nobzero: (a boolean)
        extract non b=0 volumes
        argument: ``-no_bzero``
singleshell: (a boolean)
        extract volumes with a specific shell
        argument: ``-singleshell``
shell: (a list of items which are a float)
        specify one or more gradient shells
        argument: ``-shell %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: (an existing file name)
        dw gradient scheme (MRTrix format
        argument: ``-grad %s``
grad_fsl: (a tuple of the form: (an existing file name, an existing
          file name))
        (bvecs, bvals) dw gradient scheme (FSL format
        argument: ``-fslgrad %s %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).
        argument: ``-bvalue_scaling %s``
in_bvec: (an existing file name)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (an existing file name)
        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: (an existing file name)
        output image

Generate5tt

Link to code

Wraps the executable command 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()                               

Inputs:

[Mandatory]
algorithm: ('fsl' or 'gif' or 'freesurfer')
        tissue segmentation algorithm
        argument: ``%s``, position: -3
in_file: (an existing file name)
        input image
        argument: ``%s``, position: -2
out_file: (a file name)
        output image
        argument: ``%s``, position: -1

[Optional]
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
grad_file: (an existing file name)
        dw gradient scheme (MRTrix format
        argument: ``-grad %s``
grad_fsl: (a tuple of the form: (an existing file name, an existing
          file name))
        (bvecs, bvals) dw gradient scheme (FSL format
        argument: ``-fslgrad %s %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).
        argument: ``-bvalue_scaling %s``
in_bvec: (an existing file name)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (an existing file name)
        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: (an existing file name)
        output image

MRConvert

Link to code

Wraps the executable command 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()                               

Inputs:

[Mandatory]
in_file: (an existing file name)
        input image
        argument: ``%s``, position: -2
out_file: (a file name, nipype default value: dwi.mif)
        output image
        argument: ``%s``, position: -1

[Optional]
coord: (a list of items which are a float)
        extract data at the specified coordinates
        argument: ``-coord %s``
vox: (a list of items which are a float)
        change the voxel dimensions
        argument: ``-vox %s``
axes: (a list of items which are an integer (int or long))
        specify the axes that will be used
        argument: ``-axes %s``
scaling: (a list of items which are a float)
        specify the data scaling parameter
        argument: ``-scaling %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: (an existing file name)
        dw gradient scheme (MRTrix format
        argument: ``-grad %s``
grad_fsl: (a tuple of the form: (an existing file name, an existing
          file name))
        (bvecs, bvals) dw gradient scheme (FSL format
        argument: ``-fslgrad %s %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).
        argument: ``-bvalue_scaling %s``
in_bvec: (an existing file name)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (an existing file name)
        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: (an existing file name)
        output image

MRMath

Link to code

Wraps the executable command 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()                               

Inputs:

[Mandatory]
in_file: (an existing file name)
        input image
        argument: ``%s``, position: -3
out_file: (a file name)
        output image
        argument: ``%s``, position: -1
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
        argument: ``%s``, position: -2

[Optional]
axis: (an integer (int or long))
        specfied axis to perform the operation along
        argument: ``-axis %d``
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
grad_file: (an existing file name)
        dw gradient scheme (MRTrix format
        argument: ``-grad %s``
grad_fsl: (a tuple of the form: (an existing file name, an existing
          file name))
        (bvecs, bvals) dw gradient scheme (FSL format
        argument: ``-fslgrad %s %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).
        argument: ``-bvalue_scaling %s``
in_bvec: (an existing file name)
        bvecs file in FSL format
        argument: ``-fslgrad %s %s``
in_bval: (an existing file name)
        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: (an existing file name)
        output image

Mesh2PVE

Link to code

Wraps the executable command 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()                                 

Inputs:

[Mandatory]
in_file: (an existing file name)
        input mesh
        argument: ``%s``, position: -3
reference: (an existing file name)
        input reference image
        argument: ``%s``, position: -2
out_file: (a file name, nipype default value: mesh2volume.nii.gz)
        output file containing SH coefficients
        argument: ``%s``, position: -1

[Optional]
in_first: (an existing file name)
        indicates that the mesh file is provided by FSL FIRST
        argument: ``-first %s``
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: (an existing file name)
        the output response file

TCK2VTK

Link to code

Wraps the executable command 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()                                 

Inputs:

[Mandatory]
in_file: (an existing file name)
        input tractography
        argument: ``%s``, position: -2

[Optional]
out_file: (a file name, nipype default value: tracks.vtk)
        output VTK file
        argument: ``%s``, position: -1
reference: (an existing file name)
        if specified, the properties of this image will be used to convert
        track point positions from real (scanner) coordinates into image
        coordinates (in mm).
        argument: ``-image %s``
voxel: (an existing file name)
        if specified, the properties of this image will be used to convert
        track point positions from real (scanner) coordinates into image
        coordinates.
        argument: ``-image %s``
nthreads: (an integer (int or long))
        number of threads. if zero, the number of available cpus will be
        used
        argument: ``-nthreads %d``
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 file name)
        output VTK file

TensorMetrics

Link to code

Wraps the executable command 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()                                 

Inputs:

[Mandatory]
in_file: (an existing file name)
        input DTI image
        argument: ``%s``, position: -1

[Optional]
out_fa: (a file name)
        output FA file
        argument: ``-fa %s``
out_adc: (a file name)
        output ADC file
        argument: ``-adc %s``
out_evec: (a file name)
        output selected eigenvector(s) file
        argument: ``-vector %s``
out_eval: (a file name)
        output selected eigenvalue(s) file
        argument: ``-value %s``
component: (a list of items which are any value, nipype default
          value: [1])
        specify the desired eigenvalue/eigenvector(s). Note that several
        eigenvalues can be specified as a number sequence
        argument: ``-num %s``
in_mask: (an existing file name)
        only perform computation within the specified binary brain mask
        image
        argument: ``-mask %s``
modulate: ('FA' or 'none' or 'eval')
        how to modulate the magnitude of the eigenvectors
        argument: ``-modulate %s``
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_fa: (a file name)
        output FA file
out_adc: (a file name)
        output ADC file
out_evec: (a file name)
        output selected eigenvector(s) file
out_eval: (a file name)
        output selected eigenvalue(s) file