dMRI-Lab 1.0
spectrum2colorcode.m File Reference

Functions

function spectrum2colorcode (in u1file, in l1file, in l2file, in l3file, in varargoutfile, in varargin)
 

Function Documentation

◆ spectrum2colorcode()

function spectrum2colorcode ( in u1file,
in l1file,
in l2file,
in l3file,
in varargoutfile,
in varargin )

Computes the standard color-code representation for diffusion tensor data based on their spectra as computed by the dti2spectrum function. All mandatory inputs u1, l1, l2, and l3 are returnned by dti2spectrum.

Parameters
u1fileThe eigenvector associated to the largest eigenvalue, l1.
l1fileThe largest eigenvalue.
l2fileThe file to save the second largest eigenvalue.
l3fileThe file to save the smallest eigenvalue.
varargoutfileA string specifying the file to save the stacked RGB (xyz) channels weigthed by the FA, in the range [0,1].
vararginOptional arguments passed as -name value pairs
Returns
- RGB: a MxNxPx3 volume with the stacked RGB (xyz) channels weigthed by the FA, in the range [0,1]. For example, you can plot the 17-th slice of a "tensor" volume as:
>> [u1,~,~,l1,l2,l3] = dti2spectrum( tensor, 'mask', mask );
>> RGB = spectrum2colorcode( u1, l1, l2, l3, 'mask', mask);
>> slice = 17;
>> IMG = squeeze(RGB(:,:,slice,:));
>> imshow(IMG); 

Mandatory Inputs:

  • u1file The eigenvector associated to the largest eigenvalue, l1.
  • l1file The largest eigenvalue.
  • l2file The file to save the second largest eigenvalue.
  • l3file The file to save the smallest eigenvalue.
  • varargoutfile A string specifying the file to save the stacked RGB (xyz) channels weigthed by the FA, in the range [0,1].
  • varargin: Optional arguments passed as -name value pairs.

Optional Arguments

  • mask: a MxNxP array of logicals. Only those voxels where mask is true are processed, the others are filled with [0,0,1].

Example:

spectrum2colorcode u1file.nii l1file.nii l2file.nii l3file.nii varargoutfile.nii -mask mask_file.nii
function spectrum2colorcode(in u1file, in l1file, in l2file, in l3file, in varargoutfile, in varargin)
Note
This is the simplest use case
See also
dwi2atti, spectrum2colorcode, parsevarargin, write_nifti_from_struct.