Visualizing DTI images with DTI-TK (draft)
Overview
Effective visualization of DTI volumes is critically important for processing and analyzing this type of data. For example, after reconstructing a DTI volume from the raw diffusion-weighted images (DWIs), it is imperative to examine if the tensors are properly oriented in space. For this purpose, neither the FA map nor the RGB map of the principal diffusion directions suffice. It is necessary to visualize the principal diffusion direction as 3D vectors or to visualize the tensors as 3D tensor glyphs. DTI-TK offers a simple tool for the latter, called TVglyphView.
In the context of spatial normalization, visualization serves the purpose of qualitative quality control. For sanity checks, looking at the FA map is usually sufficient.
Here, we discuss three different approaches towards DTI volume visualization, from looking at rotation-invariant scalar indices to visualizing the full tensors.
Viewing the rotation-invariant scalar indices
DTI-TK implements the utilities to compute the common rotation-invariant scalar indices derived from a DTI volume. The scalar index volumes are saved in NIfTI format and can be visualized using any Analyze/NIfTI supported viewers, such as MRIcro and ITK-SNAP. A thorough description of the utilities that compute rotation-invariant scalar indices is given here. Below are some important examples.
Viewing the RGB map of the principal diffusion directions
TVtool can be used to compute the principal diffusion direction map of a DTI volume or to generate the principal diffusion direction mapped into the corresponding RGB map, which can be visualized using ITK-SNAP.
TVtool -in tensor.nii.gz -pd
outputs the principal direction map tensor_pd.nii.gz
TVtool -in tensor.nii.gz -rgb
outputs the principal direction RGB map tensor_rgb.nii.g that can be directly loaded into ITK-SNAP for viewing. To tune the saturation level of colors, you can use the following command (if not supplied, the default value is 1.0):
will increase the color saturation. The figure below illustrates the RGB map produced from the example data.
IMPORTANT WARNING: There are two shortcomings to visualizing a DTI volume using the RGB map.
One is that the mapping from principal diffusion directions (unit vectors) to RGB codes is a many-to-one function. More specifically, the vectors derived from some unit vector (x, y, z) by flipping the sign(s) of X, Y or Z component(s) will be mapped to the same RGB code, despite many of these vectors have distinctly different orientations in space.
The second shortcoming is that, around the interfaces of white matter fiber bundles that traverse orthogonal to each other, the principal diffusion directions derived from diffusion tensors do not generally correspond to the orientation of the underlying fiber bundles.
Viewing the tensors using 3D ellipsoid glyphs
DTI-TK implements tools for visualizing the tensors in terms of 3D ellipsoid glyphs and these tools are aimed to remedy the shortcomings of RGB-based visualization discussed above. To visualize a DTI volume, simply type the command
TVglyphView -in tensor.nii.gz
If not yet done, you can know more about your tensor image by using the command that can help tweaking the TVglyphView visualization parameters
The output should look like
Volume Info of tensor.nii.gz
size: 112x112x60, voxel size: 2x2x2, origin: [0, 0, 0]
which suggests that there are 112, 112, and 60 slices along x (sagittal), y (coronal) and z (axial) dimensions, respectively.
The figures below illustrate the axial and coronal views produced using the following commands:
TVglyphView -in tensor.nii.gz -scale 2 -view axial
TVglyphView -in tensor.nii.gz -scale 2 -view coronal
The scale factor was increased from 1 (default) to 2 in order for the tensors to be more visible.
IMPORTANT: If you find that, to see the ellipsoids rendered like the figures above, you have to increase the scaling number from 1.0 to a significantly larger number like 1000.0, it is a good sign that you have to adjust the diffusivity of your DTI volume.
Checking if tensors are correctly reconstructed
An important utility of the tensor glyph rendering described above is for checking the correctness of your tensor reconstruction. A common mistake during tensor reconstruction (the process of constructing tensor volumes from diffusion-weighted images) is using a gradient table that is not corrected for the difference between the coordinate frame in which the gradient table is defined and the one in which the image is defined. This type of erroneous reconstruction can not be detected with the RGB map (explained above) and need to be ruled out with the tensor glyph rendering.
The two steps are:
- Check if the tensors are oriented correctly in the genu and the splenium of the corpus callosum in the axial view (shown above). The tensors' major axes should be clearly aligned along the boundary of the genu and the splenium.
- Check if the tensors are oriented correctly in the internal capsule and the midbody of the corpus callosum in the coronal view (also shown above). Again, the tensors should be properly aligned with the boundary of these structures.
To correct for any errors that you identify, you need to first modify the gradient table, then repeat the tensor reconstruction. The modification of the gradient table typically involves flipping the signs of the x or y component of all gradient vectors. To determine the correct flipping of the signs in a systematic way, it is necessary to understand why this happens. The reason is that the gradient directions are always defined with respect to some right-handed frame of reference, while the frame of reference of the acquired image data is typically NOT right-handed. This mismatch is the cause of the problem. The sign flipping intends to fix this mismatch and the key is to identify the difference between the two frames of reference in question. In our experience, if the data is acquired on SIEMENS scanners, the signs of x gradient components need to be flipped; for GE scanners, it is usually the y components.
In the event that you prefer not to redo the tensor reconstruction, you can correct the tensor orientations with the tool TVtool using the flag -reorient -euler theta phi psi, which allows you to specify the appropriate rotation, in terms of Euler angles, that should be applied to each tensor in the volume. The Euler angles are theta, the rotation about x axis, phi, the rotation about y axis, and psi, the rotation about z axis. The sign flipping of x component is equivalent to setting theta to 180 degrees, phi and psi to 0 degrees. Similarly, the flipping of y component is equivalent to setting phi to 180 degrees, theta and psi to 0 degrees. Here is an example usage:
TVtool -in tensor.nii.gz -reorient -euler 180 0 0 -out reoriented.nii.gz
This produces a tensor volume in which the tensors are rotated 180 degrees about the x axis. Please refer to the man command of TVglyphView.
Viewing the tensor component images
CHANGE THIS SECTION
There are two ways to view the actual tensor components, i.e., Dxx, Dyx, etc.
- Using TensorVolumeToImage, you can split a DTI volume in NIfTI format into six scalar NIfTI volumes. Each scalar volume contains one of the six tensor components and can be viewed with standard volume viewers, such as ITK-SNAP. Below is an example usage of TensorVolumeToImage applied to the provided sample data.
TensorVolumeToImage tensor.nii.gz tensor nii.gz
- Using the most recent version of MRIcron, you can load a DTI volume in NIfTI format directly. The program will prompt you to pick the tensor component that you'd like to view.