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 on 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 the fMRI dataset (ds000114) publicly available on openfmri.org. If you're using the suggested Docker image you probably have all data needed to run the tutorial within the Docker container. If you want to have data locally you can use Datalad to download a subset of the 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
install(notneeded): /data/ds000114 (dataset) [dataset <Dataset path=/data/ds000114> was already cloned from 'http://datasets.datalad.org/workshops/nih-2017/ds000114']
get(notneeded): derivatives/fmriprep (dataset) [already installed]
get(notneeded): derivatives/freesurfer (dataset) [already installed]
install(notneeded): derivatives/fmriprep (dataset)
install(notneeded): derivatives/freesurfer (dataset)
action summary:
  get (notneeded: 2)
  install (notneeded: 3)
[INFO] Installing <Dataset path=/data/ds000114> recursively

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 anatomical and the functional fingerfootlips images:

In [ ]:
%%bash
cd /data/ds000114
datalad get -J 4 /data/ds000114/derivatives/fmriprep/sub-*/anat/*preproc.nii.gz \
                /data/ds000114/sub-01/ses-test/anat \
                /data/ds000114/sub-*/ses-test/func/*fingerfootlips*
get(notneeded): /data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-02/ses-test/func/sub-02_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-03/ses-test/func/sub-03_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-04/ses-test/func/sub-04_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-05/ses-test/func/sub-05_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-06/ses-test/func/sub-06_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-07/ses-test/func/sub-07_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-08/ses-test/func/sub-08_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-09/ses-test/func/sub-09_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/sub-10/ses-test/func/sub-10_ses-test_task-fingerfootlips_bold.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-01/anat/sub-01_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-01/anat/sub-01_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-02/anat/sub-02_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-02/anat/sub-02_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-03/anat/sub-03_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-03/anat/sub-03_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-04/anat/sub-04_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-04/anat/sub-04_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-05/anat/sub-05_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-05/anat/sub-05_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-06/anat/sub-06_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-06/anat/sub-06_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-07/anat/sub-07_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-07/anat/sub-07_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-08/anat/sub-08_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-08/anat/sub-08_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-09/anat/sub-09_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-09/anat/sub-09_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-10/anat/sub-10_t1w_preproc.nii.gz (file) [already present]
get(notneeded): /data/ds000114/derivatives/fmriprep/sub-10/anat/sub-10_t1w_space-mni152nlin2009casym_preproc.nii.gz (file) [already present]
action summary:
  get (notneeded: 30)

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

In [ ]:
ls /data/ds000114
CHANGES                   sub-08/
dataset_description.json  sub-09/
derivatives/              sub-10/
dwi.bval@                 task-covertverbgeneration_bold.json
dwi.bvec@                 task-covertverbgeneration_events.tsv
sub-01/                   task-fingerfootlips_bold.json
sub-02/                   task-fingerfootlips_events.tsv
sub-03/                   task-linebisection_bold.json
sub-04/                   task-overtverbgeneration_bold.json
sub-05/                   task-overtverbgeneration_events.tsv
sub-06/                   task-overtwordrepetition_bold.json
sub-07/                   task-overtwordrepetition_events.tsv
In [ ]:
ls /data/ds000114/sub-01/ses-test/*
/data/ds000114/sub-01/ses-test/anat:
sub-01_ses-test_T1w.nii.gz@

/data/ds000114/sub-01/ses-test/dwi:
sub-01_ses-test_dwi.nii.gz@

/data/ds000114/sub-01/ses-test/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@

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

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 pouching 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 [ ]:
%%bash
cd /data/ds000114
datalad get /data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-linebisection_events.tsv
get(ok): /data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-linebisection_events.tsv (file) [from origin...
checksum...]
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
66.8129	1	1.0	Response_Control
68.4529	1	1.0	Response_Control
70.0929	1	1.0	Response_Control
71.7329	1	1.0	No_Response_Control
89.6395	1	1.0	Correct_Task
91.2795	1	1.0	Correct_Task
92.9195	1	1.0	Incorrect_Task
94.5595	1	1.0	Incorrect_Task
96.1995	1	1.0	Correct_Task
97.8395	1	1.0	No_Response_Task
99.4795	1	1.0	Incorrect_Task
101.1194	1	1.0	Correct_Task
102.7594	1	1.0	Correct_Task
104.3994	1	1.0	Correct_Task
122.306	1	1.0	Response_Control
123.946	1	1.0	No_Response_Control
125.586	1	1.0	Response_Control
127.226	1	1.0	Response_Control
128.866	1	1.0	Response_Control
130.506	1	1.0	No_Response_Control
132.146	1	1.0	Response_Control
133.786	1	1.0	Response_Control
135.4259	1	1.0	No_Response_Control
137.0659	1	1.0	Response_Control
154.9725	1	1.0	Incorrect_Task
156.6125	1	1.0	No_Response_Task
158.2525	1	1.0	Correct_Task
159.8925	1	1.0	No_Response_Task
161.5325	1	1.0	Correct_Task
163.1725	1	1.0	Correct_Task
164.8125	1	1.0	Correct_Task
166.4525	1	1.0	Correct_Task
168.0925	1	1.0	No_Response_Task
169.7324	1	1.0	Correct_Task
187.639	1	1.0	Response_Control
189.279	1	1.0	Response_Control
190.919	1	1.0	Response_Control
192.559	1	1.0	No_Response_Control
194.199	1	1.0	Response_Control
195.839	1	1.0	Response_Control
197.479	1	1.0	No_Response_Control
199.119	1	1.0	Response_Control
200.759	1	1.0	Response_Control
202.399	1	1.0	No_Response_Control
220.3055	1	1.0	Correct_Task
221.9455	1	1.0	Correct_Task
223.5855	1	1.0	Correct_Task
225.2255	1	1.0	No_Response_Task
226.8655	1	1.0	Correct_Task
228.5055	1	1.0	Incorrect_Task
230.1455	1	1.0	Correct_Task
231.7855	1	1.0	Correct_Task
233.4255	1	1.0	Correct_Task
235.0655	1	1.0	Correct_Task
252.9721	1	1.0	Response_Control
254.612	1	1.0	Response_Control
256.252	1	1.0	Response_Control
257.892	1	1.0	Response_Control
259.532	1	1.0	No_Response_Control
261.172	1	1.0	Response_Control
262.812	1	1.0	Response_Control
264.452	1	1.0	No_Response_Control
266.092	1	1.0	Response_Control
267.732	1	1.0	No_Response_Control
285.6386	1	1.0	Incorrect_Task
287.2786	1	1.0	Correct_Task
288.9185	1	1.0	Correct_Task
290.5585	1	1.0	No_Response_Task
292.1985	1	1.0	Incorrect_Task
293.8385	1	1.0	Correct_Task
295.4785	1	1.0	Correct_Task
297.1185	1	1.0	Correct_Task
298.7585	1	1.0	Correct_Task
300.3985	1	1.0	Correct_Task
318.3051	1	1.0	Response_Control
319.9451	1	1.0	Response_Control
321.5851	1	1.0	Response_Control
323.2251	1	1.0	Response_Control
324.865	1	1.0	No_Response_Control
326.505	1	1.0	Response_Control
328.145	1	1.0	Response_Control
329.785	1	1.0	No_Response_Control
331.425	1	1.0	Response_Control
333.065	1	1.0	No_Response_Control
350.9716	1	1.0	Correct_Task
352.6116	1	1.0	Incorrect_Task
354.2516	1	1.0	No_Response_Task
355.8916	1	1.0	Incorrect_Task
357.5316	1	1.0	No_Response_Task
359.1715	1	1.0	Correct_Task
360.8115	1	1.0	No_Response_Task
362.4515	1	1.0	Correct_Task
364.0915	1	1.0	Incorrect_Task
365.7315	1	1.0	Correct_Task
383.6381	1	1.0	Response_Control
385.2781	1	1.0	Response_Control
386.9181	1	1.0	Response_Control
388.5581	1	1.0	Response_Control
390.1981	1	1.0	No_Response_Control
391.8381	1	1.0	Response_Control
393.478	1	1.0	Response_Control
395.118	1	1.0	No_Response_Control
396.758	1	1.0	Response_Control
398.398	1	1.0	Response_Control
416.3046	1	1.0	Incorrect_Task
417.9446	1	1.0	Incorrect_Task
419.5846	1	1.0	Incorrect_Task
421.2246	1	1.0	Incorrect_Task
422.8646	1	1.0	No_Response_Task
424.5046	1	1.0	Correct_Task
426.1446	1	1.0	No_Response_Task
427.7845	1	1.0	Incorrect_Task
429.4245	1	1.0	Correct_Task
431.0645	1	1.0	Incorrect_Task
448.9711	1	1.0	Response_Control
450.6111	1	1.0	No_Response_Control
452.2511	1	1.0	Response_Control
453.8911	1	1.0	No_Response_Control
455.5311	1	1.0	Response_Control
457.1711	1	1.0	Response_Control
458.8111	1	1.0	Response_Control
460.4511	1	1.0	Response_Control
462.091	1	1.0	Response_Control
463.731	1	1.0	No_Response_Control
481.6376	1	1.0	Incorrect_Task
483.2776	1	1.0	Correct_Task
484.9176	1	1.0	Correct_Task
486.5576	1	1.0	No_Response_Task
488.1976	1	1.0	Incorrect_Task
489.8376	1	1.0	No_Response_Task
491.4776	1	1.0	Correct_Task
493.1176	1	1.0	Incorrect_Task
494.7576	1	1.0	Correct_Task
496.3976	1	1.0	Correct_Task
514.3041	1	1.0	Response_Control
515.9441	1	1.0	No_Response_Control
517.5841	1	1.0	Response_Control
519.2241	1	1.0	Response_Control
520.8641	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

Home | github | Nipype