Diffusion MRI data analysis with DSI Studio

A.Lee

DSI Studio is an open-source diffusion MRI analysis tool
that maps brain connections and correlates findings with neuropsychological disorders.
It is a collective implementation of several methods, including DTI, QBI, DSI, generalized
q-sampling imaging, q-space diffeomorphic reconstruction, diffusion MRI connectometry, and
generalized deterministic fiber tracking.

Background

1. The self-diffusion of water molecules follows the Brownian motion in the organ (brain).

Self-diffusion and Brownian motion
source: https://en.wikipedia.org/wiki/Brownian_motion

2. Spin echo

Spin echo
source:http://dsi-studio.labsolver.org/course/diffusion-mri-signals

3. Diffusion NMR

The effect of diffusion on the MR signal was mentioned by Hahn in 1950.

The diffusion coefficient can thus be measured by acquiring diffusion signals with difference gradient strength |g|.

Diffusion NMR
source: Sosnovik, D. E., Wang, R., Dai, G., Reese, T. G., & Wedeen, V. J. (2009). Diffusion MR tractography of the heart. Journal of Cardiovascular Magnetic Resonance, 11(1), 1-15. link

4. Diffusion MRI: a combination of diffusion NMR and MRI

Apparent diffusion coefficient and b-value


whereas S is the DWI signal. S0 is the DWI signals without diffusion weighting (also known as the b0 signal)

The apparent diffusion coefficient, as explained by its naming, is the diffusion coefficient “appearing” from the observation of a heterogeneous environment (e.g. biological tissues).

Diffusion tensor imaging


Figure: Jellison, Brian J., et al. "Diffusion tensor imaging of cerebral white matter: a pictorial review of physics, fiber tract anatomy, and tumor imaging patterns."American Journal of Neuroradiology 25.3 (2004): 356-369.

Diffusion MRI fiber tracking

  1. Start at a point in the white matter region
  2. Propagate in one direction with a step size
  3. Estimate the next propagation direction and repeat 2 until a termination criteria is met
  4. Redo 1-3 but propagate at the opposite direction


source: http://jmahaffy.sdsu.edu/courses/f00/math122/lectures/num_method_diff_equations/nummethod_diffeq.html

There are numerous variants of the deterministic fiber tracking, and they can be further classified by the following feature.

There are parameters affecting tracking results.

The following is a list of the region types.

DTI measures

A diffusion tensor can provide fractional anisotropy (FA), axial diffusivity (AD), radial diffusivity (RD), and mean diffusivity (MD).

Diffusion orientation distribution function (dODF)

Diffusion MRI acqusition

Processing Diffusion MRI datasets

Read DICOM, NIFTI, Bruker 2dseq, or Varian FDF Files

  1. DICOM Format, including image acquired by SIEMENS TIM, SIEMENS Trio, GE SIGNA HDx, and Philips 4D DICOM.

  2. Analyze format, Nifti format, 3D volume or 4D volume (diffusion space as the highest dimension order)

  3. Bruker 2dseq files

  4. Varian and Agilent FDF files

the plan of software

source images

Before using the DICOM files, I would recommend rename them using [Tool: Batch processing][Rename DICOM files] and select all the DICOM files that are ready to be renamed, and then the file will be moved into its related folders. You may also use [Rename DICPOM in subfolders] to assign a root folder containing all DICOM files to be sorted. DSI Studio will rename DICOM files and place them in different folders according to their pulse sequences (see figure to the right).

rename files

Check b vector or add b vector

b-vector

Quality Control for SRC files

It is recommend that the SRC files are examined by a quality control procedure to ensure its integrity and quality. To do this, use [Tools: Batch Processing][SRC Files Quality Control] and select the folder that contains SRC files (DSI Studio will search for all SRC files in the subdirectories).

Data reconstruction

Introduction to diffusion MRI methods

Open DSI Studio and press the “step 2: reconstruction” button in the main project window to select the .src file. DSI Studio will present a reconstruction window as shown in the figure to the right.

STEP1: Setup a Mask

mask

Recommendation steps include thresholding, smoothing, and defragment.

STEP2: Select a Reconstruction Method

mathods

The meaning of the diffusion indices can be found here: https://sites.google.com/a/labsolver.org/dsi-studio/course/diffusion-mri-connectomics?pli=1#TOC-Introduction-to-diffusion-Indices.

Diffusion MRI fiber tracking

The steps to create a tractography are as follows

  1. Assign regions as seeding areas/region of interest/region of avoidance/ending regions.
  2. Setup tracking options
  3. Start tracking

Step1. Assign Regions

DSI Studio provides a handy list of atlases that can be added to the region list. Users can add a known anatomy by click on the “atlas” button in the “Region List” window. The atlas is mapped to subject space by nonlinear registration between the anisotropy map and the atlas included in the DSI Studio package.

The atlases include the following:

There are several region types available to control fiber tracking

  1. Seed
  2. Randomize Seeding
  3. Region of interest (ROI) & region of avoidance (ROA)
  4. End region & terminative region

Step2. Setup Tracking Parameters

parameter setting

Step3. Perform fiber tracking and save tract coordinates

  1. Use “whole brain seeding” always. DSI Studio will assign whole brain seeding if you do not specify a seed region. Please note that the tracking algorithm starts from the seeding point and track in two directions until it reaches the ending points. In most of the cases, the seeding point is not the end points of the trajectory.

  2. To track trajectories connecting between two brain regions, place two “end” regions, one on each of them. DSI Studio will find the trajectories that end in these two regions.

  3. An “end” region is more restrictive than a “roi”. A “roi” allows tracks to pass through, whereas the end region requires that the trajectories end in them. If you cannot find connections using two end regions, try setting them as roi.

  4. To force track to terminate if the anisotropy threshold is “greater” than a value. First, set up the threshold to the designated value and place whole brain seed by [Regions][Whole Brain Seeding]. In the region list window, change the region type from “Seed” to “Terminative”. This will enforce a termination if tracks enter the region. Adjust the threshold to a lower value to initiate fiber tracking.

Shortcuts and Controls

In the ROI window:

Key “Q” and “A”: move sagittal slide
Key “W” and “S”: move coronal slide
Key “E” and “D”: move axial slide
Key “Z”: switch to sagittal view
Key “X”: switch to coronal view
Key “C”: switch to axial view

Double click: move slices to the pointed location

In the 3D window

Mouse left button: press and rotate the object
Mouse right button: press and change the zoom scale
Mouse mid button: press and move the object (you may also use direction keys to move the object)

Ctrl+A: move ROI or slides in the 3D window (drag)

rack editing

The following four shortcuts are for tract editing. To edit the tracts, 1) hit the shortcut 2) press left mouse button 3) drag the cursor 4) release the mouse button. If the track selection further considers the income angle, use right mouse button instead. (please refer to here for details)

Ctrl+S: select tracts in the 3D window
Ctrl+D: delete tracts in the 3D window
Ctrl+P: delete tracts in the 3D window
Ctrl+X: cut tracts in the 3D window (click-drag-release)(cannot undo)
Ctrl+T: trim tracts
Ctrl+Z: undo select and delete
Ctrl+Y: redo select and delete

Connectivity matrix and graph analysis

STEP 1: Reconstruction
STEP 2: Whole brain fiber tracking
STEP 3: Brain parcellations
STEP 4: Connectivity matrix

matrix

STEP 5: Network analysis

network
In the connectivity matrix dialog, switch to the “network measures” tab (as shown in the figure) to view the results of graph theoretical analysis.

Graph theoretical analysis views brain connections as a graph and applied graph-based measures to analysis it. A graph is defined as a set of nodes or vertices and the edges or lines between them. Its topology can be quantitatively described by a wide variety of measures, including network characteristic path length, clustering coefficient, global efficiency, and local efficiency. The network measures in DSI Studio follows the implementation of brain connectivity toolbox (https://sites.google.com/site/bctnet/). The explanation of the network measures can be found here.

STEP 6: Graph Visualization

brainnetwork

DSI Studio provides 3D graph presentation to visualize the graph structure. The following is a list of steps to present this graph

  1. Save the connectivity matrix from the connectivity dialog using the “save matrix” button. The output will be a MATLAB mat file.
  2. Back to the main window, click [STEP3 Fiber Tracking] and open HCP1021.2mm.fib.gz (provided in the DSI Studio folder in the windows version)(for THE Mac version, right click on dsi_studio.app to show package content, find the file in the /Content/MacOS/ folder)
  3. On the top menu, use [View][Graph Visualization] to load the connectivity matrix mat file.
  4. On the right upper corner, switch [Region Rendering][Graph] to “on” to see the graph visualization
  5. Add white matter surface using the steps here.

STEP 7: Plot connectogram

To create the connectogram, in the connectivity dialog, click on the button named “save connectogram” and save a text file. Open the website: http://mkweb.bcgsc.ca/tableviewer/visualize/. In “2A. UPLOAD YOUR FILE”, choose the text file and check “col with row size” and “row with col size” (see below). Click on visualize table to get the connectogram figure.

connectom
source: http://circos.ca/tutorials/lessons/recipes/cortical_maps/img/02.png

Batch processing

Here’s the script I used in the Windows system. Save this as a *.bat file and put it inside a folder where the FIB files are placed and execute it.

path=C:\WHERE_YOUR_DSI_STUDIO_FOLDER_IS\dsi_studio_64
for /f "delims=" %%x in ('dir *.fib.gz /b /d /s') do (
    call dsi_studio.exe --action=trk --source="%%x" --seed_count=1000000 --thread_count=8 --output=no_file --connectivity=AAL > "%%x.log.txt")

Once the network measure files are generated. You can use [Tool: Batch Processing][Parse Network Measure Text Files] and select all *.AAL.count.end.network_measures.txt files to collect all results into one single data sheet.

The following MATLAB code can be used to plot boxplots for each network measure: The c_values and d_values are matrices retrieved from the collected network measures.

clear figure;
for i=1:18
values = [c_values(i,:);d_values(i,:)];
labels = [repmat('c',length(c_values(i,:)),1);...
          repmat('d',length(d_values(i,:)),1)];

boxplot(values,labels,'whisker',10);
[h,p,ci,stats] = ttest(c_values(i,:),d_values(i,:))
set(gcf, 'Position', [200, 200, 400, 600]);
set(gcf, 'PaperSize', [2 3]);
set(gcf, 'PaperPosition', [0 0 2 3]);
print(gcf,'-dtiff','-r300',strcat(int2str(i),'.tif'));
end

# Loading connectivity matrix in MATLAB
labels = textscan(char(name),'%s');

#Here's the python code for getting the labels:
from scipy.io.matlab import loadmat
m = loadmat("connectivity.mat")
names = "".join(m["name"].view("S4")[0]).split("\n")

Tract Report

To invoke the interface, use the main menu [Tracts][Tract Analysis Report]. The options in the interface are detailed in the following.

tract report
An example of corticospinal tract viewed from the anterior


Result obtained from X-direction sampling

Tract Statistics

To get a quick statistics on the tractography, click on the main menu [Tracts][Statistics].

statistics

Tract Density Imaging

Tract density imaging (TDI)was introduced by Calamante et al. [1]. TDI was shown to achieve higher resolution and to facilitate the visualization of smaller structures. DSI Studio offers the function that exports tract density imaging after tractography is generated. The procedures are the following:

Command line interface of DSI Studio

 A python script and some BASH scripts for running DSI studio: https://github.com/GlennRFox/DSI_Studio

Example studies with DSI studio

Case1:

Region-based analysis(Manually or using an atlas to define a study region and analysis the average of diffusion indices)

study

source: Zhang, Junying, Yunxia Wang, Jun Wang, Xiaoqing Zhou, Ni Shu, Yongyan Wang, and Zhanjun Zhang. “White matter integrity disruptions associated with cognitive impairments in type 2 diabetic patients.” Diabetes 63, no. 11 (2014): 3596-3605.

Case2

Tract-based analysis(Use diffusion MRI fiber tracking to obtain the track trajectories and average diffusion indices along the pathways.)


source: Advanced NTUH MRI Lab, http://abmri.mc.ntu.edu.tw/en/technique.php

Case3

Voxel-based analysis (VBA)(Spatially transform the mapping of diffusion indices to the standard space and calculate statistics voxel-by-voxel.)

##Case4

Tract-based spatial statistics (TBSS)(TBSS projects voxel-based indices to a “skeleton” and analyze them.)—FSL

tbss

Connectometry and ConnectomeFingerprint

Create a connectometry database

STEP1: Reconstruct data in the MNI space

Store the image files using the following tree structure. The image data of each subject should be stored by a folder named by his/her subject ID, and all the folders are placed under a common study folder.

[study x] -> the study folder storing all the study files
|-[001] -> the subject folder storing the image file of subject 001
|-[002] -> the subject folder storing the image file of subject 002

STEP1b: Batch create the SRC files

STEP1c: Check SRC files

STEP1d: Reconstruct all image data

STEP1e: Post-reconstruction quality check

STEP2: Create a connectometry database

  1. In the connectometry toolbox, click “Step 1: create connectometry database”.

  2. Click the [Search in Directory] and select the study folder. You may also use the “Add” button to select individual FIB file. You can change the order of the files by the “up”, “down”, “sort” button. You can save/load a list of the SRC files.

  3. Assign the atlas file (skip if a default file is assigned). I recommend using the latest HCP 842 atlas, which is available at Atlas and sample images. The latest version of DSI Studio has it shipped with the package and will load it as the default. Using the default HCP842 template meaning that the HCP subjects (young aged adult) can be representative to your subject pool. If this is not true, you should consider create your own atlas. The choice depends entirely on your study and subject pool.

  4. Assign “Index of interest” (skip if using SDF as the default): You can also study other diffusion measures such as FA, AD, RD, MD, RDI, NRDI (see here for explanation for each index) using connectometry. If you only see SDF in the selection, please update DSI Studio and re-run STEP1d of this page to reconstruct SRC files again. (or feel free to contact me if still not solved).

  5. Specify the output file name.

    Please assign the file extension as *.db.fib.gz

  6. Click the “Create Database” button to create the connectometry database as a db.fib.gz file. You can add or remove subjects from the database using [Diffusion MRI Connectometry][Edit Connectometry Database]

  7. Once you have the connectometry database, you can run group connectometry.

This brings up the following dialog.

Group connectometry analysis

The total pipeline of group connectometry analysis:

STEP 1: Data Reconstruction
STEP 2: Handle Longitudinal Scans (if applicable)
STEP 3: Group Connectometry
STEP 4) Visualize results and report finding

Visualization

Summary

This tutorial of diffusion MRI data analysis is strongly based on official document of DSI Studio, link http://dsi-studio.labsolver.org/Manual.