Easy VBMEG Tutorial

Contents

0. Download

EasyVBMEG_tutorial.zip

1. Introduction

1.1. Scenario

Generally, source imaging from EEG data requires the information of a subject’s brain structure and EEG sensor locations, which are respectively obtained using MRI system and 3D scanner. However, the MRI system and 3D scanner are expensive equipment and not many facilities have access to them. It is a common case that we only have EEG data but want to conduct the source imaging. Indeed, VBMEG provides a solution for such case by substituting the subject’s brain structure and EEG sensor locations with the standard models. In this tutorial, we demonstrate this solution using the real experimental data. All the procedures will be conducted with scripts.

1.2. Experimental procedure

In the experiment, the subject performed a somatosensory task. The subjects were instructed to close their eyes and an electrical stimulation was presented to the right median nerve. During the experiment, EEG was recorded with a whole-head 63-channel system (BrainAmp; Brain Products GmbH, Germany).

2. Starting tutorial

2.1. Setting environment

This tutorial was developed under MATLAB 2013b on Linux.

(1) Download and unzip EasyVBMEG_tutorial.zip
(2) Copy and paste all the files to $your_dir
(3) Start MATLAB and change current directory to $your_dir/program
(4) Open tutorial.m by typing

>> open tutorial

2.2. Adding path

Thereafter, we will sequentially execute the commands in tutorial.m from the top.

We add paths to necessary toolboxes: VBMEG and SPM 8.

>> addpath(path_of_VBMEG);
>> vbmeg
>> addpath(path_of_SPM8);

You need to modify path_of_VBMEG and path_of_SPM8 for your environment.

2.3. Creating project

We set the parameters for analyzing the EEG and MEG data, and set the file and directory names.

>> sub = 's006';
>> p = create_project(sub);

You can also set sub = 's043'.

By default, analyzed data and figures will be respectively saved in

  • $your_dir/analyzed_data/s006,
  • $your_dir/figure.

3. Source imaging from EEG data

In this section, we introduce the procedures from importing the raw EEG data to the source current estimation.

3.1. Preprocessing

Importing EEG data

We convert BrainAmp files to MAT files (User manual, vb_job_meg.m).

>> import_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/loaded/s1.eeg.mat (Somatosensory task, run 1)

Filtering EEG data

The recorded EEG data include drift and line noise (60 Hz at Kansai in Japan). To remove these noises, we apply a low-pass filter, down-sampling, and a high-pass filter.

>> filter_eeg(p);

The following file will be saved.

  • $ your_dir/analyzed_data/s006/eeg/filtered/s1.eeg.mat

Making trial data

We segment the continuous EEG data into trials. First, we detect stimulus onsets from the trigger signals included in the EEG data. Then, we segment the EEG data into trials by the detected stimulus onsets.

>> make_trial_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/trial/s1.eeg.mat

Correcting baseline

For each channel and trial, we make the average of prestimulus EEG to 0.

>> correct_baseline_eeg(p);

The following files will be saved.

  • $your_dir/analyzed_data/s006/eeg/trial/br_s1.eeg.mat (Somatosensory task, run 1)

Applying independent component analysis (ICA)

Using EEGLAB, we apply ICA to the EEG data.

>> apply_ica_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/ica/apply_ica_eeg.mat

Automatically classifying ICs

We automatically classify ICs into brain activities and noise based on kurtosis and entropy (Barbati et al., 2004).

>> classify_ic_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/ica/classify_ica_eeg.mat

Manually correcting classification results

We manually correct the classification results based on the below conditions:

  • the spatial patterns of the mixing matrices,
  • the stimulus-triggered averages of the ICs,
  • the power spectra of the ICs.

Therefore, this step requires your input.

>> correct_classify_ic_eeg(p);

The following file will be saved.

  • $your_dir/ analyzed_data/s006/eeg/ica/correct_classify_ica_eeg.mat

Removing noise ICs

We remove the ICs classified as noise from the EEG data (Jung et al., 2001).

>> remove_noise_ic_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/trial/ibr_s1.eeg.mat

Rejecting bad channels

We detect noisy channels based on the amplitudes of the EEG data and reject them. The rejected channels will not be used in the following analyses.

>> reject_channel_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/trial/ribr_s1.eeg.mat

Taking common average

We take common average; that is, we make the averages of EEG data across the channels to 0.

>> common_average_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/trial/cribr_s1.eeg.mat

Showing preprocessed EEG data

For each task, we show the processed EEG data averaged across the trials (vb_plot_sensor_2d.m).

>> show_trial_average_eeg(p);

Figures will be saved in

  • $your_dir/figure/show_trial_average_eeg/006.

3.2 Source imaging

Preparing leadfield

VBMEG2 provides the following leadfield matrix for the standard brain.

  • mni_icbm152_t1_tal_nlin_asym_09c_10000.basis.mat 

From this file, we extract the leadfield vectors corresponding to the recorded EEG channels by matching the channel names.

>> prepare_leadfield_eeg(p);

The following file will be saved.

  • $your_dir/analyzed_data/s006/eeg/leadfield/standard_Subject.basis.mat (Leadfield)

Estimating source currents

Using the leadfield matrix, we estimate the source current variance (vb_job_vb.m). Finally, the source current variance is used to yield the estimation of source currents (vb_job_current.m).

>> estimate_source_current_eeg(p);

The following files will be saved.

  • $your_dir/analyzed_data/s006/eeg/standard_current/s.bayes.mat (current variance)
  • $your_dir/analyzed_data/s006/eeg/standard_current/s.curr.mat (source current)

Showing estimated source currents

We show the estimated source currents averaged across the trials.

>> show_source_current_eeg(p);

Figures will be saved in

  • $your_dir/figure/standard_show_source_current_eeg/006.