Exercise:BCI2000 Basics: Difference between revisions

From BCI2000 Wiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
 
Line 13: Line 13:
* Find a <code>.bat</code> file in the <code>batch</code> subdirectory, right-click on it and select "Edit", then take a look at the contents. What is this file for?  Are there any parts whose role is unclear?  There are two main advantages to using batch files: what are they? (Hint: <code>batch/MatlabDemo_SignalGenerator.bat</code> contains an example of one of the advantages.)
* Find a <code>.bat</code> file in the <code>batch</code> subdirectory, right-click on it and select "Edit", then take a look at the contents. What is this file for?  Are there any parts whose role is unclear?  There are two main advantages to using batch files: what are they? (Hint: <code>batch/MatlabDemo_SignalGenerator.bat</code> contains an example of one of the advantages.)


=Exercises from the BCI2000 Work=
=Exercises from the BCI2000 Book=


The following exercises are taken from the Springer book "A Practical Guide to Brain-Computer Interfacing with BCI2000" by Gerwin Schalk and Jürgen Mellinger. The book provides descriptions of different aspects of the BCI2000 system, and gives tutorials for use of two different types of brain signals. Each of these exercises addresses a different component of the system. The exercises are meant to be followed in order.  
The following exercises are taken from the Springer book "A Practical Guide to Brain-Computer Interfacing with BCI2000" by Gerwin Schalk and Jürgen Mellinger. The book provides descriptions of different aspects of the BCI2000 system, and gives tutorials for use of two different types of brain signals. Each of these exercises addresses a different component of the system. The exercises are meant to be followed in order.  

Latest revision as of 11:07, 17 May 2011

BCI2000 System Basics

For the workshops, you will find a complete BCI2000 distribution, including source code, at C:\BCI2000\3.x

The following questions can be answered by exploring the BCI2000 distribution itself, and the html documentation (perhaps starting with the tour or the user manual).

  • What are the files in the prog subdirectory of the BCI2000 distribution?
  • What roles does the Operator module perform?
  • What role does a SignalSource module perform? Give one example of a SignalSource module and briefly describe what it does..
  • What role does a SignalProcessing module perform? Give one example of a SignalProcessing module and briefly describe what it does..
  • What role does an Application module perform? Give one example of an Application module and briefly describe what it does.
  • Find a .prm file in the parms subdirectory, open it and take a look at the contents. Broadly speaking, what is this file for?
  • Find a .bat file in the batch subdirectory, right-click on it and select "Edit", then take a look at the contents. What is this file for? Are there any parts whose role is unclear? There are two main advantages to using batch files: what are they? (Hint: batch/MatlabDemo_SignalGenerator.bat contains an example of one of the advantages.)

Exercises from the BCI2000 Book

The following exercises are taken from the Springer book "A Practical Guide to Brain-Computer Interfacing with BCI2000" by Gerwin Schalk and Jürgen Mellinger. The book provides descriptions of different aspects of the BCI2000 system, and gives tutorials for use of two different types of brain signals. Each of these exercises addresses a different component of the system. The exercises are meant to be followed in order.

Chapters 3 and 10 of the book give an overview and detailed description of the most important components of the BCI2000 system, respectively. We will here provide a realistic exercise that will touch on the key parameters of these components. This exercise will simulate the configuration of a BCI system that implements a cursor task. Thus, all subsequent exercises assume the use of the CursorTask_SignalGenerator.bat batch file. We suggest to start with the CursorTask_SignalGenerator.prm parameter file and to change it appropriately as you go along. It is a good idea if you save the parameter file with a different name as you make changes.

To begin, start BCI2000 using the batch and parameter files listed above. You can press Set Config and Start. You will notice that you can control the cursor in the display using the mouse. The exercises in the following sections will reconfigure a number of components of the system. The cursor will follow the mouse again only when all configuration changes have been made.

Source Module

We begin with an exercise relating to signal acquisition. Thus, we will be changing parameters in the Source tab of the BCI2000 configuration dialog.

  • We assume that we are recording EEG signals from eight channels (C3, Cz, C4, Cp3, Cpz, Cp4, Fpz, Oz) using a data acquisition (DAQ) device that has a sampling rate of 512 Hz. The whole system (i.e. including cursor movement) should be updated 32 times per second. The DAQ device provides floating point signals that are in units of µV. Which BCI2000 parameters need to be changed and why?
  • In this exercise, we will use the mouse to modulate the amplitude of a sine wave at C3 and C4 at 18 Hz. This simulates a subject that can modulate the amplitude of a sensorimotor rhythm at these locations and that frequency. With our BCI, we would like to control a computer cursor using one or both of these signals. Which BCI2000 parameters need to be changed and why?


Signal Processing Module

In the next part of the exercise, we will be extracting the simulated signals (i.e. amplitude of the sine waves) at C3 and C4 and 18 Hz in real time and will be using it for cursor control. To do this, we will have to deal with at least four components of Signal Processing, i.e. the Spatial Filter, the AR Filter, the Linear Classifier, and the Normalizer. The following exercises address these three components.

  • Spatial filtering can substantially improve the results of feature extraction in EEG-based BCIs (McFarland et al 1997, Clinical Neurophysiology). Thus, while not necessary for our simulated example, we will apply a Common Average Reference (CAR) filter. This filter subtracts the average of all other channels from a particular channel. (Some scientists would subtract the average of all channels when calculating the CAR filter. The two methods are equivalent, up to a constant scaling factor. In our example, in which we expect signals at channels C3 and C4, we would thus create two output signals that each have the average of all other channels subtracted. This can be done using the Spatial Filter. Which configuration changes are necessary?
  • Once the signals are spatially filtered, we need to convert them into the frequency domain, i.e. to calculate a spectrum. Once we have derived a spectrum, we can extract the signal at 18 Hz that we know is represented in the signal. For reasons described elsewhere (McFarland et al. 1997, Behavioral Research Methods), the most commonly used spectral estimation routine in BCI2000 is the Maximum Entropy Method (MEM) method rather than, for example, the Fast Fourier Transform (FFT). The parameters corresponding to the MEM method are listed in the ARFilter section of the Filtering tab. Which parameters of this section, if any, need to be changed and why?
  • The next step is to select from these features (i.e. amplitudes at given locations and frequencies) the linear combination of features that represents the signals of interest. In this case, we know that the signals of interest are the amplitudes at C3 and C4 at 18 Hz. We also know that activity at C3 corresponds to horizontal movement of the mouse and activity at C4 corresponds to vertical movement of the mouse. Given that we would like the same mapping for control of the cursor, which parameters need to be changed and how?
  • For this exercise, let's change the weights of the first and second control signal. To do this, enter 5 and 2 in the first and second row and in the right-most column in the parameter Classifier in the Filtering tab, respectively. Set the configuration and start. What happens and why?
  • One substantial problem in BCI operation is that the control signal dynamics (e.g. their minimum, maximum, mean, or standard deviation) are initially unknown and may also change over time. This presents a problem for online operation that needs to appropriately use these signals for a particular function, e.g. to control a cursor. As an example, the amplitude of a particular brain signal may change between 10 and 100 on one day, and between 100 and 300 the following day. Thus, in order to effectively use these control signals, they have to be normalized. For example, they should have zero mean and unit variance. How could this be accomplished given that we do not know much about these signals ahead of time?
  • Can you think of a few different approaches to estimating these offset and gain parameters from the data acquired in real time? Which approaches could you use for the following two scenarios: in scenario 1, you know something about the desired task. For example, you may know that there are four targets on the screen (like in the cursor task examples used in these exercises), and you also know what target the cursor should move towards. In scenario 2, you do not know anything about the task, e.g. as in an imaginary wheelchair application in which the user could move toward any target.
  • If you use the standard CursorTask_SignalGenerator.bat batch file, and CursorTask_SignalGenerator.prm parameter file, you can control the cursor using your mouse. This functionality was used earlier in this section to demonstrate different signal processing aspects in BCI2000. If you control the cursor using your mouse, you will notice that there is a small delay between when you move the mouse and when the cursor starts moving. What causes this delay? (Hint: this delay is not due to slow processing or screen update.)