Chapter 4 Example box: Seed-based correlation analysis


The aim of this exercise is to become familiar with some of the practicalities involved in a single subject SCA analysis.

This example is based on tools available in FSL, and the file names and instructions are specific to FSL. However, similar analyses can be performed in other neuroimaging software packages.

Please download the dataset for this example here:

Data download

The dataset you downloaded contains resting state fMRI data from a single subject, that has undergone preprocessing. In the example below, you will create an ROI of the posterior cingulate cortex, extract the ROI timeseries and perform SCA.

Please note that some of the commands in this example may take a few minutes (up to 5 minutes) to run.

Create the seed region of interest mask

Open a command line terminal and change directory into the directory you have downloaded called 'Data_4.1' (using cd). We are going to create a mask of the posterior cingulate cortex, that we will subsequently use to extract the timseries. To start, open FSLeyes:

fsleyes -std &

Now open the atlas panel via Settings -> Ortho View 1 -> Atlas panel, and enable the Harvard-Oxford cortical, and select the Atlas search tab in the atlas panel. Type cingulate in the text box above the structure list to filter the structures that are shown. Select Harvard-Oxford Cortical Structural Atlases on the left panel and then tick the box next to Cingulate gyrus, posterior division on the right panel. This will show the Harvard-Oxford probabilistic atlas for the posterior cingulate cortex.

Now select the image harvardoxford-cortical/prob/Cingulate Gyrus, posterior division in the Overlay list on the bottom left corner, and save the image to a file called PCC, and close FSLeyes. We will now create a binary mask by thresholding this image at 50 percent, using the following command:

fslmaths PCC -thr 50 -bin PCC

The end result of this is a file named PCC.nii.gz that we will use as a mask to extract the timeseries

The posterior cingulate cortex ROI we created is in standard space. So we first need to transform it into functional space before extracting the timeseries, which we can do using the following command (see the FSL wiki for more details):

applywarp -i PCC.nii.gz -r reg/example_func.nii.gz -o PCC_func --postmat=reg/highres2example_func.mat -w reg/highres2standard_warp_inv

This image may contain values other than zero or one, due to interpolation, so we need to make sure that the resulting image is binary (i.e., only has zero and one values), using the following command:

fslmaths PCC_func -bin PCC_func

Time series extraction

The next step of a seed-based correlation is to extract the mean timeseries from the ROI. We can do this using the following command. This creates a text file with the ROI timeseries.

fslmeants -i filtered_func_data.nii.gz -o PCC.txt -m PCC_func.nii.gz

Seed-based correlation analysis

There are several options to perform a seed-based correlation analysis. We are going to compare two options here. The first option is to use a simple matlab script to perform the seed-based correlation and z-transformation. We have written a simple script for you that you can use as follows. Firstly open matlab and navigate to correct directory (called 'Data_4.1'). Now run the following command in the matlab command line (if you want to to take a look at the matlab code then you can open SCA.m for further information). When it has finished, please close Matlab


The second option is to use dual regression, which can perform both the time series extraction and the seed-based correlation for you (actually using regression). Use the following command in the terminal to run this:

dual_regression PCC_func.nii.gz 0 -1 0 SCA_DR filtered_func_data.nii.gz

It is now time to load the results of our two analyses and compare them:

fsleyes -std  SCA_result.nii.gz -cm red-yellow -dr 0.5 1 \
SCA_DR/dr_stage2_subject00000.nii.gz -cm green -dr 1 3 &

The dual regression results are shown in green and the matlab results in red. As you can see, they are almost completely identical (although note that the specific values are diffent, because dual regression results are betas and matlab results are z-values after Fisher's r-to-z transformation). In this case, the map is showing the default mode network in this subject (similar to figure 4.1 in the primer).