Skip to content

EEG: souce modeling

fahsuanlin edited this page May 7, 2018 · 3 revisions

EEG: source modeling

Here we show steps to prepare the source space, to create boundary surfaces, to co-register EEG electrodes over a head, and to calculate the forward solution for EEG source modeling. Estimation of EEG source currents using the minimum-norm estimate (MNE) is also described in the bottom of this page.

Here we use a subject 180322_PYW as the example. FreeSurfer reconstruction of the subject's MRI (into different surfaces and volumes) and MNE packages are needed. The FreeSurfer reconstruction for 180322_PYW can be downloaded here.

setup environment

Make sure that you source the environment setup correctly to include both FreeSurfer and MNE

prepare subject's MRI

This is a step to prepare subject's MRI

mne_setup_mri --subject 180322_PYW

prepare source space (with average 5-mm spacing between neighboring current sources)

mne_setup_source_space --subject 180322_PYW --spacing 5

create boundaries needed for source modeling

mne_watershed_bem --subject 180322_PYW (--overwrite)

cd $SUBJECTS_DIR/180322_PYW/bem
ln -s watershed/180322_PYW_inner_skull_surface inner_skull.surf
ln -s watershed/180322_PYW_outer_skin_surface outer_skin.surf
ln -s watershed/180322_PYW_outer_skull_surface outer_skull.surf

co-register between electrodes and head models

Please consult the Wiki page.

calculate forward solution

A forward solution is a linear transformation describing how nx3 sources (n location with 3 orthogonal components) generate EEG signal at p locations. So it is a 2D matrix of (p x 3n). With defined current source locations, boundary surfaces, and co-registered EEG electrodes, you can use this forward solution calculation script to calculate the forward solution.

This forward solution solver was made possible by Dr. Matti Stenroos at the department of Neuroscience and Biomedical Engineering at Aalto University. It is based on a published paper. You may contact him to get necessary functions to make the script work.

You may need to update the first few lines of the script:

  • fwd_pre_file_name='fwd_prep_041018.mat'; It sets the preparation of the Matlab data file. See steps above.

  • fwd_file_name='fwd_041018.mat'; It sets the output file for the forward solution.

calculate minimum-norm estimates (MNE) of neuronal current

This MNE script will calculate the MNE of EEG responses. You may need to update the following 4 lines:

file_fwd='fwd_041018.mat';
file_bem='fwd_prep_041018.mat'; %including the source definition
file_erp={'erp_avg_outside.mat';};
output_stem={'mne_erp_avg_outside'};

The first two lines sets the file names for the forward model and boundary surfaces. The third line specifies the location of the evoked response, which should include a structrue cell variable named erp. This structure should minimally have the following fields:

  • erp: a 2D pxt matrix of p electrodes with t time points
  • timeVec: a 1D vector of timing of the evoked response in seconds

The calculation of ERP is described in this Wiki page.

The output will be two STC files (mne_erp_avg_outside-lh.stc and mne_erp_avg_outside-rh.stc) describing the estimated neuronal current response amplitude at left and right hemispheres.

Display/explore the current estimates

You can use the following codes to display the current estimates on the inflated brain surface of the subject. Remember to set the environment variable SUBJECTS_DIR correctly.

setenv('SUBJECTS_DIR','/my/path/to/subjects/');

subject='180322_PYW';

[value_lh,v_lh,a,b,timeVec]=inverse_read_stc('mne_erp_avg_outside-lh.stc');

etc_render_fsbrain('subject',subject,'overlay_stc',value_lh,'overlay_vertex',v_lh,'overlay_threshold',[10 20],'overlay_stc_timevec',timeVec,'overlay_stc_timevec_unit','ms');

Further options about spatiotemporal brain activity on a brain structural surface are described in [this Wiki page] (https://github.com/fahsuanlin/fhlin_toolbox/wiki/Render-brain-with-a-dynamic-overlay).

You can’t perform that action at this time.