Académique Documents
Professionnel Documents
Culture Documents
Supervised by
Dr.-Ing. Ivan Volosyak
Examined by
Prof. Dr.-Ing. Axel Gräser
Ich versichere daß die vorliegende Arbeit – bis auf die offiziele Betreuung durch den
Lehrstuhl – ohne fremde Hilfe von mir durchgeführt wurde. Die verwendete Literatur ist im
Literaturverzeichnis vollständig angegeben.
Herewith I declare that I have conducted this work on my own without external
support and that I did not use other than quoted sources and auxiliary means. I hereby assure
that this thesis was made exclusively by me, with exception for official support from the
BrainRobot research group at the Institute für Automatissierungstechnik (IAT) of the
University of Bremen and especially my project supervisors: Dr.-Ing. Ivan Volosyak and Prof.
Dr.-Ing Axel Gräser
ii
ABSTRACT
iii
ACKNOWLEDGEMENT
iv
Table of Contents
DECLARATION ................................................................................................................ ii
ABSTRACT....................................................................................................................... iii
ACKNOWLEDGEMENT ................................................................................................. iv
Table of Contents................................................................................................................ v
List of Figures ................................................................................................................... vii
List of Tables ................................................................................................................... viii
Chapter 1 Introduction....................................................................................................... 1
1.1. Project Background................................................................................................ 1
1.2. Objectives of the Project........................................................................................ 2
1.3. Project Outline ....................................................................................................... 2
v
Table of Contents
BIBLIOGRAPHY ........................................................................................................... 55
vi
List of Figures
Figure 1.1 Spelling (and stimulator) software GUI, from the IAT BrainRobot
group of the University of Bremen ................................................................... 2
Figure 2.1 Spelling program GUI, from the IAT of the University of Bremen................. 6
Figure 2.2 Electrodes placement for SSVEP-based BCI used by the IAT in the
CeBIT 2008 event ............................................................................................. 7
Figure 4.1 Dialog Box in CeBit Software........................................................................ 33
Figure 4.2 Dialog Box in REHACARE Software............................................................ 33
Figure 4.3 Example of CeBit Data Storing Result........................................................... 49
Figure 4.4 The CeBit data checking result....................................................................... 51
Figure 4.5 The Rehacare EEG data checking result (only first 7 columns)..................... 53
vii
List of Tables
viii
Chapter 1
Introduction
1
1. Introduction
Figure 1.1 Spelling (and stimulator) software GUI, from the IAT BrainRobot group of
the University of Bremen, modified from [1],[3],[4]
The main goal of this master project is to find problems and bugs of the software
used in the CeBIT 2008, especially the data acquisition and storing part. As a result, it is
intended to reconstruct the right original EEG data. Other purpose of this project is a
literature research about different ways of storing EEG data.
Chapter 1 introduces the background and the objectives of this project. Chapter 2
describes definition of BCI, SSVEP, EEG and so on. Chapter 2 also tells about the Study
of SSVEP BCI in the IAT of the University of Bremen.
Chapter 3 describes different kinds of EEG data format. In the last part of Chapter
3, the EEG data formats from the IAT BrainRobot research group from the University of
Bremen is explained, both used in CeBIT 2008 and in REHACARE 2008.
2
1. Introduction
Chapter 4 explains the software used by the IAT BrainRobot group for data
acquisition and storing. The software bug is described in this chapter. In the end, Chapter
5 concludes the master project.
3
Chapter 2
Bremen SSVEP BCI
4
2. Bremen SSVEP BCI
The neurons of the human brain process information by changing the flow of
electrical currents across their membranes. These changing currents generate electric and
magnetic fields. By putting electrodes to the scalp, the change of electric field can be
measured and recorded. Electroencephalogram (EEG) is a record of the electrical
potentials between those different electrodes. EEG means the writing out of the electrical
activity of the brain [9].
EEG-based BCI is a kind of human computer interface which enables the direct
communication between human and computers by analyzing electroencephalographic
activities (EEG) that reflect the function of the brain [10]. EEG based BCI is mostly
invasive. EEG electrodes are put on the surface of the scalp.
The evoked potential is the change in brain’s electrical activity that follows a
stimulus [9]. This potential is recorded by using EEG. Visually Evoked Potential (VEP)
is recorded from the scalp over virtual cortex [5]. The visual cortex is under the occipital
scalp [7]. Light stimuli, e.g. flickering light or image, are used to stimulate the visual
systems. These stimuli elicit response in the visual cortex. This response is called VEP
[11]. VEP reflects the attention (to the stimuli) and can determine the direction of the eye
gaze [5].
There is transient VEP and steady-state VEP. Transient VEP arise if the electrical
excitation of the visual system is able to abate before new stimuli are presented [11].
P300 is an example of the transient VEP. There is a resonance phenomenon arising in the
visual attention to a flickering light source and this resonance happens in the Steady-State
VEP [12].
Steady-State Visually Evoked Potential (SSVEP) is the electrophysiological
response of the visual cortex to a rapidly repeating (flickering) stimulus. This response
generally has a sinusoidal waveform with the same temporal frequency as the driving
5
2. Bremen SSVEP BCI
stimulus [13]. This means that SSVEP is periodic [14]. The periodic pattern of SSVEP
can be detected and correlated to the periodic pattern of the stimuli. SSVEP reflects the
attention to a rapidly oscillating stimulus [8].
In the CeBIT 2008, the BrainRobot research group from the IAT of the University
of Bremen conducted a study of SSVEP-based BCI [3]. The BCI application used was
spelling software, which had a graphical user interface (GUI) on Figure 2.1. There were a
set of letter in the middle of the software display, five white boxes containing commands
and texts at the bottom of the display as spelling result. The five white boxes had
commands: left, right, up, down and select. Each box flickered with different frequency.
On the top right of the display, there was an application to show the Signal-to-Noise-
Ratio (SNR) of the desired EEG signal and the threshold. This application was not only
used for GUI but also for data acquisition and storing.
Figure 2.1 Spelling program GUI, from the IAT of the University of Bremen [1],[3]
6
2. Bremen SSVEP BCI
There were 106 subjects participated in the study [3]. Electrodes were put on the
subject’s scalp on the sites PO3, PO4, O9, O10, Oz and Pz aligned with the standard 10-20
system of electrode placement [3], as seen on Figure 2.2. The reference was the site Fz
and the ground was the site AFz [3]. The electrodes were connected to the gUSBamp
(Guger Technology), so that the EEG signal could be amplified, digitized, filtered and
collected. The gUSBamp sent EEG data to the computer through USB. The computer
enabled a lot of EEG or BCI applications and many ways of EEG data recording.
Figure 2.2 Electrodes placement for SSVEP-based BCI used by the IAT in the CeBIT
2008 event, modified from [1], [15]
Each white box in the display flickers with different frequency. A subject who
looks at a certain box could have SSVEP response. This SSVEP feature is extracted from
EEG signal from the subject’s brain. The SSVEP contains signal with the same frequency
as the flickering box, to which the subject put his attention. The SNR of the correlating
7
2. Bremen SSVEP BCI
frequency will get higher until it reaches a certain threshold. If two or more SNRs reach
the threshold, the highest is chosen. The user commands are based on the SNR. A
subject, who focuses on one flickering box, could choose a command that is assigned to
that box, e.g. left, right, up, down and select.
In the experiment, each subject should fill forms and then was prepared with the
electrodes. The subject should spell some given words and a free word. A subject spelled
by looking at one of the flickering boxes, in order to move the cursor to a desired letter
and to select that letter. A subject spelled letter by letter to form a word or more. The
spelling result was shown as text at the bottom of the display. A subject is considered
accurate if he could spell the complete desired words without a mistake.
8
Chapter 3
Data Format
Biosignals are currently stored in a wide variety of different data formats [16]-
[18]. BioSig – an open source software library – supports approximately 50 different data
format [16],[18]-[20]. Many data formats have been developed by commercial
companies, research groups and standardization organisations. For EEG recording and
the Brain-Computer Interface research, there are some data formats that can be used for
flexible data exchange between organisations or institutes, e.g. GDF [16],[21], EDF
[15],[22]-[24], BDF [25], BKR [26] and so on.
EEG data usually contains signal from different electrodes from the scalp so it is
mostly multichannel data. The EEG signals are always stored based on channel and time.
The EEG signals are digitized with a certain sampling frequency and those digital signals
is then stored in timely samples.
EEG data can be stored as channel-based order or time-based order or
combination of both [16]. Channel-based order means that the data is stored channel by
channel and each channel contains data from sample 1 until sample Ns, with Ns is the
number of samples. Most EEG amplifiers basically provide channel-based order
recording but due to memory limitation, the signals cannot be all buffered so a
combination with time-based order is needed. Time-based order means that the data is
stored sample by sample timely and each sample contains data from channel 1 until
channel Nch, with Nch is the number of channels. Some examples of time-based order
recording are BKR format and IAT BrainRobot EEG data format.
EEG Data is recorded and buffered by an EEG amplifier before it is sent to a
computer to be stored. The buffer size is always a constraint. Although most EEG
amplifier record data in channel-based order, the limited buffer size make the data storing
9
3. Data Format
always timely. So there is a term “record”. Most data format use records. Each record
contains data, whether it is in channel-based order or in time-based order. EEG amplifier
sends data to the computer record by record. GDF, EDF and BDF keep data in these
records.
A record is not always purely in time-based order. In BKR format, a record is
based on experiment or trial [26]. One BKR file may contain data from different kinds of
experiments, for example in spelling experiments, first trial is spelling “BCI” then second
trial is spelling “CHUG” and so on. Each experiment is stored as one record and all
records are arranged in only one file.
There is also different perception of the number of channels and the number of
electrodes. EEG signals come from different electrodes. Due to many kinds of signal
processing, e.g. spatial filtering, the number of channels is not always the same as the
number of electrodes. For example, EEG signals from 6 electrodes can be only 1 channel
if averaging filter is used. Other examples of spatial filtering can be seen in [12].
General Data Format (GDF) is a scientific data format to integrate and to combine
a lot of features in biomedical signals. GDF is not only used for storing EEG data, but
also ECG. GDF is a development of EDF [23], EDF+ [24] and BDF [25], which use only
integer to store data. GDF supports data recording not only in integer but also in floating
point: float32 (float in C++) and float64 (double in C++).
GDF contains header, data and event table. The header consists of fixed header
and variable header. The fixed header size is 256 bytes. The variable header depends on
the number of channels. So the size of the variable header is 256 bytes times number of
channels. There is also optional header in GDF version 2.0 with the size of 256 bytes.
The data contains records in time-based order and each record contains biomedical
signals in channel-based order. In the end, there is event table.
Below are some tables showing the GDF version 2.0 with “remark” column
indicating which fields have changed from version 1.25 to version 2.0, [16]. Table 3-1
presents the fixed header. Table 3-2 pictures the variable header. Table 3-3 shows the
10
3. Data Format
optional header. Table 3-4 gives an idea about the data record. Table 3-5 tells about the
event table.
11
3. Data Format
12
3. Data Format
13
3. Data Format
header and variable header. The fixed header size is 256 bytes. The variable one has a
size of NS times 256 bytes, with NS as a number of signals/channels. The data records
contain consecutive fixed-duration epochs of the polygraphic recording. They are in
channel-based order.
Table 3-6 below shows the fixed header of EDF. Table 3-7 presents the variable
header. The size of the header is in ASCII (char in C++), which is 1 byte each. Table 3-8
gives an idea about the data records in EDF.
Table 3-6 Fixed Header of EDF with example, modified from [22]-[24]
Type and size Fixed Header Example
8 ascii Version of this format (0) 0
80 ascii Local patient identification MCH-0234567 F 02-MAY-1951 Haagse_Harry
80 ascii Local recording identification Startdate 02-MAR-2002 EMG561 BK/JOP Sony.
MNC R Median Nerve.
8 ascii Start date of recording (dd.mm.yy) 17.04.01
8 ascii Start time of recording (hh.mm.ss) 11.25.00
8 ascii Number of bytes in header record 768
44 ascii reserved EDF+D
8 ascii Number of data records
2
(-1 if unknown)
8 ascii Duration of data record, in seconds 0.0050
4 ascii Number of signals/channels (NS)
2
in data record
Table 3-7 Variable Header of EDF with example, modified from [22]-[24]
Example
Type and size Variable Header st
1 signal/channel 2nd signal/channel
NS * 16 ascii Label
R APB EDF Annotations
(e.g. EEG Fpz-Cz or Body temp)
NS * 80 ascii Transducer type
AgAgCl electrodes
(e.g. AgAgCl electrode)
NS * 8 ascii Physical dimension
mV
(e.g. uV or degreeC)
NS * 8 ascii Physical minimum
-100 -1
(e.g. -500 or 34)
14
3. Data Format
In Table 3-7, each data record contains 1000 times 2-byte integer of R APB
samples and 60 times 2-byte integer of EDF Annotations.
15
3. Data Format
Table 3-9 Fixed Header of BDF and EDF, modified from [25]
Length BDF Header EDF Header Description
Byte 1: “255” Byte 1: “0”
(non ascii) (ASCII)
8 bytes Identification code
Byte 2-8: “BIOSEMI” Byte 2-8: “ ”
(ASCII) (ASCII)
80 bytes User text input (ASCII) Local subject identification
80 bytes User text input (ASCII) Local recording identification
8 bytes dd.mm.yy (ASCII) Start date of recording
8 bytes hh.mm.ss (ASCII) Start time of recording
8 bytes (ASCII) Number of bytes in header record
44 bytes “24BIT” (ASCII) “BIOSEMI” (ASCII) Version of data format
Number of data records,
8 bytes (ASCII)
“-1” if unknown
Duration of data records, in
8 bytes e.g.: “1” (ASCII)
seconds
Number of channels (N) in data
4 bytes e.g.: “257” or “128” (ASCII)
record
Table 3-10 Variable Header of BDF and EDF, modified from [25]
Length BDF Header EDF Header Description
N x 16 bytes e.g.: “Fp1”, “Fpz”, “Fp2”, etc (ASCII) Labels of the channels
N x 80 bytes e.g.: “active electrode”, “respiration belt” (ASCII) Transducer type
N x 8 bytes e.g.: “uV”, “Ohm” (ASCII) Physical dimension of channels
Physical minimum in units of
N x 8 bytes e.g.: “-262144” (ASCII) e.g.: “-32768” (ASCII)
physical dimension
Physical maximum in units of
N x 8 bytes e.g.: “262143” (ASCII) e.g.: “32767” (ASCII)
physical dimension
e.g.: “-8388608”
N x 8 bytes e.g.: “-32768” (ASCII) Digital minimum
(ASCII)
e.g.: “8388607”
N x 8 bytes e.g.: “32767” (ASCII) Digital maximum
(ASCII)
N x 80 bytes e.g.: “HP:DC; LP:410” e.g.: “HP:0,16; LP:500” Prefiltering
N x 8 bytes For example: “2048” (ASCII) Number of samples in each data
16
3. Data Format
record
(Sample-rate if duration of data
record = “1”)
N x 32 bytes (ASCII) Reserved
The variable headers, as seen on Table 3-10, are defined for each channel
separately. Each channel can be different. The data record can be seen on Table 3-11. The
record is arranged in time-based order and inside a record, the data is arranged in
channel-based order. Below is an example of BDF Data Record from 16 channel system
with 2048 Hz sample-rate (duration of a data record has been set to “1” or 1 second).
17
3. Data Format
6147 Byte 3
6148 Byte 1
6149 Byte 2 Channel 2 2
6150 Byte 3
6151 Byte 1
6152 Byte 2 Channel 2 3
6153 Byte 3
Duration of data set has
etc etc etc etc 1
been set to “1”.
12280 Byte 1
So this block will be filled
12281 Byte 2 Channel 2 2046
with (1 x 2048) samples
12282 Byte 3
from only “Channel 2”
12283 Byte 1
12284 Byte 2 Channel 2 2047
12285 Byte 3
12286 Byte 1
12287 Byte 2 Channel 2 2048
12288 Byte 3
etc etc etc etc etc
98302 Byte 1
98303 Byte 2 Channel 16 2048 etc
98304 Byte 3
98305 Byte 1
98306 Byte 2 Channel 1 2049
98307 Byte 3
etc 2
98308 Byte 1
98309 Byte 2 Channel 1 2050
98310 Byte 3
etc etc etc etc etc etc
18
3. Data Format
3.5. BKR-Format
The previous data formats use channel-based order. BKR format use time-based
order to store EEG data. BKR is developed by EEG Processing Software (EPS). So BKR
is intended only for EEG data storing. This format also consists of header and data. The
header size is 1024 byte. The size of the data block is given by the number of trials (ntr),
channels (nch), number of samples per trial (nsp) and the datasize of a sample value (2
Bytes for sshort).
The BKR header contains more information than GDF, EDF and BDF. In the
BKR header, there is information about the signal processing used, for example filtering,
windowing, artificial neural network, wavelet and so on. Table 3-12 shows the BKR
header.
19
3. Data Format
20
3. Data Format
(π ) 2 wavelet
1
cwt_fe float 4 Bytes 144 Freq. for Δt = Δf = 1
2
cwt_start ULONG 4 Bytes 148 Start sample for Wavelet
--NULL-- ---- ---- 152 --- Offset to 512 Byte ---
eletype[1] UCHAR 1 Byte 512 Electrode 1: Signal type (e.g. EEG)
elenum[1] UCHAR 1 Byte 513 Electrode 1: Channel number for the same signal
ref[1] float 4 Bytes 514 Reference value for Channel 1
… … … … etc
eletype[nch] UCHAR Electrode nch: Signal type (e.g. EEG)
elenum[nch] UCHAR Electrode nch: Channel number for the same signal
ref[nch] float Reference value for Channel nch
The data is divided into trials. Each trial contains data in channel based order.
Table 3-13 presents how the data is stored.
21
3. Data Format
Unlike the data formats from the BioSig Project [19],[20], IAT BrainRobot group
does not use header to store EEG data. The data is stored in text or binary file. The
experiment date and subject number is stored as a directory or a folder name. The
experiment time is stored as a file name. Below are some examples of folder and file
names used for the experiments in CeBIT 2008 event.
C:\BCIData\3_2_2009\Subject_999\Experiment_at_14_35.txt
F:\RecordedCEBIT3\5_3_2008\Subject_31\ Experiment_at_11_12.bin
The first example means that the data is stored in folder C:\BCIData, the
experiment date is on 3rd of February 2009, the subject number is 999, the experiment
time began at 14.35 and the data is stored as a text file. The second means that the data is
stored in folder F:\RecordedCEBIT3, the experiment date is on 5th of March 2008, the
subject number is 31, the experiment time started at 11.12 and the data is stored as a
binary file. So the general format is below.
The file contains 6 channels of EEG data and 1 command in time-based order.
Table 3-14 summarizes the columns in CeBit Data Format. The 6 channels of EEG data
is float32 type (float in C++) and the command is int32 type (int in C++). In text file, the
data is stored as a string representing number of float and integer. Below is an example of
the text file.
22
3. Data Format
Beside the EEG data recording, there are other files providing information about
protocol and calibration in text files. These files are generated if the protocol sheet is
filled and the calibration procedure is conducted. The format is below.
Folder_Name\d_m_yyyy\Subject_N\ProtocolSheet.txt
e.g.
F:\RecordedCEBIT3\5_3_2008\Subject_31\ProtocolSheet.txt
23
3. Data Format
Folder_Name\d_m_yyyy\Subject_N\Calibration.txt
e.g.
F:\RecordedCEBIT3\5_3_2008\Subject_31\Calibration.txt
Protocol sheet contains information about the subject number, the name of people
who prepare and train the subject, the number of cap size, the amplifier number, subject
gender, whether subject is left-handed or right-handed, subject’s vision, whether the
electrodes impedance is good and the words that should be spelled. Below is an example
of the protocol sheet format.
Subject Number = 31
Prepper-1 = Aavo
Prepper-2 = Thorsten
Trainer = Aavo
Experimenter =
Cap Number = 60
Amplifier Number =
Gender = female
Subject is Left-handed
Vision condition =
Impedance condition =
Run 1: Subject spells BCI
Run 3: Subject speels SIREN
Run 5: Subject speels adamski
The calibration file contains information about SNR threshold to make certain
commands as described in Chapter 2. The example of calibration file format is below.
24
3. Data Format
In the REHACARE 2008 event, there was improvement in EEG data recording.
There is still no header. The experiment date and the subject number are stored as a
folder name, with modification from the ones from the CeBIT 2008 event. The file name
contains not only information about experiment time but also the threshold used and the
word that should be spelled. The data can be stored as binary or text file. Below are
examples of folder and file names used in the REHACARE 2008.
E:\RecordedRehaCare\13102008\Subject_1\Experiment_at_16_19_Threshold_260_Word_BCI.tx
t
E:\RecordedRehaCare\10122008\Subject_919\Resume_Experiment_at_16_04_Threshold_200_
Word_BRAIN.txt
The first example means that the data is stored in folder E:\RecordedRehaCare,
the experiment date is on 13th of October 2008, the subject number is 1, the experiment
time started at 16.19, the SNR threshold is 260 and “BCI” is the word that should be
spelled. The second means that the data is stored in the same folder, the experiment date
is on 10th of December 2008, the subject number is 919, the experiment time began at
16.04, the SNR threshold is 200 and “BRAIN” is the word that should be spelled. These
examples used text file as data format. So the general data format is below.
Folder_Name\ddmmyyyy\Subject_N\Experiment_at_hh_mm_Threshold_TTT_W
ord_XXX.txt (or .bin)
(the subject number can be NN or NNN and XXX can be a longer word) .
The file contains 6 channels of EEG data, 1 command, 5 SNR data (related to 5
stimuli), command accuracy, 1 current cursor position, 1 selected letter and absolute time,
separated in different columns. All are arranged in time-based order. Table 3-15
summarizes the Rehacare data format. The 6 channels of EEG data and 5 SNR Data are
25
3. Data Format
float32 type (float in C++). The command and the command accuracy are int32 type (int
in C++). The current cursor position and the selected letter are char type. In text file, the
data is stored as not only a string of character, but also a string representing number of
float and integer. Below is an example of the text file.
………
………
26
3. Data Format
In the Rehacare data format, the float format in text file is scientific, with 7
significant numbers. This improvement makes the EEG data better to read than the one in
the CeBit. The new parts are the SNRs, the command accuracy, the current cursor
position, the selected words and the absolute time. The first seven columns have the
same function as the ones in CeBit Data Format. The commands enumeration between
CeBit and Rehacare format are the same. In the Rehacare format, the 8th until 12th column
or the 5 SNR values correlates to 5 frequencies from the 5 white-boxed stimuli each:
Left, Right, Up, Down and Select.
The selected letter from the 15th column is ‘#’ if none is selected.
27
3. Data Format
Beside the EEG data recording, there are other files containing user command
resume and whole experiment resume in text files. The user command resume is in time-
based order. These files are generated after one word is spelled. The format is below.
FolderName\ddmmyyyy\Subject_N\Command_Experiment_at_hh_mm_Threshol
d_TTT_Word_XXX.txt
e.g.
E:\RecordedRehaCare\17102008\Subject_24\Command_Experiment_at_13_01_Threshold_200_
Word_BCI.txt
FolderName\ddmmyyyy\Subject_N\Resume_Experiment_at_hh_mm_Threshold_
TTT_Word_XXX.txt
e.g.
E:\RecordedRehaCare\18102008\Subject_3\Resume_Experiment_at_13_03_Threshold_200_Wo
rd_GEHIRN.txt
The user command resume contains the user command, the current cursor
position, spelling time (in seconds, with the millisecond resolution), the current accuracy,
the current information transfer rate (ITR) and the current spelled word, separated in
columns. All are arranged in time-based order. Below is an example of the user command
resume.
28
3. Data Format
The resume consists of the main folder name, the experiment date, the subject
number, the desired word to spell, the spelled word, the whole ITR, the whole accuracy,
the spelling time, number of commands and number of correct commands, separated in
rows. The example of the resume is below.
PATH = C:\\RecordedRehaCare
DATE_INFO = \17102008
SUBJECT_INFO = \Subject_24
WORD TO SPELL = GEHIRN
WRITTEN WORD = "GEHIRN"
29
3. Data Format
ITR = 33.9456
Accuracy = 100 %
Time = 61.5614 seconds
Number of commands = 15
Number of correct commands = 15
30
Chapter 4
Data Storing in the IAT Spelling Software
4.1. Differences between Software used in CeBIT 2008 and in REHACARE 2008
The IAT data storing software are compiled using Microsoft Visual C++. The
software uses Microsoft Foundation Class (MFC), DirectX and driver for running EEG
amplifier from Guger Technology. Table 4-1 summarizes the software used by IAT and
the differences in CeBit and REHACARE software.
31
4. Data Storing in IAT Spelling Software
In CeBit 2008, the software allowed different threshold for each SNR. It was
intended to have a lot of subjects so there was protocol sheet to record the experimenter,
the EEG cap preparer, cap number and information about each subject. So there were
software modules: ProtocolSheet and CalibrationInfo, in Table 4-1.
In REHACARE 2008, only one threshold was used for all SNR. Protocol Sheet
was considered no longer important. In this event, calculating information transfer rate
(ITR) was more important. So there were modules: command_acc and speller, in Table 4-
1.
The change in the SNR threshold makes a different BCIclassifier module. In
REHACARE, there was research on the frequency selection so the SSVEPdetector
module changed. In REHACARE software, the harmonic frequency number is set to only
32
4. Data Storing in IAT Spelling Software
2. In CeBit software, the harmonic frequency number can be 1 until 3. If the harmonic
frequency number is 1, there is only fundamental frequency and no harmonics. The
REHACARE software uses only 2 frequencies: the fundamental and the first harmonic.
The most important change is the data storing software, in the
SSVEP_gUSBampDlg module. This module has an important role on GUI. So there is a
different Dialog Box between CeBit software (Figure 4.1) and REHACARE software
(Figure 4.2). From Fig. 4.1, the “Calibrate” and “Protocol Sheet” buttons can be seen.
These buttons are no longer used in the REHACARE software. But there are texts to
know the cursor position, the accuracy and the information transfer rate (ITR), in Fig.
4.2.
Beside the change in the GUI, there is a change in the data acquisition and
storing, as mentioned in the previous chapter. This part is explained below in the next
subchapter.
33
4. Data Storing in IAT Spelling Software
34
4. Data Storing in IAT Spelling Software
number
Public argument for TCP format
m_TCPFormatCtrl CComboBox control (not used in the
implementation file)
Public argument for the
m_Frequencies CString
frequencies (of the stimuli)
Public argument for segment
length in seconds, important for
m_SegLenSeconds double
buffering in data acquisition and
storing
Public argument for idle length in
m_IdleLen double second, important for TCP/IP
connection
Public argument for SNR
m_Threshold double
threshold
m_StartButton CButton Public argument for Start Button
Public argument for Connect
m_ConnectButton CButton
Button
Public argument for sampling
m_Fs int frequency in hertz, important for
data acquisition (128 Hz is used)
Public argument for calculation
interval in seconds, important for
m_CalculationInterval double
buffering in data acquisition (0.1
seconds is used)
Public argument for length of
m_GraphLength int SNR plots in seconds (10 seconds
is used)
Public argument pointing to the
newest data obtained from the
m_pfDataBuffer float*
EEG amplifier, important in CeBit
data storing, but not in Rehacare
Public argument pointing to a
m_Detectors SSVEPdetector* SSVEP detection object, using
signal processing module in [12]
m_Detectors_created bool Public argument to know whether
35
4. Data Storing in IAT Spelling Software
36
4. Data Storing in IAT Spelling Software
37
4. Data Storing in IAT Spelling Software
38
4. Data Storing in IAT Spelling Software
The sampling frequency (m_Fs) is set 128 Hz and the calculation interval is 0.1
seconds. The buffer size for each electrode will be 12,8 and it is rounded up to 13. The
software will store data blocks of 13 EEG signal times number of electrodes/channels.
The buffer size will be use in the signal processing, in [12]. The signal processing
uses SSVEPdetector module. The SSVEP detector has to be set up. As setting up the
39
4. Data Storing in IAT Spelling Software
detector, the segment length of EEG data blocks will be calculated. In the CeBit software,
this happens in the class members CSSVEP_gUSBampDlg::OnStartButton() and
CSSVEP_gUSBampDlg::OnBnClickedCalibrate(). The code can be seen below.
// Setup detectors
m_SegLenSamples =
(int)ceil(m_SegLenSeconds*m_Fs/m_BufferSizeScans)*m_BufferSizeScans;
int frequenciessize = (int)m_vFrequencies.size();
if (!m_Detectors_created)
{
m_Detectors = new SSVEPdetector[frequenciessize];
m_Detectors_created = true;
}
for(int i=0;i<frequenciessize;i++)
{
Status =
m_Detectors[i].Initialize(m_vFrequencies[i],m_Fs,m_NbrOfChannels,m_SegL
enSamples,0,0);
if(Status !=0)
{
MessageBox(SSVEPdetector::get_error(Status));
delete[] m_Detectors;
m_TCPIPObject.Send(LPCTSTR("11")); //11 = stop flickering
Sleep(25);
return;
}
}
40
4. Data Storing in IAT Spelling Software
After setting up the SSVEP detectors, the buffer size for signals and SNRs should
be allocated. In CeBit software, this allocation happens in
CSSVEP_gUSBampDlg::OnStartButton() and
CSSVEP_gUSBampDlg::OnBnClickedCalibrate(). The code can be seen below.
In CeBit software, after the buffer has been allocated, the thread is created. The
code can be seen below. This code is in the class member
CSSVEP_gUSBampDlg::OnStartButton().
// Create thread
m_hAcquireThread = CreateThread(NULL,// pointer to security attributes
0,// initial thread stack size
AcquireProc,// pointer to thread function
this,// argument for new thread
CREATE_SUSPENDED,// creation flags
&_tid);// pointer to receive thread ID
SetThreadPriority(m_hAcquireThread, THREAD_PRIORITY_NORMAL );
//THREAD_PRIORITY_HIGHEST
_isrunning = TRUE;
m_pfDataBuffer = NULL;
41
4. Data Storing in IAT Spelling Software
After creating the thread, in the same class member, the acquisition can start. The
code for acquisition thread is below.
In the function, there are variables pDataBuffer and pByteBuffer, which are
important in the data storing and acquisition. Those variables are pointer in C++. In
CeBit software, they are just dummy variables. In Rehacare software, the variables are
class members. In CeBit software, the declaration of those two variables and related ones
can be seen below.
42
4. Data Storing in IAT Spelling Software
The data acquisition and storing can be done after the declaration above. Below
is the important code for the data acquisition and storing in the CeBit software.
After the code above, there are codes to store EEG Data from pDataBuffer into a
file. The class member m_vSignals stores the EEG signal and processes the signals into
SNRs. SNRs will be used for classification, command decision and display.
43
4. Data Storing in IAT Spelling Software
44
4. Data Storing in IAT Spelling Software
The Rehacare software also uses the sampling frequency of 128 Hz and the
calculation interval of 0.1 seconds. There are no different with the previous CeBit
version. The buffer size is also 13.
45
4. Data Storing in IAT Spelling Software
The SSVEP detector setup in the Rehacare software is modified. This part is no
longer in the class member CSSVEP_gUSBampDlg::OnStartButton(), but in the
CSSVEP_gUSBampDlg::OnInitDialog(). The modified code can be seen below.
Status =
m_Detectors[i].Initialize(m_vFrequencies[i],m_Fs,m_NbrOfElectrodes,m_Se
gLenSamples,0,0);
The buffer allocation for EEG signals and SNRs is modified in the Rehacare
version. The code is in the class member CSSVEP_gUSBampDlg::OnInitDialog(), no
longer in the CSSVEP_gUSBampDlg::OnStartButton(). Below is the modified code.
m_vSignals.resize(m_SegLenSamples*m_NbrOfElectrodes);
After all the buffers have been allocated in the initialisation part, which is the
class method CSSVEP_gUSBampDlg::OnInitDialog(), the thread is handled in the
46
4. Data Storing in IAT Spelling Software
The data acquisition and storing can be done after the declaration above. Below is
the important code for the data acquisition and storing in the Rehacare software. Due to
some changes in the buffering (pDataBuffer and pByteBuffer) and the differentiation
between the number of electrodes and the number of channels, there is modification in
the data acquisition.
// Reshuffle data in m_vSignal. First shift out the oldest data to make
place for the new data.
for(j=0; j<NbrOfElectrodes; j++)
for(i =0; i<pthis->m_SegLenSamples - pthis-
>m_BufferSizeScans;i++)
pthis->m_vSignals[i + j*pthis->m_SegLenSamples] = pthis-
>m_vSignals[i+pthis->m_BufferSizeScans+j*pthis->m_SegLenSamples];
47
4. Data Storing in IAT Spelling Software
The code above does not have many differences from the CeBit version. After
that, there are codes for saving the EEG data from the class member pDataBuffer to files.
In Rehacare software, SNRs, time information and other do not come from pDataBuffer.
The class member m_vSignals acquires the EEG signals and then there are signal
processing like in the CeBit version to get the SNRs. There are codes in the Rehacare
software to store commands, SNRs, ITRs and accuracies in the end.
There are problem in the CeBit Software. It is intended to store data from 6 EEG
electrodes. Instead of getting a good result for every column in the EEG data file, there is
a different pattern in the sixth column, which comes from 1 electrode. Figure 4.3 gives an
idea of the different pattern.
48
4. Data Storing in IAT Spelling Software
In this master project, the difference of the sixth column should be explained. A
change in the data acquisition code is done to check whether the different pattern is a bug
or not. The change happens in the function AcquireProc() and it can be seen below.
49
4. Data Storing in IAT Spelling Software
The memories pointed by the variable pDataBuffer do not store EEG Data from
the memories pointed by the variable pfl but store data from the variable iNumber. The
change of codes above acts as a counter. The checking result can be seen in Figure 4.4.
50
4. Data Storing in IAT Spelling Software
Figure 4.4 shows bugs in the sixth column as the counter does not change
anything there. This means that EEG data/signal from one electrode could not be
retrieved. The data is stored correctly every 13 samples based on the buffer size of each
electrode scanning, but wrongly for every number of electrodes. The CeBit software uses
a loop of number of channels. Although in the initialisation, the number of channels has
been set to 6, but in the acquisition part, the number of channels is only 5. There is a
problem using the number of channels and the number of electrodes in the CeBit version.
The signal processing module (SSVEPdetector) uses the relation between those two
variables. Inside the module there is a method which returns a number of channels. This
new number of channels, which is 5, replaces the initial number of channels, which is 6.
The Rehacare software revised many things from the CeBit version. The buffer
sizes for data acquisition and storing (pByteBuffer and pDataBuffer) in the Rehacare
software are no longer dummy variables but now a class member. The buffer sizes have
been initialised in the dialog box initialisation before clicking the Start Button. In the
CeBit version the buffer sizes are initialised after clicking the Start Button. The most
important changes in the Rehacare version for the data storing and acquisition is the
51
4. Data Storing in IAT Spelling Software
separation of the number of electrodes and the number of channels. The revision in the
Rehacare software is intended to fix the bugs in the CeBit version. In order to check
whether the bugs are fixed the same checking method as in the CeBit software is used in
the Rehacare one. The codes can be seen below.
// Reshuffle data in m_vSignal. First shift out the oldest data to make
place for the new data.
for(j=0; j<NbrOfElectrodes; j++)
for(i =0; i<pthis->m_SegLenSamples - pthis-
>m_BufferSizeScans;i++)
pthis->m_vSignals[i + j*pthis->m_SegLenSamples] = pthis-
>m_vSignals[i+pthis->m_BufferSizeScans+j*pthis->m_SegLenSamples];
52
4. Data Storing in IAT Spelling Software
The result of Rehacare data checking can be seen in Figure 4.5. The data storing
bug is fixed. The buffer size for scanning each EEG electrode is 13, which is the same as
the size in the CeBit version. The number of electrodes is 6 and the result shows that the
sixth column successfully stored EEG signal from the last electrode.
Figure 4.5 The Rehacare EEG data checking result (only first 7 columns)
53
Chapter 5
Conclusion and Discussion
5.1. Conclusion
From this master project, some conclusions can be drawn. The conclusions can be
seen below.
¾ The data from one channel from 6 EEG electrodes cannot be retrieved, in the CeBit
software.
¾ The data storing bug in the CeBit software happened because of the inconsistency
between using the number of channels and using the number of electrodes
¾ In the Rehacare software, the data storing bug of the CeBit version has been fixed.
¾ Chapter 3 of this report gives an idea of different data formats: GDF, EDF, BDF,
BKR, CeBit data format and Rehacare data format.
It can be concluded from the chapter 3 of this report that some alternative data
formats can be used for flexible data exchange between institutes. CeBit and Rehacare
data format from the IAT of the University of Bremen provide a text file choice which
can be easily opened by other institutes. The disadvantage is that they need other
documentation because they have no header. The alternative data formats proposed here
are GDF, EDF, BDF and BKR. BKR can be used for the future if the time-based order
remains an IAT standard of EEG data storing. GDF can be a good choice for the future
because the IAT save EEG data in floating point format.
54
BIBLIOGRAPHY
[1] Indar Sugiarto. Display and Feedback Approaches for BCI Systems. 2008. Master Thesis,
Information and Automation Engineering, University of Bremen.
[2] T. Lüth. “Bremen Brain-Computer Interface Applications”. 28th Colloquium of
Automation. 2006. November, Salzhausen.
[3] B. Allison, I. Volosyak, T. Lüth, D. Valbuena, I. Sugiarto, M.A. Spiegel, A. Teymourian,
I.S. Condro, A. Brindusescu, K. Stenzel, H. Cecotti and A. Gräser. “BCI Demographics:
How many (and what kinds of) people can use an SSVEP BCI?”. Proc. 4th International
Brain-computer Interface Workshop and Training Course. 2008. Graz, Austria,
September 18-21, pp. 333-338.
[4] D Valbuena, I. Sugiarto and A. Gräser. “Spelling with the Bremen brain-computer
interface and the integrated SSVEP stimulator”, Proc. 4th International Brain-conputer
Interface Workshop and Training Course. 2008. Graz, Austria, September 18-21, pp.
291-296.
[5] Jonathan R. Wolpaw, Niels Birbaumer, Dennis J. McFarland, Gert Pfurtscheller and
Theresa M. Vaughan. “Brain-computer interfaces for communication and control”.
Clinical Neurophysiology. 2002. vol. 113, pp 767-791. Ireland: Elsevier. ISSN 1388-
2457.
[6] F. Lotte, M. Congedo, A. Lécuyer, F. Lamarche and B. Arnaldi. “A review of
classification algorithms for EEG-based brain-computer interfaces”. Journal of Neural
Engineering. 2007. pp R1-R13. UK: IOP Publishing. ISSN 1741-2560.
[7] Ming Cheng, Xiaorong Gao, Shangkai Gao and Dingfeng Xu, “Design and
Implementation of a Brain-Computer Interface With High Transfer Rates”. IEEE
Transactions on Biomedical Engineering. 2002. Vol. 49, No. 10, October, pp 1181-1186.
ISSN 0018-9294.
[8] Brendan Z. Allison, Elizabeth Winter Wolpaw and Jonathan R Wolpaw. “Brain-computer
interface systems: progress and prospects”. Expert Rev. Med. Devices. 2007. Vol.4, pp
463-474. Future Drugs Ltd. www.future-drugs.com. ISSN 1743-4440.
[9] Terence W. Picton. “What is an EEG (Electroencephalogram)?”. Rotman Research
Institute, Baycrest. www.rotman-baycrest.on.ca/index.php?section=402. Retrieved on
January 2009.
[10] Neng Xu, Xiaorong Gao, Bo Hong, Xiaobo Miao, Shangkai Gao and Fusheng Yang.
“BCI Competition 2003 – Data Set IIb: Enhancing P300 Wave Detection Using ICA-
Based Subspace Projections for BCI Applications”. IEEE Transcation on Biomedical
Engineering. 2004. Vol. 51, No. 6, June, pp 1067-1072. ISSN 0018-9294.
[11] Athanasios P. Liavas, George V. Moustakides, Günter Henning, Emmanuil Z. Psarakis
and Peter Husar. “A Periodogram-Based Method for the Detection of Steady-State
Visually Evoked Potentials”. IEEE Transactions on Biomedical Engineering. 1998. Vol.
45, No. 2, February, pp 242-248. ISSN 0018-9294.
[12] Ola Friman, Ivan Volosyak and Axel Gräser. “Multiple Channel Detection of Steady-
State Visual Evoked Potentials for Brain-Computer Interfaces”. IEEE Transactions on
Biomedical Engineering. 2007. Vol 54 No 4, April 2007, pp 742-751, ISSN 0018-9294.
[13] Peter Malinowski, Sandra Fuchs and Matthias M. Müller. “Sustained division of spatial
attention to multiple locations within one hemifield”. Neuroscience Letter. 2007. Vol.
414, pp 65-70. Ireland: Elsevier. ISSN 0304-3940.
55
Bibliography
[14] Zhonglin Lin, Changsui Zhang, Wei Wu and Xiaorong Gao. “Frequency Recognition
Based on Canonical Correlation Analysis for SSVEP-Based BCIs“. IEEE Transactions
on Biomedical Engineering. 2006. Vol. 53, No. 12, December, pp 2610-2614. ISSN
0018-9294.
[15] Bob Kemp, Alpo Värri, Thomas Penzel and Jesus Olivan. “European Data Format:
standard texts”. http://www.edfplus.info/specs/edftexts.html, retrieved in January 2009.
[16] Alois Schlögl. “GDF – A General Dataformat for Biosignals version 2.11”. Technical
Report. October 2008. ,
[17] Alois Schlögl. “Overview of data formats for biomedical signals”. Technical Report.
http://hci.tugraz.at/~schloegl/publications/Schloegl_Nov2008_OverviewBiosignalDatafor
mats.pdf, November 2008.
[18] _____. “Scientific Data Format”. http://hci.tugraz.at/schloegl/matlab/eeg/, retrieved in
February 2009.
[19] _____. “The BioSig Project”. http://biosig.sourceforge.net/, retrieved in February 2009.
[20] _____. “Dataformats supported by BioSig”. http://hci.tugraz.at/schloegl/biosig/TESTED,
retrieved in February 2009.
[21] Alois Schlögl, Oliver Filz, Herbert Ramoser and Gert Pfurtscheller. “GDF – A General
Dataformat for Biosignals version 1.25”. Technical Report. 1998-1999, revised on 29th
March 2005.
[22] _____. “European Data Format (EDF): technical specification”. http://www.dpmi.tu-
graz.ac.at/~schloegl/matlab/eeg/edf_spec.htm, retrieved in February 2009.
[23] Bob Kemp, Alpo Värri, Agostinho C. Rosa, Kim D. Nielsen and John Gade. “European
Data Format: Full specification of EDF”. http://www.edfplus.info/specs/edf.html,
retrieved in February 2009.
[24] Bob Kemp and Jesus Olivan. “European Data Format: Full specification of EDF+”.
http://www.edfplus.info/specs/edfplus.html, retrieved in February 2009.
[25] _____. “Which file format does BioSemi use?”.
http://www.biosemi.com/faq/file_format.htm, retrieved in February 2009.
[26] _____. “BKR-Format V2.07”. EPS (EEG Processing Software). http://www.dpmi.tu-
graz.ac.at/~schloegl/matlab/eeg/bkr.html, retrieved in February 2009.
[27] _____. “About BioSemi”. http://www.biosemi.com/company.htm, retrieved in February
2009.
56