dMRI-Lab 1.0
demo_DTMRI_developer.m File Reference

This demo illustrates the basic use of the tensor module, which provides tools for the computation of standard DT-MRI representations. More...

Detailed Description

This demo illustrates the basic use of the tensor module, which provides tools for the computation of standard DT-MRI representations.

Estimate the diffusion tensor

The toolbox implements a number of commonly used estimation methods. The simplest (and the fastest) is ordinary, non-weighted least squares. This may be invoked by disabling the weighted and non-linear options of the estimation function, atti2dti.m:

atti2dti dwi.nii.gz dwi.bvec dwi.bval tensorfile.nii s0file.nii -mask dwi_mask.nii.gz
function atti2dti(in dwifile, in gifile, in bifile, in tensorfile, in s0file, in varargin)
Note
This is the simplest use case

Compute the spectrum of the diffusion tensor

The eigenvalues and eigenvectors of the diffusion tensor are referred to as its spectrum. The function used to compute them is dti2spectrum.m. From now on, we will use the variable "tensor", obtained from the non-linear, non-negative method. This ensures no negative eigenvalues will appear:

dti2spectrum tensorfile.nii u1file.nii u2file.nii u3file.nii l1file.nii l2file.nii l3file.nii -mask dwi_mask.nii.gz
function dti2spectrum(in tensorfile, in u1file, in u2file, in u3file, in l1file, in l2file, in l3file, in varargin)

Compute and represent scalar maps

DT-MRI studies are usually based on scalar maps computed from the eigenvalues of the diffusion tensor. We will use the spectrum obtained in the previous section to compute these scalars with spectrum2scalar.m. Since no negative eigenvalues are present, no out-of-bounds values are expected to appear. Let's start with the most commonly used scalar maps:

spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar md
function spectrum2scalar(in l1file, in l2file, in l3file, in volfile, in varargin)
spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar fa
spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar ra

An alternative representation is based on Westin's coefficients, a set of values in the range [0,1], whose sum is 1, and which represent how close the tensor is to be completely linear, completely planar, or completely spherical:

spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar cl
spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar cp
spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar cs

Yet, Westin's coefficients admit an alternative representation (with simlar properties) by using a slightly different normalization: instead of dividing by the largest eigenvalue, l1, one can divide by the RMS value of the eigenvalues:

spectrum2scalar directory l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar clsq
spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar cpsq
spectrum2scalar l1file.nii l2file.nii l3file.nii volfile.nii -mask dwi_mask.nii.gz -scalar cssq

Represent color-by orientation maps

A convenient way to represent both the anisotropy and the orientation information of the diffusion tensor is using color-coded maps, which depend on the orientation of the main eigenvector, u1 (the one corresponding to the largest eigenvalue, l1): if u1 is oriented following the 'x' axis in one voxel, that voxel will be colored in red. If it is oriented along 'y', the color will be green. If it is oriented along 'z', the color will be blue.The brightness of the voxel is adjusted according to its FA. This way, both the dominant orientation of the bundles inside the voxel and the anisotropy can be checked with a glance. The function to call here is spectrum2colorcode.m:

spectrum2colorcode u1file.nii l1file.nii l2file.nii l3file.nii varargoutfile.nii -mask dwi_mask.nii.gz
function spectrum2colorcode(in u1file, in l1file, in l2file, in l3file, in varargoutfile, in varargin)