Tensor Utility

Introduction

While the main purpose of the Tensor Utility tool is to compute the diffusion tensor (DT), it also generates, as a byproduct, the ADC (Apparent Diffusion Coefficient) map, the mean DW image (in the case of a multiple DW series acquisition), and an anatomical mask representative of the brain region (using the T2 image acquired along with the DWIs). It allows for a custom set of gradient directions and any number of diffusion-free images (T2). The tensor utility also provides a set of tensor transformation options. In order to invoke the Tensor Utility tool, simply choose the "Diffusion" menu within the diffusion tool, and select the "Tensor utility" option.


1. Loading diffusion-weighted images (DWI)

Tensor Utility

The first step in computing the tensor is to load the DWI series into the program, The DWI series must be in  Analyze® format, and it must be a 4D image (multiple 3D volumes or frames, as in fMRI acquisitions). The file should be comprised of a total of n+m frames, where n is the number of diffusion-free images and m is the number of diffusion-weighted images. As an example, consider a DW acquisition consisting of 1 T2-weighted frame and 21 diffusion-weighted frames corresponding to 21 diffusion gradient directions:

DWI

The file must be ordered such that all T2-weighted frames come first (in this case, the first frame), followed by all frames of the diffusion-weighted data with the DW frame corresponding to the 1st gradient direction next, and so on (frames 2 through 22). You can add any number of series by clicking the Add button, but all of them must have the same size. Immediately after an image series is loaded, the program will attempt to guess the number of T2 images and gradient directions from the total number of frames. Always check if these numbers match your acquisition parameters.

The b-Value: The b-value is set by default to 1000 s/mm^2. If you would like your diffusion maps (ADCs, Trace and Mean Diffusivity) to contain absolute diffusivity values, set the checkbox to allow the entry of the specific b-value used in your acquisition. The b-value will have no effect on indices such as RA or FA, and will not impact fiber tracking.

Note: The  pxmat_create4dimage.tcl script can be used to combine a number of 3D volume images into a single 4D image.

2. Specifying gradient directions

Now that you have loaded your images, it is always a good practice to check whether the number of gradient directions corresponds to your acquisition's and if the set of directions matches the prescribed ones.

Gradients

The tensor utility comes pre-loaded with different sets of common gradient directions. Alternatively, you can load in the well-known tensor.dat file which contains a number of predefined gradient sets. Select the set which corresponds to your acquisition protocol. If you would like to create your own set, you must first create a text file using your text editor and input your directions according to the following format:

n
x1 y1 z1
x2 y2 z2
...
xn yn zn

where n is the number of directions, and xi,yi,zi are the x, y, z coordinates of the ith direction, separated by spaces. This file can contain multiple sets of directions; simply append each new set after the previous, obeying the format above. Save this file with a .dat extension, and load it via the Load button in the Gradientspane. The new set of directions should appear in the list, and it should also be depicted in the Preview window. There you will be able to interact with the sphere model and observe the direction distributions. To reset the Preview window, please press the 'r' key.

For unbiased results, one should at least sample the diffusion space using noncollinear directions. To check whether your set contains colinear directions, press the Check button.

3. Loading a mask

The tensor tool by default creates a binary mask (or stencil) of the tissue region using the diffusion-free images (T2). The tensor will be calculated only for points that belong to this mask. Points outside the stencil will be assigned 0-tensors.
Mask

The tensor tool uses simple histogram thresholding to create this mask. In case you would like to load your own, first unckeck the option Compute from unweighted diffusion series, then click Load to read your file. This image must be in Analyze® format, with the same size as your volume and with values 1.0 representing the foreground (the mask), and 0 for the background.

Alternatively, you can threshold the image manually by disabling the Auto-threshold feature. The Trace connectivity option, when enabled, turns on a morphology-based algorithm that keeps only connected voxels in the masks. Remote "islands" are removed. The center point of the image is used as the center of the mask.

4. Computing the tensor

Once you have loaded the DWIs, checked the number of T2s and gradient directions and specified the appropriate anatomical mask, you are ready to compute the diffusion tensor by pressing the button Compute! in the Diffusion pane. The status bar will display the task progress.

Results

Once  the tensor computation is done, you will be automatically taken to the Results pane. You are then given the opportunity to save the diffusion tensor as well as the other results that were also computed. To save a single result, select the desired item in the Results list box, and click the Save button.

By default, the diffusion tensor is the result displayed when the calculation is done. In order to display other results such as the mean diffusion-weighted image or the apparent diffusion coefficient, simply select the desired image and click the Display button.

Prefix

Each result is associated with a suffix that will be appended to the name given in the Prefix field. For example, if your prefix is "s13_", the resulting tensor will be saved under the name "s13_dti_tensor". You can freely alter the prefix, but suffix convention is fixed. The prefix is normally defined by the name of the last DWI image series that was loaded (It will copy the name until an underscore symbol is found).

5. Tensor transformations

The magnetic diffusion gradient directions are specified using the physical coordinate system of the scanner. The z axis runs through the gantry while the x and y axes run orthogonal to it (in yellow below). Depending on the acquisition orientation, the origin of the gradient coordinate system and the image coordinate system (after it's stored as a 4D image) may not coincide. As a result, the diffusion tensor, when displayed will look incorrect. This inconsistency may not be easy to spot, since it requires some knowledge of the anatomy being scanned.

Assuming the case of a transaxial acquisition, the gradient axes match the x, y, z axes of the image acquisition system (see axes in black below). However, depending on the direction of the phase and frequency encoding gradients, the tensor may need to be flipped in sign. Also, if the image is stored last slice first, you will need to flip z. In the case of a coronal or sagittal acquisition, axes must be swapped (see figure below).

In order to perform such transformations, you may choose the "Tensor transformation" pane,





To perform such transformations, use the Transform pane, which will allow you to make the necessary flips and swaps. In addition, it will also allow the tensor field to be rotated, a step necessary when images are previously transformed by a rotation component. Once you select the necessary transformations, click on Compute! (in the Diffusion pane) to compute the diffusion tensor. If you previously computed the tensor, select the new transformations, compute it again, and then save the results.



If are not sure you need to apply any transformations to your image, do not at this stage and proceed to the tensor analysis step. There you will be able to visualize the tensor field and determine if any transformation is necessary.

For further diffusion analysis, continue with either [ Tensor Analysis ] or [ Fiber Tracking ].

About this manual.