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

For this tutorial we will be using a subset of an fMRI dataset publicly available on openfmri.org. We will use Datalad to download a subset of this dataset, via the datalad repository. In order to install dataset with all subrepositories you can run:


In [ ]:
%%bash
cd /data
datalad install -r ///workshops/nih-2017/ds000114

In order to download data you can use datalad get foldername command, to download all files in the folder foldername. For this tutorial we only want to download part of the dataset, i.e. the anatomial and the first functional images:


In [ ]:
%%bash
cd /data/ds000114
datalad get sub-*/ses-test/anat
datalad get sub-*/ses-test/func/*fingerfootlips*
datalad get derivatives/fmriprep/sub-*/anat
datalad get derivatives/fmriprep/sub-*/ses-test/func/*fingerfootlips*

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


In [ ]:
!tree -L 4 /data/ds000114/


/data/ds000114/
├── CHANGES
├── dataset_description.json
├── derivatives
│   ├── fmriprep
│   │   ├── mni_icbm152_nlin_asym_09c
│   │   │   ├── 1mm_brainmask.nii.gz
│   │   │   ├── 1mm_eyemask.nii.gz
│   │   │   ├── 1mm_facemask.nii.gz
│   │   │   ├── 1mm_headmask.nii.gz
│   │   │   ├── 1mm_parc.nii.gz
│   │   │   ├── 1mm_PD.nii.gz
│   │   │   ├── 1mm_PD_orig.nii.gz
│   │   │   ├── 1mm_T1.nii.gz
│   │   │   ├── 1mm_T1_orig.nii.gz
│   │   │   ├── 1mm_T2.nii.gz
│   │   │   ├── 1mm_T2_orig.nii.gz
│   │   │   ├── 1mm_tpm_csf.nii.gz
│   │   │   ├── 1mm_tpm_gm.nii.gz
│   │   │   ├── 1mm_tpm_wm.nii.gz
│   │   │   ├── 2mm_brainmask.nii.gz
│   │   │   ├── 2mm_eyemask.nii.gz
│   │   │   ├── 2mm_facemask.nii.gz
│   │   │   ├── 2mm_headmask.nii.gz
│   │   │   ├── 2mm_parc.nii.gz
│   │   │   ├── 2mm_PD.nii.gz
│   │   │   ├── 2mm_T1.nii.gz
│   │   │   ├── 2mm_T2.nii.gz
│   │   │   ├── 2mm_tpm_csf.nii.gz
│   │   │   ├── 2mm_tpm_gm.nii.gz
│   │   │   ├── 2mm_tpm_wm.nii.gz
│   │   │   └── scripts
│   │   ├── sub-01
│   │   │   ├── anat
│   │   │   ├── ses-retest
│   │   │   └── ses-test
│   │   ├── sub-01.html
│   │   └── sub-02...sub-10
│   └── freesurfer
│       ├── fsaverage
│       │   ├── label
│       │   ├── mri
│       │   ├── mri.2mm
│       │   ├── scripts
│       │   ├── surf
│       │   └── xhemi
│       ├── fsaverage5
│       │   ├── label
│       │   ├── lh.reg.template.tif
│       │   ├── mri
│       │   ├── rh.reg.template.tif
│       │   ├── scripts
│       │   ├── stats
│       │   └── surf
│       ├── sub-01
│       │   ├── label
│       │   ├── mri
│       │   ├── scripts
│       │   ├── stats
│       │   ├── surf
│       │   └── touch
│       └── sub-02...sub-10
├── dwi.bval
├── dwi.bvec
├── sub-01
│   ├── ses-retest
│   │   ├── anat
│   │   │   └── sub-01_ses-retest_T1w.nii.gz
│   │   ├── dwi
│   │   │   └── sub-01_ses-retest_dwi.nii.gz
│   │   └── func
│   │       ├── sub-01_ses-retest_task-covertverbgeneration_bold.nii.gz
│   │       ├── sub-01_ses-retest_task-fingerfootlips_bold.nii.gz
│   │       ├── sub-01_ses-retest_task-linebisection_bold.nii.gz
│   │       ├── sub-01_ses-retest_task-linebisection_events.tsv
│   │       ├── sub-01_ses-retest_task-overtverbgeneration_bold.nii.gz
│   │       └── sub-01_ses-retest_task-overtwordrepetition_bold.nii.gz
│   └── ses-test
│       ├── anat
│       │   └── sub-01_ses-test_T1w.nii.gz
│       ├── dwi
│       │   └── sub-01_ses-test_dwi.nii.gz
│       └── func
│           ├── sub-01_ses-test_task-covertverbgeneration_bold.nii.gz
│           ├── sub-01_ses-test_task-fingerfootlips_bold.nii.gz
│           ├── sub-01_ses-test_task-linebisection_bold.nii.gz
│           ├── sub-01_ses-test_task-linebisection_events.tsv
│           ├── sub-01_ses-test_task-overtverbgeneration_bold.nii.gz
│           └── sub-01_ses-test_task-overtwordrepetition_bold.nii.gz
├── sub-02...sub-10
├── task-covertverbgeneration_bold.json
├── task-covertverbgeneration_events.tsv
├── task-fingerfootlips_bold.json
├── task-fingerfootlips_events.tsv
├── task-linebisection_bold.json
├── task-overtverbgeneration_bold.json
├── task-overtverbgeneration_events.tsv
├── task-overtwordrepetition_bold.json
└── task-overtwordrepetition_events.tsv

218 directories, 210 files

As you can, for every subject we have one anatomical T1w image, five functional images and one diffusion weighted image. In addition, we have directory with derivatives.

Note: If you used datalad or git annex to get the dataset, you can see symlinks for the image files.

Behavioral Task

Subject from the ds000114 dataset did five behavioral tasks. In our dataset two of them are included.

The motor task consisted of finger tapping, foot twitching and lip poaching interleaved with fixation at a cross.

The landmark task was designed to mimic the line bisection task used in neurological practice to diagnose spatial hemineglect. Two conditions were contrasted, specifically judging if a horizontal line had been bisected exactly in the middle, versus judging if a horizontal line was bisected at all. More about the dataset and studies you can find here.

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/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-linebisection_events.tsv


onset		duration	weight	trial_type
24.3065		1		1.0	Incorrect_Task
25.9465		1		1.0	Correct_Task
27.5865		1		1.0	Correct_Task
29.2265		1		1.0	No_Response_Task
30.8664		1		1.0	Incorrect_Task
32.5064		1		1.0	No_Response_Task
34.1464		1		1.0	Correct_Task
35.7864		1		1.0	Incorrect_Task
37.4264		1		1.0	Correct_Task
39.0664		1		1.0	Incorrect_Task
56.973		1		1.0	Response_Control
58.613		1		1.0	No_Response_Control
60.253		1		1.0	Response_Control
61.893		1		1.0	No_Response_Control
63.533		1		1.0	Response_Control
65.173		1		1.0	Response_Control
...
522.5041	1		1.0	No_Response_Control
524.1441	1		1.0	Response_Control
525.7841	1		1.0	No_Response_Control
527.4241	1		1.0	Response_Control
529.0641	1		1.0	No_Response_Control