Top Banner SCI Web Site SCI Software Site

Contents

Sections

  1. Introduction
  2. Getting Started
    1. Preparations
    2. Launching BioTensor
    3. User Interface Organization
  3. Loading Data
  4. Registration of Echo-Planar DWIs
    1. Visualizing Mis-registration Problems
    2. Gradients Data
    3. Reference Image
    4. Segmentation Settings
    5. Fitting Percentage
    6. Resampling Filter
    7. Computing Registration
  5. Building Tensors (Tensor Estimation)
    1. DWI Smoothing
    2. Masking Threshold
    3. B-Matrix
    4. Build Tensors
  6. Visualization
    1. Rendering Window
    2. Planes
    3. Isosurface
    4. Glyphs
    5. Fibers

Appendices

  1. Image Formats and Preparation
  2. B-Matrix File Format

Tables

Figures

Section 1—Introduction

BioTensor is a program that processes and visualizes diffusion tensor images. It can read diffusion weighted images (DWIs), perform correction for a common class of distortions in echo-planar imaging, estimate tensors from DWIs, and visualize the diffusion tensor field. BioTensor's functionality is easily extended. Future versions will have expanded capabilities based on contributions from external collaborators and internal development.

Diffusion weighted imaging uses the diffusion of water molecules to probe the directional micro-structure of living tissue. A single diffusion weighted image generally measures diffusivity of water molecules along a particular direction. The amount of diffusion along a direction is detected by destructive interference of different phase signatures created by the magnetic gradient. A large set of DWIs along carefully chosen gradient directions permits estimation of a diffusion tensor that models the relationship between direction and diffusivity. The BioTensor application generates "diffusion tensor images" (DTIs) from DWIs. DTIs are three-dimensional fields of tensor values. Seminal papers on diffusion tensor imaging, written by Peter Basser and others, can be found here.

An important application of diffusion tensor imaging is determining the connective structure of central nervous tissue, made possible by the directionally constrained diffusion of water within or between the myelinated axon sheaths of white matter. The extent to which diffusion is faster along some directions than others is termed anisotropy; white matter within the brain is more anisotropic than gray matter on its cortical surface. The visualization capabilities in BioTensor allow the user to:

This tutorial demonstrates many of BioTensor's capabilities. BioTensor is used in this tutorial to process diffusion weighted images acquired using the echo-planar imaging method. These data are part of the SCIRun sample data set collection and may be obtained from SCI's web site.

Section 2—Getting Started

This section demonstrates how to start BioTensor. Subsequent sections demonstrate how to load, process, and visualize data.

2.1 Preparations

Before starting the tutorial a number of preparations must be made. First, set the following environment variables:

SCIRUN_DATA
SCIRUN_DATA points to the sample data sets directory. This tutorial assumes the SCIRun sample data directory is /usr/sci/data/SCIRunData/1.24.2.

For a csh-like shell:

  setenv SCIRUN_DATA /usr/sci/data/SCIRun/SCIRunData/1.24.2
	  

For a sh-like shell:

  export SCIRUN_DATA=/usr/sci/data/SCIRun/SCIRunData/1.24.2
	  
SCIRUN_DATASET
SCIRUN_DATASET points to a specific data set directory within the data directory. The tutorial requires SCIRUN_DATASET to be set to the "brain-dt" dataset:

For a csh-like shell:

  setenv SCIRUN_DATASET brain-dt
	  

For a sh-like shell:

  export SCIRUN_DATASET=brain-dt
	  

2.2 Launching BioTensor

To launch the BioTensor application, change the current working directory (using the cd command) to the directory containing the BioTensor executable. The directory for an RPM installation is /usr/local/SCIRun/bin/.

Type ./BioTensor to start the program. BioTensor takes a few moments to start up, then launches a user interface window shown in Figure 1.

Figure 1: BioTensor
	    Interface Window (Initial State).
Figure 1: BioTensor Interface Window initial state
Click on image for a larger view


2.3 User Interface Organization

BioTensor's user interface, shown in Figure 1, contains three panes. The left pane is the Processing Pane. It guides the user through the application. The center pane is the Rendering Pane. Data interaction and visualization is performed here. The right pane is the Visualization Pane. It controls parameters for the Rendering Pane.

The panes may be "detached" from one another by clicking on the pane detachment/attachment controls—these are the vertical dashed lines separating the panes. When separated, the panes appear as shown in Figure 2 . Detaching the Rendering window allows it to be viewed at maximum resolution. Panes are re-attached by clicking on the pane detachment/attachment controls.

Figure 2: BioTensor
	    Interface Window (Panels Detached From View Window).
Figure 2: BioTensor Interface Window. Detached panels.
Click on image for a larger view.

The Processing Pane has two top-level menus: File and Help, as shown in Figures 3 and 4.

File menu items Save Session... and Load Session... allow the user to stop and resume BioTensor sessions. After loading a saved session with Load Session..., resume processing and visualization by clicking Execeute. At any time the user can select the Restore Panes option (or use Control-R) and any detached Panes will be brought to the front of the application, even if they have been closed.

Help menu item Show Tooltips toggles tooltips. "Hovering" the mouse pointer over a control displays a tooltip describing a control.

Figure 3: File Menu.
Figure 3: File Menu.



Figure: Help Menu.
Figure 4: Help Menu.

The bottom of the Processing Pane contains a Progress Indicator, a text description indicating the current state of the application, and suggests the next processing step.

Just above the Progress Indicator are two buttons: an Execute button and a Next button. Press the Execute button to complete the current processing step. Press the Next button to begin the next processing step.

The Progress Indicator indicates an error if an error occurs. Clicking on the Progress Indicator displays an error log.

Section 3—Loading Data

BioTensor can be used to process raw DWI images, producing DTI data for visualization. Pre-computed Tensor data can be loaded into BioTensor for immediate investigation (bypassing processing stages). BioTensor supports the NRRD, Analyze, and DICOM data formats. Appendix A gives more information on supported image formats.

Note: if your environment variables are set correctly, you can skip steps 1-4. Otherwise, to load data for this tutorial:

  1. Click on the Processing Pane's Load Data tab.

  2. Click the radio button labeled: DWI with separate B0 Reference Data.

  3. Click on the Load Data panel's Nrrd tab.

  4. Use the Nrrd panel's Browse buttons to select DWI data, /usr/sci/data/SCIRunData/1.22.0/demo-DWI.nrrd, and B0 data, /usr/sci/data/SCIRunData/1.22.0/demo-B0.nrrd.

Each Browse button invokes a file selection dialog like the one shown in Figure 5. After selecting the desired file, click the Set button n the file selection dialog. The UI will close.

Notes:


Figure: File Load Dialog.
Figure 5: File Load Dialog.


After selecting DWI and B0 data, click the Processing Pane's Execute button at the bottom of the pane. Data are loaded and an image appears in the Rendering window. This image shows the variance between the different DWI component volumes for a specific slice location. Variance values are color-coded: areas of low variance are black, areas with medium variance are orange, and areas of high variance are white. With the slider in the Visualization panel, select different slices from the volume to inspect.

Performing distortion correction on the DWI channels is the next step in the BioTensor application. Press the yellow Next button at the bottom of the Processing pane to proceed to the registration processing step.

Section 4—Registration of Echo-Planar DWIs

Many diffusion weighted images are acquired with a fast method known as echo-planar imaging (EPI). This type of imaging can suffer from two kinds of distortion: global distortions due to eddy currents, and local distortions due to susceptibility artifacts. BioTensor can correct the first type of distortion. Future versions may include field-map based correction of the second type of distortion. BioTensor assumes the X direction is the read-out direction, and the Y direction is the phase-encoding direction, along which EPI distortions occur. Figure 6 shows the Processing pane's Registration tab. "Check" the Registration tab's "Perform Global EPI Registration" check-box to perform EPI registration. The following sections describe each registration parameter. This tutorial assumes use of default registration settings.

Figure: Registration Tab.
Figure 6: Registration Pane.


4.1 Visualizing Mis-registration Problems

Visualizing the variance at each voxel across the DWIs, can indicate problems due to poor DWI registration as shown in Figure 6. To view the variance, select the Vis Options tab. Then select the Variance tab. Now select the "View Variance of Original Data" check-box. DWI variance is a simple indicator of anisotropy, because isotropic regions should generate constant DWI values for all gradient directions. Note, however, the regions of high spurious ("ghost") anisotropy at the top (anterior) and bottom (posterior) edges of the brain, due to DWI mis-registration.

4.2 Gradients Data

The method for registering EPI acquired images looks at over-all brain cross-section changes across the DWIs to estimate (and correct for) the distortion caused by eddy currents. The list of gradient directions associated with each DWI (the direction along which the image is sensitized to diffusion) is the first piece of information required at this stage. This is given as the "Gradients File:". This is a plain text file, with three numbers per line, giving the X, Y, and Z components of the gradient. There must be one line per DWI.

4.3 Reference Image

The registration method can perform implicit registration with the reference (B=0) image, or it can use a diffusion weighted image chosen by the user. Select the implicit registration method by clicking on radio button Implicit Reference. To use a diffusion weighted image, click Choose Reference Image. Then, use the slider labled Choose Reference Image to choose an image (note that DWIs are sequentially numbered, starting with 1).

Implicit registration models the relationship between gradient directions and the resulting distortion, allowing implicit registration to map DWIs to the coordinate space of the B=0 image without explicitly registering with it.

When using a diffusion weighted image, choose the image least affected by EPI distortion.

4.4 Segmentation Settings

The registration method's estimate of the over-all shape of the brain cross-section is based on a simple segmentation of the DWIs. Segmentation is performed as some amount of Gaussian smoothing along the X and Y directions, followed by a thresholding of the DWI value, followed by (optional) connected component analysis. Each step is represented in the UI.

The X and Y sliders located within the Gaussian Smoothing box, control the radius (standard deviation) of the Gaussian smoothing along the X and Y directions. Some amount of smoothing helps the thresholding find more accurate estimates of the brain cortical outline. Too much smoothing distorts the estimate of cortical shape due to anisotropy in the underlying white matter. The preset defaults work well.

The threshold DWI value, between background and brain tissue, can be automatically determined by clicking the radio button labeled Automatically Determine Threshold in the Background/DWI Threshold box. A threshold value may be specified by clicking the radio button labeled Specify Threshold, and entering a threshold value.

The Use Connected Components check box determines whether connected component analysis is done to refine the thresholding output. Using connected components is helpful because it leads to estimates of the brain cross-section shape that are more similar across the diffusion weighted images.

4.5 Fitting Percentage

Based on the segmentation of the brain interior, the registration method estimates the distortion on each slice of the DWI volumes. To improve the robustness, a linear fitting of the distortion parameters across the slices is performed. This allows better distortion correction on slices where the brain cross-section shape was poorly segmented, leading to poor distortion estimation on that single slice. The algorithm internally generates a measure of segmentation quality, and uses some fraction of slices (those with the best segmentation) as reference when performing the linear fit of distortion parameters across slices. With the Fitting percentage slider, specify how many slices should contribute to the fitting, versus how many slices (with the poorest segmentation results) should be ignored. The default setting works well.

4.6 Resampling Filter

The filter used when applying the warp to the individual images is the final parameter in the registration method. In order of ascending quality (and decreasing speed), the choices are:

Use the pop-up menu labeled Resampling Filter to choose a filter.

4.7 Computing Registration

Press "Execute" after registration parameters have been set. Due to the complexity of the process, registration can take some time.

Once registration is finished, visualize the improvement, as shown in Figure 7, by selecting the "View Variance of Registered Data" check-box in the visualization pane. This shows, side by side, slices of DWI variance before and after registration. Note the reduction of spurious anisotropy at the edges of the brain.

Press Next to go to the next step—building tensors.

Figure: Registration Improvement.
Figure 7: Registration Improvement.

Section 5—Building Tensors (Tensor Estimation)

The final processing step combines the diffusion weighted images to estimate diffusion tensors at each sample point. Figure 8 shows the Processing Pane and the Rendering Pane at the final step of processing. Note the Processing Pane's Build Tensors tab is selected. Following sub-sections discuss the DWI smoothing, masking threshold, and B-matrix parameters. Press Execute after setting these parameters to compute tensors.

Figure: Final Processing Stage.
Figure 8: Final Processing Stage.

5.1 DWI Smoothing

Visualization and analysis stages sometimes benefit from smoothing of the individual DWIs prior to estimation of tensors. The checkbox labeled Do Smoothing enables Gaussian blur of the DWIs by controlling the radius (the standard deviation) of the Gaussian kernel within the slice plane and across slices. The slider labeled Radius in X and Y controls the Gaussian kernel radius within the slice plane. The slider labeled Radius in Z controls the Gaussian kernel radius across slices.

5.2 Masking Threshold

Diffusion tensors can not be meaningfully calculated in the background (air) of DWIs. The non-diffusion-weighted image and DWIs do not have significant signal in the background. Diffusion tensors can be calculated inside the CSF (cerebrospinal fluid), but they do not record interesting anatomical structure. In both regions, the value of DWIs is small compared to values inside the brain. BioTensor masks the tensor field based on the mean DWI value, so the regions do not appear in later visualizations.

To allow BioTensor to automatically find a threshold (by histogram analysis), click the radio button labeled Automatically Determine Threshold. To specify a threshold, click the radio button labeled Specify Threshold and enter a threshold value. Note: tensors are computed for all voxels; the DWI masking produces a separate scalar field that BioTensor uses for controlling visualization, but does not scale tensors themselves.

5.3 B-Matrix

To estimate tensors from DWIs, the relationship between each DWI and the diffusion tensor must be known. The B-matrix is a matrix that captures the weighting that each diffusion tensor coefficient received in a given DWI. BioTensor currently refers to the list of B-matrices for all DWIs as the "B-Matrix". B-Matrix information can be communicated to BioTensor in two ways.

Assuming diffusion weighting caused by imaging gradients is negligible, the B-Matrix can be computed directly from the list of gradient directions used previously for EPI registration. Note: in this case, the first image among the DWIs is assumed to be the reference T2 image, which exhibits no diffusion weighting, and the B-matrix is assumed to be all zeros ("B=0"). To let BioTensor compute the B-Matrix, click the radio button labeled Compute B-Matrix Using Gradients provided

If a B-matrix has been computed for each DWI from both imaging gradients and diffusion-encoding gradients, it can be loaded as a separate text ("Load B-Matrix"). To load a pre-computed B-Matrix file, click the radio button labeled Load B-Matrix, and enter the name of a B-Matrix file. Appendix B discusses the format of a B-Matrix file.

5.4 Build Tensors

Currently, BioTensor performs linear least-squares fitting to estimate the diffusion tensors at each sample point. Non-linear tensor estimation will be included in an upcoming version.

Press the Execute button to compute the DT volume and begin visualization.

Section 6—Visualization

As the visualization stage begins, the system computes a number of derived quantities. This may take several minutes, during which time, the Progress indicator shows that the system is busy. One of the first quantities the system renders, is a set of three orthogonal cutting planes through the DT volume. Begin interacting with the visualization when the Progress Indicator shows that compuations are complete.

6.1 Rendering Window

To visualize data, press the AutoView button to move the rendered geometry into the middle of the window, or press Ctrl-V while the mouse is in the Rendering window. The AutoView button is located on the Viewer Options tab.

Interaction with the Rendering window is performed with the mouse. The Rendering window's scene can be translated, zoomed, rotated, etc. Table 1 shows mouse actions for controlling the Rendering window. Controls for navigating within the Rendering window are similar to the SCIRun Viewer. However, the full control pane normally found at the bottom of the SCIRun ViewWindow, has been replaced with the most frequently used subset of those controls, and is located on the Viewer Options tab.

Table 1: Rendering Window's Mouse Controls
Modifier Key Mouse Button Renderer Window Action
none Left Translate scene
Middle Rotate scene
Right Zoom scene
Control Left Translate scene in Z-direction
Middle Rotate the camera view about the eye point
Right Unicam movement

Within the Vis Options tab of the Visualization pane, there are five sub-tabs for controlling visualization settings. The first tab, "Variance", was used in Section 3 to visualize DTI variance data. The following sections investigate options on the Planes, Isosurface, Glyphs, and Fibers tabs.

6.2 Planes Visualization

By default, the cutting planes render when the visualization pre-processing stage completes, as shown in Figure 9. These planes are initially color-mapped to reflect the principal eigenvector direction, using a standard (X,Y,Z) -> (R,G,B) mapping. Saturation of colors has been modulated by fractional anisotropy, and areas outside of the gray and white matter are rendered black. The individual cutting planes can be turned on and off and their positions can be controlled using the X, Y, Z check-buttons and sliders. Color-mapping of tensor values on planes can be controlled using the drop-down menu under "Principle Eigenvector" in the "Color Planes Based On" frame. When coloring based on a scalar quantity (e.g. Fractional Anisotropy), radio buttons next to the color-map swatches become active. For constant coloring, change the specified color by clicking on the Color button. The "Clip to Isosurface" button is discussed in the next section.

Figure: Cutting Plane Visualization
	  (Default)
Figure 9: Cutting Plane Visualization (Default).


6.3 Isosurface Visualization

Selecting the Isosurface tab reveals options for generating an isosurface from the DT volume. As shown in Figure 10:

Figure: Isosurface Visualization.
Figure 10: Isosurface Visualization.

Just as planes can be used to clip the isosurface, the isosurface can be used to clip the planes. An example of this is shown in Figure 11. The isosurface value is set low (0.01), the "Show Isosurface" button is turned off, and the Planes tab has selected the Clip to Isosurface button.

Figure: Clipped Planes Visualization.
Figure 11: Clipped Planes Visualization.

6.4 Glyph Visualization

The Glyphs panel allows selection of the type, placement, and coloring of tensor glyphs within the volume. The default setting renders box glyphs, seeded on the planes and colored based on the principle eigenvector direction as shown in Figure 12. A zoomed-in figure of the super-quadric glyphs rendered on the cutting planes is shown in Figure 13. In addition to colored-box glyphs, the tensors can be rendered as RGB boxes, ellipsoids, or super-quadric glyphs. With the controls at the top of the panel, users can select the discretization level used for the round glyph shapes (which are approximated using triangular meshes), select whether to normalize the volume (to 1.0) of each tensor before rendering, and whether to scale the volume of each tensor, and whether to exaggerate the anisotropy of the tensor (and by how much). Finally, using the options in the "Seed At" frame, users can choose where to place the glyphs: at a single point (controlled by the position of a sphere widget in the Rendering window: use Shift-Left Mouse to select and move widgets), seeded along a line specified by a rake widget, seeded on the visible cutting planes, or seeded at the grid point located within the prescribed isovolume.

Figure: Glyph Box Visualization.
Figure 12: Glyph Box Visualization.

Figure: Super-quadric Glyph Visualization.
Figure 13: Super-quadric Glyph Visualization.

6.5 Fiber Visualization

As with tensor glyphs, seed locations and colorization options for rendering fibers within the brain can be selected. A variety of options are shown in Figure 14, Figure 15, and Figure 16. Additionally, a number of parameters can be set that control the fiber tracing algorithm. These parameters include:

Figure: Fiber Visualization.
Figure 14: Fiber Visualization.


Figure: Single Fiber.
Figure 15: Single Fiber.


Figure: Planes and Fibers.
Figure 16: Planes and Fibers.


Appendix A—Image Formats and Preparation

BioTensor supports NRRD, DICOM, and Analyze data formats. The NRRD, DICOM, and Analyze web sites describe their repspective formats in detail. This Appendix describes how DWI and B0 volume data should be prepared using these formats.

NRRD and DICOM files should be prepared as follows: The DWI volume should be constructed as a 4-dimensional array (several 3-D channel volumes stacked contiguously in memory). The reference data (B0) volume should consist of a 3-dimensional array with the same dimensions as one of the DWI channels. For example, for an axial scan with 128x256 in-plane resolution, 90 slices, and 12 diffusion-weightings, the DWI volume would be stored as one contiguous 12x128x256x90 dataset (in terms of data-ordering, the 90 axis is changing "fastest", i.e. the data is stored as 12 volumes (each 128x256x90) concatenated together into one big array), and the B0 volume would have dimensions 128x256x90.

BioTensor can also accept a single file containing the DWI volume and B0 image. For this case, select the "B0 Reference Data and DWI (single file)" radiobutton in the Load Data tab. When this load method is selected, users must also specify the number of DWI channels in the data and whether the volume is ordered so that the volumes are changing fastest (i.e 128.256x90x13) or the z slices are changing fastest (i.e. 13x128x256x90). When loading a single file containg the DWI and B0 data, the user must also indicate whether or not the B0 slices are located before or after the DWI slices.

For DICOM data, a collection of sequences (directories) that make up the DWI and reference volumes must be identified.

Appendix B—B-Matrix File Format

A B-Matrix data file is a plain text file with six numbers per line. Lines beginning with the pound character ("#") are treated as comments.

The six floating-point values per line convey the B-matrix for a single DWI.

The ordering of the B-matrix elements per line is: Bxx Bxy Bxz Byy Byz Bzz

The off-diagonal elements of the B-matrix have NOT been pre-multiplied by two. This multiplication is done internally, to account for how the off-diagonal elements of the diffusion tensor are actually weighted in each DWI.

Bottom Banner