Professional Documents
Culture Documents
Apostila BRAINN 2015
Apostila BRAINN 2015
Day 1
08:30 - 09:30: fMRI introduction
09:30 - 10:30: fMRI acquisition
10:30 - 10:45: Coffee break
10:45 - 12:30: fMRI analysis (theory and hands-on)
12:30 - 14:00: Lunch
14:00 - 15:30: fMRI analysis (theory and hands-on)
15:30 - 16:30: EEG introduction
16:30 - 16:45: Coffee break
16:45 - 18:00: EEG inside the MR scanner
Schedule - 2º Brainn Congress
Day 2
08:30 - 09:00: EEG-fMRI introduction
09:00 - 10:30: EEG-fMRI acquisition
10:30 - 10:45: Coffee break
10:45 - 12:30: EEG-fMRI analysis (theory and hands-on)
12:30 - 14:00: Lunch
14:00 - 15:30: EEG-fMRI analysis (theory and hands-on)
15:30 - 15:45: Coffee break
15:45 - 18:00: EEG source localization
EEG + fMRI
Authors:
How to get there! Brunno M. de Campos
Guilherme C. Beltramini
Paulo R. Bazán
Raphael F. Casseb 2015
Outline
1) fMRI introduction
2) EEG introduction
3) fMRI+EEG Introduction
4) EEG artifact removal (BV Analyzer 2)
5) fMRI analysis (SPM)
6) EEG-informed fMRI analysis (SPM)
7) Additional information
fMRI
Introduction
1.Basics of MRI signal
MRI is based on the nuclear resonance of atoms in a strong
magnetic field (Nuclear Magnetic Resonance - NMR).
Three main steps:
Radiofrequency pulse
(Larmor frequency)
Magnetic
Field
Reference: https://www.youtube.com/watch?v=djAxjtN_7VE
2.Types of images
Roughly, MRI technique can produce two types of images:
Structural
Functional:
series of measurements, allowing the
analysis of neural activity over time.
3.Functional images
http://jonlieffmd.com/blog/complexity-in-searching-for-the-neural-
code
Lindauer U. et al. (2010) “Pathophysiological interference with neurovascular coupling - when imaging based on hemoglobin might go blind”.
Frontiers in Neuroenergetics, vol. 2, article 25
4.BOLD signal
Blood Oxygenation Level-Dependent signal
Neuronal Oxygen Deoxyhemoglobin Blood flow, Relative
activity consumption concentration Blood volume deoxyhemoglobin
concentration
5.fMRI
Pros Cons
➔ High spatial resolution (0.5- ➔ Low temporal resolution (1-
4mm) 3s)
➔ Non-invasive ➔ Expensive
➔ No need for radioactive tracers, ➔ Volunteer has to lie still and
nor x-rays can’t move their head
➔ Whole-brain coverage (restriction on possible
➔ Usually easy subject preparation experiments)
➔ Useful for evaluation of short ➔ Noisy environment
events and of sustained activity
6.Brain signal - Spatial x Temporal
resolutions
http://www.nature.com/neuro/journal/v17/n11/fig_tab/nn.3839_F1.html
7.fMRI - Experimental design
Resting State Block
Alternating long periods (~10-30s) of task and rest
● Same task/instruction during the entire
acquisition
● Either eyes open (looking at a fixation
Stimuli
cross) or closed
● Not thinking about anything in particular
(resting state)
● Connectivity studies: evaluate the BOLD signal from
similarity between signal oscillation in each stimulus
different regions of the brain
Sum of signals
7.fMRI - Experimental design
Event-Related (similar to EEG/ERP)
Slow Event-Related Rapid Event-Related
Short tasks separated by long (10-15s) intervals Short tasks separated by short intervals of
variable duration along the acquisition
Stimuli Stimuli
“Forward”
7.EEG: Setup - Workspace
An equivalent circle also appears in the lower part of the Recorder window (green indicates synchrony is OK)
7.EEG: Setup - Synchrony
To set markers incoming from digital
ports, select Amplifier, Digital Port
Settings...
Artifact template
= raw data
○ First node in the tree
○ Cannot be deleted or overwritten
TR value
7.Transformation: MR Correction
● Baseline correction before averaging
● Period of the interval relative to the marker
Average Options:
● Use All Scanned Intervals for Average
● Select Scanned Intervals for Average by
Following Criteria: criteria to include interval in
the artifact template calculation
● Use Sliding Average Calculation: choose an
odd number
● Use Template Drift Compensation: when there’
s jitter between the artifact and the sampling
7.Transformation: MR Correction
The downsampling avoids
massive data storage. The high
sampling rate is only used to
estimate the MRI artifact
template.
Artifact correction
Gradients and RF pulse
(MR and CB artifacts)
7.Transformation: CB Correction
Menu Transformations → section Special Signal Processing, CB Correction
Reference period to
search for the BCG
artifact template
Thresholds to find
peaks similar to the
template
7.Transformation: CB Correction
Color of the lines:
7 - Click “Reorient”.
DONE!!!
2.Preprocessing per se
STEPS
1.Realignment: Coregistration between each volume of the functional image
–Motion correction
2.Slice timing correction: Temporal interpolation
–Compensates for the temporal difference in the acquisition of each slice
3.Coregistration: Coregistration between structural and functional images
–Allows us to use the structural image as the background of statistical results
4.Segmentation: Split structural image into different tissues (e.g., white matter, grey matter and CSF)
–Necessary step to perform normalization using “unified segmentation” algorithm
5.Normalization: Coregistration between template and subject’s image
6.Smoothing: Blurring with a gaussian kernel
–Reduces spatial variability, which is normally high; increases signal-to-noise ratio
2.1.Realignment
Objective: Motion correction
Operation: Rigid body transformation (translation and rotation)
Method: First scan of the list is used as a reference and all others are realigned (first scan of each
session with the first of all, and then scans of each session with respect to the first scan)
Output:
● Results window shows graphs of the translation and rotation
● Realign (Estimate):
○ In the folder where the functional images are: A rp_* .txt file and *.mat for each session
○ In the current folder (Current Folder in MATLAB): spm_aaaaMmmdd.ps file
● Realign (Estimate & Reslice):
○ rp_*. txt, *.mat, spm_*.ps
○ * .nii mean (average functional image of all EPIs)
○ r*.nii and r*.mat for each EPI but: avoid using Reslice because of interpolation errors; there
will be only one Reslice in Normalise. We recommend creating only Mean Image.
4
1
2
3: Choose:
Mean Image Only 3
2
Wrap Y 4
- Philips Achieva 3T:
fold-over direction =
"AP" (E.g..: nose may
appear behind the
head)
6:
7: Right click; then Select All; or
- “cue to identify first session files”.*
Shift+click
- 1:N, we suggest to set N as a
6 number greater than the total
9: before running: repeat steps 5-8 for
all the sessions (EPIs)
number of scans and hit Enter.
Output Obs .: If we do realignment after
slice timing correction (which is the
case for interleaved acquisition
slices), in steps 5-8 we must select
files resulting from the slice timing
correction (a*.nii).
2.2.Slice timing correction
Objective: Temporal correction
Operation: Adjust the time of acquisition of each slice so it looks like they were acquired at the same
time – usually the interval between one slice and the next is TR/(number of slices)
Method: Add a phase in the frequency domain to create a shift in time
Output:
- In the folder where the EPIs are: a*.nii file and a*.mat file for each session
Warning:
- Necessary for:
- Long TR (but accuracy decreases with increasing TR: do for TR > 3s)
- Interleaved acquisition
- Event-related paradigm
- Alternative: include time derivative as an additional regressor in the design matrix
4
3:
2
- Number of slices: 40 (for
3 example)
- TR: repetition time in seconds
- TA: time interval between
acquisition of the first and last
slices. Write: TR-TR/(no. slices)
(E.g.: for TR = 2s and 40 slices,
write: 2-2/40)
- Slice order: the order of
acquisition of the slices (slice 1
is the bottom slice). The bottom
of the window Batch Editor
shows how to fill for each
situation. E.g., for bottom up
sequential acquisition
(ascending), write: 1:40
2: do exactly the same as steps - Reference slice: usually the
5-8 from realignment, choosing central slice is selected
the same files also
2.3.Coregistration
Objective: Align the structural and functional images; step necessary to implement the normalization
(“unified segmentation”)
Operation: Source Image and Other Images undergo rigid body transformation to align with the
reference scan
Method: Minimize or maximize chosen cost function
Output:
● Header of Source and Other Images is changed
3
1
2
2:
Ref. Image: mean*.nii (result of
Realign: Est & Res)
Source Image: structural image
Output
Check if co-registration is correct
by clicking on the images in
Graphics window.
You can also use Check Reg:
2.4.Segmentation
Objective (everything below is part of the same algorithm):
● Bias correction: yields more uniform intensity for the same types of tissue to facilitate automatic
processing (often visually imperceptible)
● It is necessary for the recommended method of spatial normalization
● CSF, white matter and gray matter separation
Output (in the folder where structural image is):
● Bias corrected: m*.nii
● y_*.nii and iy_*.nii files (used in spatial normalization step)
● Tissues (e.g.: c1: gray matter; c2: white matter; c3: CSF; c4: bone):
○ in alignment with the original image: c1*.nii, c2*.nii etc. (native space)
○ Normalized images: wc1*.nii, wc2*.nii etc. (unmodulated normalized),
○ mwc1*.nii, mwc2*.nii etc. (modulated normalized)
(Modulation: gray scale level adjustment and volume correction to keep total signal of gray matter)
Alternative: algorithms available in Batch -> SPM -> Tools -> Old Segment
2.4.Warning
● Segmentation can sometimes fail if the structural image is not
similarly orientated with MNI templates. In other words, we need:
○ anterior commissure to a maximum of 2 cm away from the point
(0,0,0)
○ image angulation within a few degrees of tissue probabilities map
● If the result of segmentation is weird, check image orientation (both
items above)
● To orient images, refer to 0th Preprocessing Step
8
1
2
3
4
5
6
4 7
2: Choose structural
image (the same
4: Tissues: 1 is gray matter, 2 is white matter, 3 CSF, 4 bone, 5 soft tissue, 6 air and
chosen in
background. We will use only 1, 2 and 3.
Coregistration) 5: Choose “None” for tissues 4, 5 and 6.
3: Choose “Save 6: Choose “Modulated + Unmodulated” for tissues 1, 2 and 3.
Bias Corrected” 7: Choose if you want to save Forward, Inverse or both deformation parameters
images (used to normalize or bring to native space, respectively)
2.5.Normalization
Objective: Convert images to coordinate standard space (MNI)
Operation: Distort the images to resemble the reference image
Methods available:
● Unified segmentation: advised method
1) Structural image is segmented
2) Grey matter of the subject is coregistered with grey matter of the template; white
matter is analogous
3) Spatial transformation is used to normalize the above EPIs
● Normalize: Estimate & Write gives worse results than the above method
● In this tutorial, we will use Unified Segmentation (Segment first, then Normalise: Write)
5
1 3
4
2
Repeat these steps if you have more than one condition in the
same session.
3.1.Creating the model: SPM
Adding regressors: The regressor most commonly used is
the movement realignment parameters.
● The rp_*.txt file generated after the realignment can be
added to control the statistics for head motion.
● It has 6 columns: 3 with translation and 3 with rotation
parameters.
16: After that step, the “Play” button will turn green.
Run your batch file!
3.3.Results: SPM
1 - Condition: cond1
1000000001000000001000000001000000001000000001
8 zeros
2 from the derivatives and 6 from the movement regressors
So far….
3.3.Results: SPM
3 - Click Ok
3.3.Results: SPM
5 - Click Done
3.3.Results: SPM
● Get the events of interest from the EEG and use them
as stimuli in the fMRI statistical analysis
3.Creating the model
How to prepare your EEG output to insert in SPM General
Linear Model (GLM)?
Analyzer folders:
1. Export
2. History
3. Raw
3.Creating the model: Preparation
Inside the Export folder
The Markers files describe all response times registered by the MRI trigger and the events
(markers, stimulus, spikes….) marked by the user on the EEG data.
3.Creating the model: Preparation
Export folder
Select Delimited
3.Creating the model: Excel
4
3.Creating the model: Excel
To convert Position from sample points to seconds, you need to create an equation:
These are the vectors needed to design the statistical model (GLM) in SPM.
4.Statistical analysis
● The onset, duration and name of all events in the EEG
must be inserted into the statistical model (GLM)
● This can be done as shown in the section about fMRI
analysis
● Model creation, parameter value estimation and results
follow the same pipeline
5.Complete analysis with SAfE
SAfE = Straightforward Analysis of fMRI and EEG-fMRI
● Available at: http://www.lni.hc.unicamp.br/~beltramini/#safe (tested
with SPM8)
● Preprocessing
● Statistical analysis
○ Including macro in Excel to organize the markers
● Results
6.SAfE: Excel
User input
Macro
6.SAfE: Matlab
Additional information
● fMRI
○ Buxton, R.B. (2009). Introduction to Functional Magnetic Resonance
Imaging: Principles and Techniques. Cambridge University Press
○ Huettel, S.A., Song, A.W., McCarthy, G. (2014). Functional Magnetic
Resonance Imaging. Sinauer Assoc.
● EEG
○ Buzsaki, G. (2011). Rhythms of the Brain. Oxford University Press
○ Niedermeyer, E. & Lopes da Silva, F. (2004). Electroencephalography:
Basic Principles, Clinical Applications, and Related Fields. Lippincott
Williams & Wilkins
● SPM
○ User Manual
○ Discussion list: http://www.fil.ion.ucl.ac.uk/spm/support/
● BV Recorder and BV Analyzer 2
○ User Manuals
○ Press Release Articles (tricks and tips, LORETA, ICA, ...): http://www.
brainproducts.com/productdetails.php?id=17&tab=3
● EEG-fMRI:
○ Mulert, C. & Lemieux, L. (2010). EEG - fMRI: Physiological Basis,
Technique, and Applications. Springer
○ Ullsperger, M. & Debener, S. (2010). Simultaneous EEG and fMRI:
Recording, Analysis, and Application. Oxford Univ. Press
○ http://www.jove.com/video/50283/best-current-practice-for-obtaining-high-
quality-eeg-data-during
○ Beltramini, G.C. (2014). Análise temporal de correlatos hemodinâmicos
associados à atividade epileptiforme através da técnica de EEG-RMf
simultâneos. Ph.D. Thesis. University of Campinas: Brazil [text in
Portuguese] http://webbif.ifi.unicamp.br/teses/apresentacao.php?
filename=IF1660
If you have questions, suggestions, comments,
please contact us at
sci.supp@brainsupport.com.br