Track-specific analysis and network measures

Shape analysis and tract statistics

[Step T3 Fiber Tracking][Tracts][Statistics] provides values extracted from shape analysis and diffusion metrics.

Shape analysis uses the topology information from tractography streamlines to derive length, area, volume, and shape descriptors. The analysis quantifies macroscopic structural features of fiber pathways.

The details of the shape metrics are documented at
The details of the diffusion metrics are documented at Diffusion MRI Metrics

Connectivity matrix and graph analysis

DSI Studio is able to generate a connectivity matrix and calculate network measures. The following are the steps for generating a connectivity matrix. 
There are several approaches to get the network measures: 
  • Approach 1: GQI reconstruction + diffusion-space tracking + DSI Studio built-in atlas
         This approach is the most straightforward one, but may a higher variance due to atlas-subject misalignment and tracking bias due to brain morphology. This approach first uses GQI to reconstruct data in the subject's DWI space and then runs whole-brain fiber tracking. DSI Studio will do a background normalization to bring atlas to the subject space to calculate network measures. 
  • Approach 2: QSDR reconstruction + MNI-space tracking + Brain parcellation Atlas in MNI:
This approach is mostly used by Danielle Bassett's group (search "Bassett DSI Studio" in google scholar). The advantage is that the tracking is done in the MNI space, and thus not biased by the shape of the brain. The downside is that a uniform brain segmentation is used for all subject and does not consider individual differences.

  • Approach 3: GQI reconstruction to T1W space + T1W-space tracking + T1W-based brain parcellation:
This approach handles the individual difference in brain parcellation, but fiber tracking is done in the native space. The diffusion data is reconstructed to subject's T1W space so that all following analysis is in the T1W coordinates. The brain parcellation can be from FreeSurfer parcellation of the T1W.

The following is the step-by-step details

STEP 1: Reconstruction

You may use GQI or QSDR reconstruction to get the FIB files for fiber tracking. The GQI reconstruction can be reconstructed to subjects T1W space following the instruction here.

STEP 2: Whole brain fiber tracking

The first step is to get a whole brain fiber track using Fiber Tracking without assigning any ROI/ROA. To do this, open the FIB file in [STEP1 Fiber Tracking] and change the number of seed points using the windows to the right upper corner. Under [Tracking Parameter] change [Terminate If] to 10,000,000 [Seeds] and then click on the [Fiber Tracking] button. DSI Studio will generate a large amount of whole brain tracks in this step.

STEP 3: Brain parcellations

A brain parcellation map is required to generate the connectivity matrix. If you would like to use built-in atlas provided in DSI Studio to generate connectivity matrix, there is nothing you need to do after fiber tracking. You can open connectivity matrix dialog at [Tracts][Connectivity matrix]. DSI Studio will conduct a spatial normalization to ensure that the atlas is registered with the subject data. To check whether the linear transformation agrees well, you may open up the registration result using [View][Background registration].

If you would like to use your own parcellation map, and the map is in the MNI space, you may place the the map NIFTI file in the /atlas subfolder under DSI Studio package (In Mac, you may need to open the package to see the folder). The ROIs will be included in the atlas database for you to calculate the connectivity matrix.

If your ROIs are in the native space, you can load the NIFTI file in the region list using [Regions][Open Region] (This steps should be done AFTER you have whole-brain fiber tracking done) and then check all ROIs using [Regions][Check all]. Once the ROIs are loaded in the region, you can bring up the connectivity windows by [Tracts][Connectivity matrix].

STEP 4: Connectivity matrix

The connectivity matrix dialog allows users to change the parameters for calculating the connectivity matrix. 
The connectivity matrix can be calculated by accounting the number of tracts that pass two ROIs (select "count" as matrix value). This number can be normalized by the median length (select "ncount" as matrix value) or multiplied by the sum of the inverse of the length (select "ncount2")

The FA, QA, or ADC sampled by the tracks can also be used as the matrix entry (e.g. select "fa", "qa", or "adc" as the matrix value). There is a drop-down list in the connectivity window. One is "end in region", which counts only the final connecting region. Another one is "pass region", which counts all the regions passed.

The threshold is used to filter out matrix entries with a small number of connecting track. It is a ratio to the maximum connecting tracks in the connectivity matrix.

Network measures will be calculated and listed in the second tab for further analysis (group comparison, regression...etc.)

STEP 5: Network analysis

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 analyze 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 follow the implementation of the brain connectivity toolbox ( The explanation of the network measures can be found here.  You may also refer to Bullmore, E. and O. Sporns (2009). "Complex brain networks: graph theoretical analysis of structural and functional systems." Nat Rev Neurosci 10(3): 186-198. for details.

For binary measures, the connectivity matrix will be thresholded by a track count in proportional to the max count in the connectivity matrix to make it binary. For example, if the largest count in the connectivity matrix is 100,000 and the threshold is 0.01, then an entry with at least 1,000 track count will be set to 1, and any value fewer will be zeroed.

For weighted measures, the connectivity matrix will be normalized so that the maximum value of the matrix is one.

After getting the network measures in the text file, you may use python scripts to extract information. e.g.,

STEP 6: Graph Visualization

DSI Studio provides a 3D graph presentation to visualize the graph structure. There are two ways to present this graph

Approach1: using MAT file generated from DSI Studio

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 fiber tracking window, on the top menu, use [View][Visualize Graph] to load the connectivity matrix mat file.

Approach2: using customized MAT file or Text file with user-defined regions

1. In [step T3 Fiber tracking], load regions using [Region][Open Region]. If your matrix is 100 by 100, then there should be 100 regions.
2. Prepare connectivity matrix in a text file (space-separated or tab-separated values) or a mat file (use -v4 to save the mat file, and the matrix should be named "connectivity")
3. Load the matrix using [View][Visualize Graph]

*TIP: You can assign positive and negative values to the matrix, DSI Studio will show them in red and blue colors.
*TIP: There are rendering options for graph under [Step T3c: Option][Region Rendering]

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: 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.


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.

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);...

[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]);

Loading connectivity matrix in MATLAB

The calculated matrix can be exported as mat file or figures file. In the mat file, the connectivity matrix is stored as an n-by-n "connectivity" matrix, whereas the region labels are stored in the "name" matrix. To recover the list of the region labels, use the following command in Matlab
labels = textscan(char(name),'%s');

Here's the python code for getting the labels:

from import loadmat
m = loadmat("connectivity.mat")
names = "".join(m["name"].view("S4")[0]).split("\n")

Track Specific Analysis: Export along track index

     The fiber trajectories are sequences of 3D coordinates. DSI Studio uses these coordinates to sample the index like FA and ADC. The along-track sampling samples one value for each coordinate in a trajectory. The data arrangement is similar to that of the tract coordinate TXT file.

    To export the sampled data, right click on the tracks (usually has a named like "Tract 1") shown in the widget to the right. Select [Save Index] and choose the index to be saved. The output example is shown in 
the following.
The tract text file output by DSI Studio

or each coordinate on a trajectory, DSI Studio calculates the index using trilinear interpolation. The calculated values of a trajectory are exported as a sequence of numbers in a line. The values are separated by space. The first value is the first coordinate of the first trajectory, as shown in the following.

    [index at 1st coordinate 1st tract] [index at 2nd coordinate 1st tract]...
    [index at 1st coordinate 2nd tract] [index at 2nd coordinate 2nd tract]...
    [index at 1st coordinate 3rd tract] [index at 2nd coordinate 3rd tract]...

Tract Profile


    DSI Studio provides a report interface that visualizes the quantitative index of a generated tractography. The generated plot and data can be exported as image or text value data.

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

X direction, Y direction, and Z direction

An example of corticospinal tract viewed from the anterior

Result obtained from X-direction sampling

    For X-direction, the coordinates of all tracks are projected to X axis simultaneously, and the averaged values along the x-direction are estimated using kernel density estimator with bandwidth specified in the interface.The unit of the bandwidth in at the scale of a voxel size. The sampling strategies for y-direction and z-direction are conducted similarly.

Fiber orientation

    All fiber tracts are stretched to the same length, and the sampling starts from one end to another. The sampled values are regressed using kernel density estimator with the bandwidth specified in the interface.

Illustration of the fiber stretch strategy for index sampling.

Mean of each fiber

    The mean value of the index is calculated for each fiber tract first, and all the values are plotted.

Tract Density Imaging

Tract density imaging (TDI) was introduced by Calamante et al. [1]. TDI was shown to achieve higher resolution and facilitate the visualization of smaller structures. 
DSI Studio offers the function under [Tracts][Save Tract Density] to export tract density imaging after tractography is generated. 

Step 1: generate fiber tracts

The first step is to generate tractography as described on another page

In addition, here additional tips that help to generate better TDI:

1) smaller step size
To generate TDI, a smaller step size is required to produce a good result. The default setting of step size used in DSI Studio is half of the voxel size. This setting has to be changed to 1/8 voxel size in order to achieve a subvoxel resolution of 1/4 voxel size.  

2) more fiber tracts
A Larger amount of fiber tracts (e.g. 10,000 for human study) tends to generate better TDI. 
Another way to include more fiber is to generate multiple TDI and average them together. This may offer the same effect of generating a huge equivalent amount of fiber tracts. You may want to export TDI in MATLAB's mat format and use Matlab to perform the average.

Step 2: export TDI

Use [Tracts][Save Tract Density] to save TDI. There are three options under this submenu

TDI in diffusion space
The first option is exporting the TDI in the diffusion space, which does not use the subvoxel resolution. 

TDI in subvoxel diffusion space
The second one exports TDI in a 4-times higher spatial resolution than the current diffusion space.

TDI in current slice space
You may load a T1w image in DSI Studio. and export the TDI in the T1 space.


[1]. Calamante, F., Tournier, J.D., Jackson, G.D., Connelly, A., 2010. Track Density Imaging (TDI): Super-resolution white matter imaging using whole-brain track-density mapping. Neuroimage 53, 1233-1243.

Frank Yeh,
Mar 20, 2013, 9:37 AM
Frank Yeh,
Apr 10, 2013, 2:38 PM
Frank Yeh,
Mar 20, 2013, 9:37 AM
Frank Yeh,
Mar 20, 2013, 9:37 AM