BRAIN IMAGING

DATA STRUCTURE

The dataset for this tutorial is structured according to the Brain Imaging Data Structure (BIDS). BIDS is a simple and intuitive way to organize and describe your neuroimaging and behavioral data. Neuroimaging experiments result in complicated data that can be arranged in many different ways. So far there is no consensus how to organize and share data obtained in neuroimaging experiments. BIDS tackles this problem by suggesting a new standard for the arrangement of neuroimaging datasets.

The idea of BIDS is that the file and folder names follow a strict set of rules:

Using the same structure for all of your studies will allow you to easily reuse all of your scripts between studies. But additionally, it also has the advantage that sharing code with and using scripts from other researchers will be much easier.

Tutorial Dataset

The dataset for this tutorial is coming from https://openfmri.org/, a homepage dedicated to the free and open sharing of raw magnetic resonance imaging (MRI) datasets. We already downloaded the dataset ds102 into the data folder at the current location. To reduce the size of the total dataset, only the first five subjects (sub-01, sub-02, sub-03, sub-04, and sub-05) were kept.

So let's have a look at the tutorial dataset.


In [ ]:
!tree /data/ds102


/data/ds102
├── CHANGES
├── dataset_description.json
├── participants.tsv
├── README
├── sub-01
│   ├── anat
│   │   └── sub-01_T1w.nii.gz
│   └── func
│       ├── sub-01_task-flanker_run-1_bold.nii.gz
│       ├── sub-01_task-flanker_run-1_events.tsv
│       ├── sub-01_task-flanker_run-2_bold.nii.gz
│       └── sub-01_task-flanker_run-2_events.tsv
├── sub-02
│   ├── anat
│   │   └── sub-02_T1w.nii.gz
│   └── func
│       ├── sub-02_task-flanker_run-1_bold.nii.gz
│       ├── sub-02_task-flanker_run-1_events.tsv
│       ├── sub-02_task-flanker_run-2_bold.nii.gz
│       └── sub-02_task-flanker_run-2_events.tsv
├── sub-03
│   ├── anat
│   │   └── sub-03_T1w.nii.gz
│   └── func
│       ├── sub-03_task-flanker_run-1_bold.nii.gz
│       ├── sub-03_task-flanker_run-1_events.tsv
│       ├── sub-03_task-flanker_run-2_bold.nii.gz
│       └── sub-03_task-flanker_run-2_events.tsv
├── sub-04
│   ├── anat
│   │   └── sub-04_T1w.nii.gz
│   └── func
│       ├── sub-04_task-flanker_run-1_bold.nii.gz
│       ├── sub-04_task-flanker_run-1_events.tsv
│       ├── sub-04_task-flanker_run-2_bold.nii.gz
│       └── sub-04_task-flanker_run-2_events.tsv
├── sub-05
│   ├── anat
│   │   └── sub-05_T1w.nii.gz
│   └── func
│       ├── sub-05_task-flanker_run-1_bold.nii.gz
│       ├── sub-05_task-flanker_run-1_events.tsv
│       ├── sub-05_task-flanker_run-2_bold.nii.gz
│       └── sub-05_task-flanker_run-2_events.tsv
├── T1w.json
└── task-flanker_bold.json

15 directories, 31 files

As you can, we have five subjects, each with one anatomical T1w image and with two functional images, run-1 and run-2.

Behavioral Task

Subject from the ds102 dataset did the Flanker task in the scanner. They had to indicate with two buttons the direction of a central arrow in an array of 5 arrows. In congruent trials the flanking arrows pointed in the same direction as the central arrow (e.g., < < < < <), while in more demanding incongruent trials the flanking arrows pointed in the opposite direction (e.g., < < > < <).

To each of the functional images above, we therefore also have a tab-separated values file (tva), containing information such as stimuli onset, duration, type, etc.

So let's have a look at one of them:


In [ ]:
!cat /data/ds102/sub-01/func/sub-01_task-flanker_run-1_events.tsv


onset  duration  trial_type           response_time  correctness  StimVar  Rsponse  Stimulus     cond
0.0    2.0       incongruent_correct  1.095          correct      2        1        incongruent  cond003
10.0   2.0       incongruent_correct  0.988          correct      2        1        incongruent  cond003
20.0   2.0       congruent_correct    0.591          correct      1        1        congruent    cond001
30.0   2.0       congruent_correct    0.499          correct      1        1        congruent    cond001
40.0   2.0       incongruent_correct  0.719          correct      2        1        incongruent  cond003
52.0   2.0       congruent_correct    0.544          correct      1        1        congruent    cond001
64.0   2.0       congruent_correct    0.436          correct      1        1        congruent    cond001
76.0   2.0       incongruent_correct  0.47           correct      2        1        incongruent  cond003
88.0   2.0       congruent_correct    0.409          correct      1        1        congruent    cond001
102.0  2.0       incongruent_correct  0.563          correct      2        1        incongruent  cond003
116.0  2.0       congruent_correct    0.493          correct      1        1        congruent    cond001
130.0  2.0       congruent_correct    0.398          correct      1        1        congruent    cond001
140.0  2.0       congruent_correct    0.466          correct      1        1        congruent    cond001
150.0  2.0       incongruent_correct  0.518          correct      2        1        incongruent  cond003
164.0  2.0       incongruent_correct  0.56           correct      2        1        incongruent  cond003
174.0  2.0       incongruent_correct  0.533          correct      2        1        incongruent  cond003
184.0  2.0       congruent_correct    0.439          correct      1        1        congruent    cond001
196.0  2.0       congruent_correct    0.458          correct      1        1        congruent    cond001
208.0  2.0       incongruent_correct  0.734          correct      2        1        incongruent  cond003
220.0  2.0       incongruent_correct  0.479          correct      2        1        incongruent  cond003
232.0  2.0       incongruent_correct  0.538          correct      2        1        incongruent  cond003
246.0  2.0       congruent_correct    0.54           correct      1        1        congruent    cond001
260.0  2.0       incongruent_correct  0.622          correct      2        1        incongruent  cond003
274.0  2.0       congruent_correct    0.488          correct      1        1        congruent    cond001