Extracting RoI BOLD signal of fMRI dataset by using CONN toolbox, using OASIS3 as an example

This blog is a hand-by-hand tutorial for researchers who in ACMLab to process MRI data. In the meantime, make an effort for the development of the computational neuroimaging field. 

Install Software

  1. Matlab. 
  2. CONN toolbox (Download .zip: link. Source page: link). Unzip it.
  3. SPM (Download .zip: link. Source page: link). Unzip it.
  4. Start Matlab, click on the 'Set path' button, then click on 'Add folder', and select your CONN installation folder (e.g. /software/conn). After this, click again on 'Add folder' and now select the SPM installation folder (e.g. /software/spm12). Click on 'Save' and 'Close' to save these changes for future Matlab sessions
  5. Install python
    • Install a miniconda and python
    • Create an environment. Activate it.
    • Use `pip install nibabel numpy scipy`

I. What data do you have: The input

Briefly, you need to collect all paths of the input T1w and fMRI volume, and remap the raw atlas label to 1~N with the corresponding label name in .txt file.

One input of CONN toolbox is termed as `Subject`. It has one T1w and multiple fMRI.

a. One T1-weighted (T1w) MRI volume (3D) for each subject.

For each subject, one T1w volume is enough.  You need to check the T1w you are collecting is in a valid format by reading the file header, like orientation and dimension. 
For example, OASIS3 T1w volume's orientation is indicated by header['qform_code'] == 1. And, the volume file name with 'echo' means it is 2D, which is not valid. 
Collect all paths in a file, where each line is one T1w of a subject.

    2. At least one functional MRI volume (4D) at rest state or any task.

    There might be multiple sessions and runs of fMRI scans for each subject. The pipeline requires the fMRI in one `subject` to have the same shape. So, you need to check the header['dim'] of each fMRI to be the same. Otherwise, let it be a new `subject` with corresponding T1w volume. 
    After data paths of T1w and fMRI are collected, you need to make sure how many fMRI sessions are matched to one T1w volume. And save those numbers.

    3. Any atlas label volume (3D) in the MNI space, along with the look-up table.

    Raw atlas files vary and depend on publishers. They might be in the surface format, if so, you need to convert it to volume first. Then, let the original label ID of the atlas volume remap to [1, N], where N is the number of RoI. Along with the remapped atlas, the label name needs to be generated into a Txt file as the template in CONN toolbox.

    II. CONN step #1

    a. Load the path of T1w, fMRI, and RoI

    copy path of subjects into CONN toolbox

    b. Registration, segmentation

    click preprocessing.

    c. Extract RoI

    click Done

    III. CONN step #2

    a. Set all RoIs for the following process

    Choose all RoIs in the list.

    b. Regression RoIs

    click Done.

    c. Check output

    We are done with CONN toolbox part. Go to the output directory and check this path. 

    IV. Get the output

    a. BOLD timeseries are saved in .mat files.