Fundamentals of
fMRI data
analysis
Karolina Finc
Centre for Modern Interdisciplinary Technologies
Nicolaus Copernicus University in Toruń
COURSE #2: fMRI data manipulation and plotting in python
Functional
connectivity
Study plan
fMRI data
Open science &
preprocessing
5 AFTER
neuroimaging
3
1 4 6
2 General
Linear Model
Machine Learning
on fMRI data
fMRI data manipulation
BEFORE in python
Functional
connectivity
Study plan
fMRI data
Open science &
preprocessing
5 AFTER
neuroimaging
3
1 4 6
2 General
Linear Model
Machine Learning
on fMRI data
fMRI data manipulation
BEFORE in python
Structural vs. functional neuroimaging
Structural
MRI (T1)
Structural vs. functional neuroimaging
Structural Functional
MRI (T1) fMRI (T2*)
Ti
m
e
Structural vs. functional neuroimaging
Structural Functional
MRI (T1) fMRI (T2*) Spatial resolution - determines our ability
to distinguish changes in an image across
spatial location.
Ti
m
e
Structural vs. functional neuroimaging
Structural Functional
MRI (T1) fMRI (T2*) Spatial resolution - determines our ability
to distinguish changes in an image across
spatial location.
Ti
m
e
spatial resolution
Structural vs. functional neuroimaging
Structural Functional
MRI (T1) fMRI (T2*) Spatial resolution - determines our ability
to distinguish changes in an image across
spatial location.
Temporal resolution - determines our
ability to separate events in time (TR; r.g.
TR = 2000 ms).
Ti
m
e
spatial resolution
Structural vs. functional neuroimaging
Structural Functional
MRI (T1) fMRI (T2*) Spatial resolution - determines our ability
to distinguish changes in an image across
spatial location.
Temporal resolution - determines our
ability to separate events in time (TR; r.g.
TR = 2000 ms).
Ti
m
e Frequency - number of measurements per
second (Hz)
spatial resolution
EEG? fMRI?
Which one has better
temporal resolution?
Structural vs. functional neuroimaging
Structural Functional
MRI (T1) fMRI (T2*) Spatial resolution - determines our ability
to distinguish changes in an image across
spatial location.
Temporal resolution - determines our
ability to separate events in time (TR; r.g.
TR = 2000 ms).
Ti
m
e Frequency - number of measurements per
second (Hz)
spatial resolution
Structural vs. functional neuroimaging
Structural Functional
MRI (T1) fMRI (T2*) Spatial resolution - determines our ability
to distinguish changes in an image across
spatial location.
Temporal resolution - determines our
ability to separate events in time (TR; r.g.
TR = 2000 ms).
Ti
m
e Frequency - number of measurements per
second (Hz)
EEG: ~ 1000 Hz
spatial resolution fMRI: ~ 0.5 Hz
Neuroimaging techniques resolution
MRI data structure
MRI data structure
MRI data structure
15
Voxel
Voxel size
(e.g. 1 × 1 × 1 mm)
MRI data structure
15
Voxel
Voxel size
(e.g. 1 × 1 × 1 mm)
MRI data structure
Slice
thickness
(e.g. 1 mm)
15
Voxel Slice
Voxel size
(e.g. 1 × 1 × 1 mm)
MRI data structure
Slice
thickness
(e.g. 1 mm)
15
Voxel Slice
Voxel size
(e.g. 1 × 1 × 1 mm)
MRI data structure
Slice
thickness
(e.g. 1 mm)
z
y
x
15 Volume
Voxel Slice
Voxel size
(e.g. 1 × 1 × 1 mm)
MRI data structure Field of view
(FOV; e.g. 264 mm)
Slice
thickness
(e.g. 1 mm)
z
y
x
Matrix size
15 Volume (e.g. 264 × 264)
Voxel Slice
Voxel size
(e.g. 1 × 1 × 1 mm)
Brain sections
Coronal
Sagittal
http://homepage.smc.edu/russell_richar
d/Psych2/Graphics/human_brain_direct
Axial ions.htm
fMRI data structure
Structural data
fMRI data structure
Structural data Functional data
....
1 2 T
fMRI data structure
Structural data Functional data
....
1 2 T
fMRI data structure
Structural data Functional data
....
1 2 T
Voxel
Voxel size
(e.g. 3 × 3 × 3 mm)
fMRI data structure
Structural data Functional data
....
1 2 T
BOLD
....
1 2 3 4 5 6 7 8 9 10 T
fMRI data structure
Structural data Functional data
....
1 2 T
BOLD
....
1 2 3 4 5 6 7 8 9 10 T
fMRI data structure
Structural data Functional data
....
1 2 T
Time series - is a series of data
points listed in time order.
BOLD
....
1 2 3 4 5 6 7 8 9 10 T
fMRI data structure
Structural data Functional data
....
1 2 T
Time series - is a series of data
points listed in time order.
BOLD
Every voxel has its own
time-series.
....
1 2 3 4 5 6 7 8 9 10 T
What data can also be
represented as time-series?
Time-series example - COVID-19
http://shinyapps.org/apps/corona/
DICOM & NIfTI formats
DICOM (Digital Imaging and Communications in Medicine) format:
● Raw data format for storing and transmitting medical images
● Extension: .dcm
● One slice, one file
NIfTI (Neuroimaging Informatics Technology Initiative) format:
● Extensions: .nii, nii.gz
● Standardized representation of brain images
● Developed to facilitate cross-platform, cross-software interpretability
● 3-dimensional (3D) or 4-dimensional (4D) array: stacking individual slices
on top of each other
https://nilearn.github.io/stable/index.html
Python exercises
https://github.com/fMRIAnalys
isCourse/fmri-analysis-course
Homework
Logo contest!
1. GitHub Classroom
Data manipulation in Python
2. Data Camp Classroom
Introduction to Data Visualization
with Matplotlib
Next
Preprocessing