Skip to content

37. EEG MRI analysis

Fa-Hsuan Lin edited this page Apr 22, 2024 · 27 revisions

Overview

Here are details of processing MRI and EEG data for the steady-state visual evoked potentials (SSVEP) experiment. Sample data are provided here.

Structural MRI

Reconstruct brain structure using FreeSurfer and T1-weighted MRI (MPRAGE sequence) data. Details are here.

fMRI

Follow the instruction here for fMRI data pre-processing, including the following

  • convert meas.dat into Matlab mat files
  • register between fMRI and structural MRI. See this page for details.
  • prepare fMRI data on brain surfaces

The fMRI analysis using Genearal Linear Model can be found here.

EEG

EEG pre-processing includes

  • suppress gradient and pulse artifacts.
  • calculate event-related potentials (for event-related design).

To do EEG source anaylysis, follow the procedure here.

EEG files

Each session of EEG recording use the Brain Products amplifier gave three files: .vmrk, .vhdr, and .eeg files. You need all three files to process one session of EEG. NOTE: file names cannot be arbitrarily changed because data in the file were linked to the file name.

For example, for subject `180330_SYH', SSVEP_out_1.eeg, SSVEP_out_1.vhdr, and SSVEP_out_1.eeg together completed the recording of EEG outside MRI.

In the SSVEP experiment, EEG recordings for three conditions were taken:

  • EEG recorded outside MRI: consequently no MRI gradient and pulse artifacts. This condition is coded by "outside MRI".
  • EEG recorded inside MRI bore but no MRI were taken: consequently no MRI gradient but with pulse artifacts. This condition is coded by "inside MRI".
  • EEG recorded outside MRI: consequently with both MRI gradient and pulse artifacts. This condition is coded by "SMS-InI"

Here is a table describing the file name prefix for three conditions and three subjects.

Subject 180330_SYH 180401_YTH 180411_PYY
Outside MRI SSVEP_out_1 SSVEP_out_1 SSVEP_out_1
Inside MRI SSVEP_noMR_1, SSVEP_noMR_2, SSVEP_noMR_3 SSVEP_noMR_1, SSVEP_noMR_2, SSVEP_noMR_3 SSVEP_noMR_1, SSVEP_noMR_2, SSVEP_noMR_3
SMS-InI. SSVEP_sms_1, SSVEP_sms_2, SSVEP_sms_3 SSVEP_sms_1, SSVEP_sms_2, SSVEP_sms_3 SSVEP_sms_1, SSVEP_sms_2, SSVEP_sms_3

Load and examine data

The following codes read EEG data from one session (outside MRI). NOTE: bvloader tooolbox is needed. Please download it and make it within your Matlab path.

close all; clear all;

headerFile={
    '../eeg_raw/SSVEP_out_1.vhdr';
    };

% first get the continuous data as a matlab array
eeg{1} = double(bva_loadeeg(headerFile{1}));

% meta information such as samplingRate (fs), labels, etc
[fs(1) label meta] = bva_readheader(headerFile{1}

The variable eeg[1} is the data. fs(1) is the sample rate. label describes the names for EEG electrodes.

EEG traces can be visualized with the following codes:

etc_trace(eeg{1},'fs',fs(1),'ch_names',label);

EEG recording of 30-s interval with electrode names will be shown.

Calcuate event-related potentials (ERPs)

ERPs are calculated following the following major steps:

  • Gradient artifact removal: ONLY for data collected during MRI. Remove the large EEG signals caused by MRI gradient coil switching during MRI generation.
  • High-pass filtering (default: 1 Hz): remove any slow fluctuations (< 1 Hz).
  • Time series truncation (optional): remove some parts of the data, which may lack important timing stamps required for data analysis
  • Gradient artifact removal: ONLY for data collected inside the MRI bore. Remove the large EEG signals caused by heartbeats and breathing inside a strong magnetic field.
  • Re-reference (optional): remove the average across all EEG electrodes
  • Low-pass filtering (default: 70 Hz): remove any fast fluctuation (> 70 Hz).
  1. Estimate the ERP using the data collected outside MRI:

-- 1.1 Read EEG data with processing options: [read_outside_eeg_042124.m].

IMPORTANT!! Examine your results with the following script:

etc_trace(cat(1,EEG_orig,ECG_orig),'fs',fs(1),'ch_names',label,'aux_data',{cat(1,EEG,ECG)})

Two sets of EEG traces should should up. The dark blue ones are "main" signals, original EEG and ECG denoted by EEG_orig and ECG_orig. The red ones are "auxillary signals", the EEG and ECG traces after processing denoted by EEG and ECG. Hint: Use Up and Down keys to switch between traces for visualization.

Pay attention to the filtering effects, which are the most prominent effects in EEG collected outside MRI.

-- 1.2 Get ERP by averaging "epochs" of processed EEG waveform over trials: [read_outside_eeg_042124.m].

NOTE: This process was done automatically by averaging all trials. In practice, each trial should be visually inspected to ensure that no outliers with excessive artifacts (noise, drifting, etc), which are very likely to overwhelem the ERP if included.

  1. Render the evoked response topology and time course: [show_erp_scalp.m]. This script needs a EEG topology definition for 31-channel Brain Products EEG [topology_31ch_default.mat] for the definition of EEG electrode locations and a head model.

Change line 3 in the show_erp_scalp.m to supply the correct Matlab file with processed ERP to visualize. Click somewhere around the occipital lobe, where we expected to have strong SSVEP, to have the ERP plot shown below.

Clone this wiki locally