The Neurophysiological Biomarker Toolbox (NBT)



Tutorial: Simulating and estimating EEG sources

Approximate time needed to complete the tutorial: 2 hours.

In this tutorial we will learn how simple intracerebral current sources can generate complicated patterns of EEG potentials at the scalp. We will then see how, under certain conditions, the underlying EEG sources can be effectively localized from the scalp measurements. However, the tutorial also aims to illustrate how the solution to the inverse EEG problem can be easily confounded e.g. by the presence of noisy background EEG activity.

Below you can download the slides of a presentation that deals with the topic of this tutorial:

Download the slides

Download and Installation

Please download the tutorial files and uncompress the .zip file. Then simply add directory tutorial_dipoles and all its subdirectories to your MATLAB's path. To add a directory and all its subdirectories to MATLAB's path you can use MATLAB's command:

addpath(genpath('M:/mypath/tutorial_dipoles'))

where M:/mypath/tutorial_dipoles is the location where you uncompressed the .zip file.

Note: The tutorial .zip file contains the tutorial code, the required data files and this documentation in HTML format. You can browse the documentation offline by opening with your web browser file index.htm, which is found under folder tutorial_dipoles.

Dependencies

The tutorial should work under MATLAB R2010a or newer. It is likely to work also under not too much older MATLAB versions. The tutorial makes use of the following freely available MATLAB toolboxes:

Fieldtrip MATLAB toolbox

For convenience, all the dependencies have been included in the tutorial .zip package so that you don't need to download them separately.

Note: The tutorial uses the 3D rendering capabilities of the OpenGL implementation that is included with your operating system. As OpenGL support differ slightly between operating systems there is a small chance that some of the figures will display differently in different operating systems. The figures shown in the tutorial have been generated in Windows 7.

Getting help

The tutorial instructions explain just a small fraction of the tutorial scripts' features. You can always get a more detailed help of individual MATLAB functions using the command help followed by the name of the relevant function. For instance, the command:

help plot

will display the help of MATLAB's built-in plot command.

MATLAB classes

What are classes and objects?

The tutorial makes use of MATLAB's classes. Do not get get intimidated by the term. A class is just a user-defined data type. MATLAB comes with lots of built-in data types. For instance double and single are two types that can store numeric data:

x = 5;

The variable x above is now an instance (also called an object) of class double. You can find out the classes of the variables in your MATLAB's workspace using the command whos. The result could be something like this:

>> whos
  Name        Size              Bytes  Class       Attributes
  myHead      1x1             2805970  head.mri              
  x           1x1                   8  double                
  y           1x1                   8  double              

where you can see that variable x is an object of class double and variable myHead is an object of class head.mri. The latter is a class that we have defined specifically for the purposes of this tutorial.

It is important to realize the difference between a class and an object. In the example above, x and y are two different objects of the same class.

What are class methods?

One of the great advantages of using objects with MATLAB is that it allows you to overloading function names. For instance, if you run the command:

plot(myHead);	

MATLAB will first check whether a specialized method plot() has been defined for class head.mri. If such method exists then it will run that method instead of MATLAB's built-in function plot(). A head.mri object contains a head model and a double object contains just numbers. Indeed, plotting such different data types involve very different operations. Thus, it makes sense that different versions of plot are called, depending on the class of what you want to be plotted. Remember: the specialized version of plot() that takes care of plotting mri.head objects is called a method of class mri.head.

Getting help on class' methods

Imagine that you want to get some help on method plot() for objects of class mri.head. You could try to do this:

help plot

but you will find that the help that is displayed corresponds to MATLAB's built-in plot() instead of corresponding to method plot() of class mri.head. Only if you read until the end of the help that is displayed you will see a section that reads Overloaded methods and that lists several other functions that are also called plot(), and that will be called instead of the built-in, depending on the type of the input argument. If you already installed the tutorial scripts you should see in that list a link reading head.mri. If you click that link you will get the help that you were looking for. Alternatively, you could have just used the command:

help head.mri.plot

Questions and feedback

This tutorial has been prepared for the course Advanced Human Neurophysiology, given at the VU University, and organized by Klaus Linkenkaer-Hansen. The author of the tutorial is German Gomez-Herrero.

As both code and documentation has been made from scratch for the year 2011 course, it is likely that you will find bugs and typos. Please report those to german.gomezherrero@kasku.org so that I can fix them. I would also appreciate any feedback (positive or negative) on the tutorial contents so that I can improve it.

Tutorial steps

The tutorial consists of three parts. Follow the links below to each of those parts:

tutorial/tutorial_dipoles.txt · Last modified: 2013/12/06 09:58 by Klaus Linkenkaer-Hansen
The NBTwiki platform - version 2.8 - 9 May 2013
Copyright (C) 2008-2014