![Page 1: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/1.jpg)
MEG and EEG analysis using
Cambridge, June 2017Francois TadelSylvain Baillet
![Page 2: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/2.jpg)
Graphic interface
2
![Page 3: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/3.jpg)
Scripting environment
• Rapid selection of files and processes to apply
• Automatic generation of Matlab scripts
• Plug-in structure: easy to add custom processes
3
![Page 4: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/4.jpg)
Brainstorm
• Free and open-source application
• Matlab & Java: Platform-independent
• Designed for Matlab
• Stand-alone version available
• Interface-based: click, drag, drop
• No programming experience required
• Daily updates of the software
• Supports most common file formats
4
![Page 5: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/5.jpg)
Multi-modal imaging
5
fNIRS
ECoG Depth electrodes
Electrophysiology
MEG/EEG
![Page 6: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/6.jpg)
Multi-modal imaging
Easy integration of:
• MEG
• EEG
• ECoG
• SEEG
• Animal LFP
• NIRS
6
![Page 7: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/7.jpg)
Workflow
7
EEG/MEGAnatomy
Co-registration
Sensors
Source estimation
Analysis
AveragesContrasts
Group analysisTime-frequency
Connectivity
![Page 8: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/8.jpg)
Single subject
8
Importing
Pre-processing
Analysis of the experimental data
Loop:all acquisition runsall subjects
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
![Page 9: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/9.jpg)
• One-click import of the T1 segmentation:FreeSurfer, BrainSuite, BrainVISA, CIVET
• Import and place fiducials in the MRI (N,L,R)
Import
9
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
![Page 10: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/10.jpg)
Database
• Three levels:
– Protocol
– Subject
– Condition
10
• Popup menus
• All files saved in Matlab .mat
• Same architecture on the disk
![Page 11: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/11.jpg)
• Original files linked to the database (no copy)
• Rich data viewer with flexible montage editor
• Optimized reading functions
Import
11
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
![Page 12: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/12.jpg)
Co-registration MEG / MRI (1)
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Basic estimation based on three points:Nasion (NAS), Left ear (LPA), Right ear (RPA)
• MRI: Marked in the volume with the MRI Viewer
• MEG: Obtained with a tracking system (Polhemus)
![Page 13: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/13.jpg)
Co-registration MEG / MRI (2)
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Automatic adjustment based on head shape:Fitting Polhemus points on the MRI head surface
• Final registration must be checked manually
• Polhemus driver included in Brainstorm
![Page 14: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/14.jpg)
Quality control
14
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Power spectrum density for quality control
< 3Hz: Eyes 10Hz: Alpha 50/60Hz> 40Hz: Muscle
MEGBad
channels
EEG
![Page 15: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/15.jpg)
Pre-processing
15
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Notch filter: Removes 50Hz/60Hz power line noise (and harmonics)
PSD
Sign
al
![Page 16: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/16.jpg)
Pre-processing
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• High-pass filter: Removes slow components (eye movements, breathing, sensor drifts…)
• Low-pass filter: Remove high-frequencies
![Page 17: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/17.jpg)
Pre-processing
17
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Manual inspection of the recordings
• Interactive selection of bad channels
• Re-reference the EEG if necessary (Average ref)
![Page 18: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/18.jpg)
Pre-processing
18
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Automatic detection of blinks and heartbeats(peak detection, or explicit amplitude threshold)
ECG
EOG
ECG
EOG
![Page 19: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/19.jpg)
• Two categories of artifacts:
– Well defined, reproducible, short, frequent:
• Heartbeats, eye blinks, eye movements, some stimulators
• Unavoidable and frequent: we cannot just ignore them
• Can be modeled and removed from the signal efficiently
– All the other events that can alter the recordings:
• Movements, building vibrations, metro nearby…
• Too complex or not repeated enough to be modeled
• Safer to mark them as bad segments, and ignore them
19
Artifact correction
![Page 20: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/20.jpg)
Pre-processing
20
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Correction with Signal Space Projections (SSP)
PCA
Spatial componentsDetect artifacts
Select components and compute a linear projector
to remove their contribution from the recordings
![Page 21: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/21.jpg)
Pre-processing
21
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Example: Cardiac artifact
Origin
al
SS
P
![Page 22: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/22.jpg)
Pre-processing
• Independent component analysis (ICA):
– Popular in the EEG literature
– Alternative to SSP for low number of sensors
– Already implemented: Infomax and JADE (EEGLAB)
22
![Page 23: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/23.jpg)
Pre-processing
23
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Example: Blink
![Page 24: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/24.jpg)
Pre-processing
24
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Automatic detection of artifacts (RMS-based)
• Manual screening of all the recordings is advised(scroll all the sensors by pages of 10-20s)
• Exclude: Blinks, movements, SQUID jumps
![Page 25: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/25.jpg)
Elekta-Neuromag SQUID jumps
25
• Sharps steps followed by a change of baseline value
• Mark the channels as bad before running MaxFilter
• Or mark the segments as bad in Brainstorm
![Page 26: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/26.jpg)
Epoching
26
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersPresentationSensorManual
• Two types of experiments:
– Steady-state or resting-state (ongoing activity)
– Event-based (stimulus, response, spike…)
• How to get event markers in the recordings?
![Page 27: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/27.jpg)
Epoching
27
• Reading the triggers saved by the presentation software (includes jittered OS delays)
• File triggers are never aligned with the real stim
Stimulation software
Operating system
Video orsound card
Projector
Image production (jittered delays)
Triggers MEG signals.fif
Transmission (fixed or jittered)
Recording (fixed delays)
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersPresentationSensorManual
![Page 28: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/28.jpg)
Epoching
28
• Reading information recorded on the subject side (photodiode, microphone, response box…)
• Avoids most uncontrollable jittered delays
Stimulation software
Operating system
Video orsound card
Projector
Image production (jittered delays)
MEG signals.fif
Transmission (fixed or jittered)
Photodiode signal
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersPresentationSensorManual
Recording (fixed delays)
Triggers
![Page 29: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/29.jpg)
Epoching
29
• Reading the triggers saved by the presentation software (includes jittered OS delays)
• Reading information recorded on the subject side (photodiode, microphone, response box…)
• Manual or automatic marking of biological or behavioral events, post-acquisition (epileptic spikes, sleep spindles, rat position in a box…)
• Optimized workflow for clinicians (keyboard and mouse shortcuts, workspace…)
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersPresentationSensorManual
![Page 30: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/30.jpg)
Epoching
30
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpoching
CombineExtractLengthProcess
• In some experiments, the event of interest is a combination of presentation markers.
• Example: Priming experiments
• In Brainstorm, the events of interest are saved as new marker types in the continuous files.
• In other environments, the events are sometimes defined only at the epoching time and not saved in the continuous file.
A C B C B C A C Markers
E1 E2 E2 E1 Events
![Page 31: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/31.jpg)
Epoching
31
• In Brainstorm, the events of interest are saved as new marker types in the continuous files.
• In other environments, the events are sometimes defined only at the epoching time and not saved in the continuous file.
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpoching
CombineExtractLengthProcess
![Page 32: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/32.jpg)
Epoching
32
• Epochs = Trials = Short blocks of recordings around an event of interest.
• Epoching = Extracting epochs from the continuous recordings and saving them.
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpoching
CombineExtractLengthProcess
![Page 33: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/33.jpg)
Epoching
33
• In Brainstorm, each imported epoch is an independent file in the database.
• Accessible by event type or individually.
• In other programs, all the epochs from one run are saved in one single file (one file per event type, or one file with all the events).
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpoching
CombineExtractLengthProcess
![Page 34: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/34.jpg)
Epoching
34
• How to define the optimal epoch length ?
• Experimental design:Expected effect duration, inter-stimulus interval
• Analysis: Frequency filters and amplitude normalizations may require longer epochs
• Computational limitations: Size and time
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpoching
CombineExtractLengthProcess
[0,900] ms
+ 200ms baseline
+ 300ms filters
= [-500, 1200] ms
![Page 35: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/35.jpg)
Epoching
35
• Processing steps that can be applied on epochs:
– DC offset correction: Subtract the average estimated over a baseline period
– Detrending: Subtract a linear trend estimated over a reference period
– Resampling: Decrease the sampling rate
• This dataset: DC correction, baseline=[-500,0]ms
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpoching
CombineExtractLengthProcess
![Page 36: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/36.jpg)
Single subject
36
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Averaging the trials: Reveals the features of the signals that are locked in time to a given event
= Event-related field / potential= Evoked response= ERF/ERP
MEG
EEG
![Page 37: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/37.jpg)
Single subject
37
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• EEG: Averaging data across runs and subjects OK.
• MEG: Averaging across runs is not always accurate
– Head shapes differ between subjects.
– Head positions different between runs.
– One sensor does not record the same thing in two different runs.
– Coregistration of runs with Elekta MaxFilterhelps but modifies a lot the recordings.Never use this to average across subjects.
– Recommended: Estimate the sources for each run separately, then average in source space.
![Page 38: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/38.jpg)
Single subject
38
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• EEG ERP: Famous faces
![Page 39: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/39.jpg)
Single subject
39
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Source space: Cortex or full head volume
• Forward model: Overlapping spheres (MEG)OpenMEEG BEM (EEG)
• Inverse model: Minimum norm estimatesBeamformersSeparately for MEG and EEG
Inverse
Forward
Source spaceSensor space
![Page 40: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/40.jpg)
Single subject
40
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• The MNE model requires an estimation of the level of noise of the sensors
• Noise covariance matrix = covariance of segments that do not contain any “meaningful” data
• Empty room, pre-stim baseline, resting
T
![Page 41: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/41.jpg)
Single subject
41
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
Famous faces
ME
GE
EG
ME
G s
ourc
es
![Page 42: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/42.jpg)
Single subject
42
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Regions of interest at cortical level (scouts)= Subset of a few dipoles in the brain= Group of vertices of the cortex surface
![Page 43: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/43.jpg)
Single subject
43
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Dipole scanningCompute a distributed source model, then find the most significant dipole at each time sample.
• Dipole fitting (FieldTrip)Non-linear search of the dipoles that minimizes the residuals (data explained - recordings)
![Page 44: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/44.jpg)
Single subject
44
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Faces – Scrambled, 160ms
![Page 45: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/45.jpg)
Source estimation: MEG
• Recommended in MEG analysis:
– The subject head can move in the helmet
– One sensor is not corresponding to one brain region
– Different types of sensors (magneto / gradiometers)
– Difficult to read, reproduce or compare
• Converting to source space helps solving those issues
45
M.Hamalainen 2007
![Page 46: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/46.jpg)
MEG sensors
46
275 axial gradiometers 204 planar gradiometers
102 magnetometers
![Page 47: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/47.jpg)
Source estimation: EEG
• In EEG, those problems don’t exist:
– Electrodes positions are fixed and known
– More reproducible signal shapes and topographies
– Clinicians are trained to work at the sensor level
• But the source reconstruction is still interesting:
– Localize the signal generators in the brain
(epilepsy and pre-surgical functional mapping)
– Spatial separation of simultaneous sources
47
![Page 48: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/48.jpg)
Single subject
48
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
Morlet wavelets
Hilbert transform + band-pass filter
![Page 49: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/49.jpg)
Single subject Sub002 / R01
49
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
• Make sure you know the transient periods for all the frequency bins, and do not include them in your analysis.
• An easy solution is to cut them out immediately after the computation.
![Page 50: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/50.jpg)
Time-frequency Average
50
![Page 51: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/51.jpg)
Time-frequency
51
![Page 52: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/52.jpg)
Single subject
52
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequencyOther measures
• Phase-amplitude coupling
![Page 53: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/53.jpg)
Single subject
53
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequencyOther measures
• Connectivity measures
• Correlation
• Coherence
• Phase locking value
• Granger causality
![Page 54: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/54.jpg)
Normalize(TF and sources)
Group analysis
54
AnatomyLink recordingsMRI registration
PSDFiltersBad channelsArtifactsCorrectionBad segments
MarkersEpochingAveragingSourcesTime-frequency
Weighted avg
Run averages
Subject averages
Group averages
Statistical tests
Low-pass filter
Project to template(sources only)
N subjects x M runs N averages
![Page 55: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/55.jpg)
Group analysis
55
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Weighted average of 6 runs per subject(recordings, sources MEG/EEG, time-frequency)
• Sources: Compute within-subject differences
– (Faces - Scrambled) and (Famous - Unfamiliar)
– The sign of the MNE source amplitude is ambiguous, we will apply an absolute value before comparing between subjects
![Page 56: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/56.jpg)
Group analysis
56
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Low-pass filter the subject averages: 32Hz
• Remove 300ms on each side (edge effects)
![Page 57: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/57.jpg)
Group analysis
57
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Amplitude normalization before group analysisBaseline = [-200,0]ms
• Sources: Z-score normalization wrt baselineS = (S – mean(baseline)) / std(baseline)
• Time-frequency: Event-related sync/desyncTF = (TF – mean(baseline)) / mean(baseline) * 100
![Page 58: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/58.jpg)
Group analysis
58
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Registration of individual sources on a template(ICBM152, Colin27, DNI, infants…)
Subje
ct 1
Subje
ct 2
Individual
anatomy
Standard
anatomy
Group analysis
AverageContrast
…
![Page 59: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/59.jpg)
Group analysis
59
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Using FreeSurfer registration
Su
bje
ct
Tem
pla
te
3D interpolation
FreeSurfer
registration
FreeSurfer
registration
![Page 60: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/60.jpg)
Group analysis
60
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Using BrainSuite registration
Su
bje
ct
Te
mp
late
3D interpolation
BrainSuite
registration
BrainSuite
registration
![Page 61: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/61.jpg)
Group analysis
61
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Faces - Scrambled
ME
GE
EG
EEG 070
MEG Z>3 EEG Z>3
ROI EEG
ROI MEG
![Page 62: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/62.jpg)
Group analysis
62
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Faces - ScrambledPermutation t-test, 1000 rand, p<0.05 FDR-corrected
ME
GE
EG
FieldTrip cluster test, cluster alpha=0.05, 1000 rand
EE
G
Parametric Chi2-test
log(|Faces-Scrambled|)=0
p<0.05 FDR-corrected
ME
GE
EG
![Page 63: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/63.jpg)
Group analysis
63
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Contrasts between subjects or conditions
• Parametric or non-parametric t-test
• Cluster-based non-parametric tests
• Export to: SPM, R, Excel, SPSS, Matlab…
![Page 64: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/64.jpg)
Group analysis
64
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• When scripting the analysis, we recommend you always check visually the following items for each run separately:
– MRI/sensors registration
– PSD before and after filters
– SSP and ICA component topographies
– ERP/ERF: Sensors time series
– ERP/ERF: Sensors topo of primary response
– ERP/ERF: Sources of primary response
– Any other metric of interest
![Page 65: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/65.jpg)
Group analysis
65
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Execution reports with snapshots saved in HTML
![Page 66: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/66.jpg)
Group analysis
66
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Prototype the analysis interactively with one subject.Write down all the parameters to reproduce with a script.
• Set the anatomical fiducials for all the subjects.
• Script #1: Import the anatomy for all the subjects
• Script #2: Pre-processing (loop on subjects)
– Link the raw files, register with MRI, compute PSD
– Detect or import event markers
– Pre-processing: Filtering, detect artifacts, SSP, ICA
• Manual inspection:
– Check the execution reports for script 2
– Fix the SSP/ICA (re-compute, manual selection)
– Mark bad channels and bad segments
![Page 67: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/67.jpg)
Group analysis
67
Subject averagesLow-passNormalizeProject
Group averagesGroup statistics
Quality controlWorkflow
• Script #3: Subject-level analysis (loop on subjects)
– Importing and averaging
– Source estimation
– Time-frequency
• Manual inspection:
– Check the execution reports for script #3
– Define regions of interest
• Script #4: Group analysis
– Subject-level averages
– Group-level averages
– Statistics
– Anything that involves regions of interest
![Page 68: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/68.jpg)
Add your code to Brainstorm
• Direct manipulation of the files in Matlab
• Use the menu “Run Matlab command”
• Write a plugin:
– Well documented API
– Lots of example (170 functions written as plugins)
• Examples of recent external contributions:
– MVPA decoding (Oliva, MIT)
– Microstate segmentation (Cacioppo, UChicago)
– Eyetracker/EEG synchronization (Uni Freiburg)
68
![Page 69: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/69.jpg)
• 16,000 users registered on the website
User community
69
![Page 70: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/70.jpg)
• Online tutorials: 30-hour self-training program
• Active user forum: 150 posts/month
• Daily updates: 750 downloads/month
User support
70
![Page 71: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/71.jpg)
Contributors
71
Richard Leahy
USC
Sylvain Baillet
MNI
John Mosher
Cleveland Clinic
Esther Florin
Univ Hosp Cologne
Inve
sti
gato
rs
Alexandre Gramfort
Telecom / Neurospin
Dimitrios Pantazis
MIT
Key c
oll
abora
tors
Rey Ramirez
UW
Anne-Sophie Dubarry
Aix-Marseille Univ
Anand Joshi
USC
Hossein Shahabi
USC
Matti Hamalainen
Antoine Ducorps
Denis Schwartz
…
And…
ME
G @
Mc
Gil
l Elizabeth Bock
MEG engineer
Jeremy Moreau
PhD student
Guiomar Niso
Post-doc
Peter Donhauser
PhD student
Soheila Samiee
PhD student
François Tadel
Inserm Grenoble
Ge
ek
s
Martin Cousineau
MNI
![Page 72: MEG and EEG analysis using - neuroimage.usc.edu](https://reader030.vdocuments.site/reader030/viewer/2022012205/61dea72eed2381318020adbf/html5/thumbnails/72.jpg)
Sample data
Epilepsy recordings: Localization of frontal spikes
• Patient recorded at the Epilepsy Centre of the University Hospital in Freiburg, Germany
• Focal epilepsy with focal sensory, dyscognitive and secondarily generalized seizures since the age of eight years
• Histological analysis revealed a focal cortical dysplasia
• One hour of sleep recordings
• Neurofile NT EEG system, sampled at 256Hz
• 58 epileptic spikes marked by the epileptologists in Freiburg
• MRI processed with FreeSurfer 5.3
72