Documentation‎ > ‎

Track-specific analysis and network measures

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 100,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 dsi_studio.app 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 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.  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.


STEP 6: Graph Visualization


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 [Optional] add white matter surface by (a) switching [slice:qa] to [slice: icbm_wm] in the left-hand ROI window, (b) [Slices][Add Isosurface][Full]. The opacity of the isosurface can be adjusted in the [Surface Rendering] option in the right-upper window.

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.






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



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 scipy.io.matlab 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

      F
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 Report

   
    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 Analysis Report]. 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 Statistics


    To get a quick statistics on the tractography, click on the main menu [Tracts][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:


Step 1: generate fiber tracts


The detail parameters used in fiber tracking is documented in another page. Although the fiber tracking procedure for TDI is identical to the commonly used practice. There are several tips that help to generate better TDI:

smaller step size
To generate TDI, a smaller step size is required to produce the good result. The default setting of step size used in DSI Studio is the 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.  

more fiber tracts
Increase the number of fiber tract to 5,000, depending on the memory space you have in your operation system. A Larger amount of fiber tracts 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.

turn off 3D rendering
Since the number of fiber tracts is set to a very high amount, the 3D rendering options need to be adjusted so that the fiber tracking won't be terminated due to the 3D rendering failure. In the right side rendering options, setting [tract]->[style]="line" and [tract]->[Tube detail]="coarse" may prevent premature termination of the fiber tracking.


Step 2: export TDI


To export TDI, use the function under menu->[Tracts]->[Export Tract Density]. 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 T1 images in DSI Studio. and export the TDI in the T1 space.


Reference:

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



ą
FA.JPG
(72k)
Fang-Cheng Yeh,
Mar 20, 2013, 9:37 AM
ą
TDI.PNG
(117k)
Fang-Cheng Yeh,
Apr 10, 2013, 2:38 PM
ą
fa1.jpg
(61k)
Fang-Cheng Yeh,
Mar 20, 2013, 9:37 AM
ą
plot.JPG
(133k)
Fang-Cheng Yeh,
Mar 20, 2013, 9:37 AM
Comments