Anda di halaman 1dari 4

Adeel Ilyas

September 21, 2014


MSSRP
Report

EEG Analysis Software


Scope

For the purposes of EEG tracing, spectrogram display and statistical analysis, software

was developed using Scilab, a programming language for efficient numerical computation and

rendering. The purpose, details and utility of this program are described.

Introduction

EEGs are electrical recordings of brain activity that are interpreted in conjunction with

stereotypic behavior in the diagnosis of epilepsy. Given their digital nature, EEGs are both

recorded and displayed via software. Despite technological advances, seizure detection still

requires expert human EEG review as contemporary algorithms do not accurately correlate

electrical activity with seizure onset [Arif et al. 2014]; however, the availability of EEG analysis

programs will enable research laboratories to more rigorously correlate their findings with

electrical alterations within the brain, the implications of which will be discussed.

Program

The program’s primary purpose is to facilitate basic science neurophysiologic epilepsy

research conducted on model organisms; therefore, the domain extends only to static EEG

recordings and does not include real-time analysis, which would be more relevant clinically.

Figure 1 illustrates an overview of the program and its primary features. Runtime command line

interaction enables the user to modify the program output.

EEG Trace

A CSV file consisting of a sequence of real numbers corresponding to discrete electrical

amplitudes sampled at a constant frequency is inputted into the program [Eq. 1]. Although this

format lends itself readily to typical time-vs-amplitude EEG traces, downsampling is frequently
required to improve data point visualization [Eq. 2]. As recordings may be multichannel and span

several hours, the input may consist of millions of data points; thus, data is stored on the hard

drive in a Scilab native binary format that can be rapidly loaded upon runtime, a significant

advantage over other data analysis software such as Excel [Fig. 2]. During runtime, it is possible

to adjust the EEG trace to visualize individual waveforms, even to millisecond timescales [Fig. 3].

Spectrogram

Both binning and the discrete-time Fourier transform (DTFT) are required to generate a

spectrogram. Binning is the process by which the EEG signal is segmented along the time and

frequency axes. Initially, N data points are distributed among kT bins [Eq. 3], and iterative DTFTs

on the resulting NT points generate a short-term FT. Following conversion into the frequency

domain, these NT data points are distributed among kF bins, resulting in 2D bins consisting of NTF

data points [Eq. 4]. Subsequently, the power within each bin is computed by summing the squares

of the amplitudes [Eq. 5]. Finally, the power is converted into decibels and displayed on a color

map [Eq. 6 & Fig. 4].

Fourier Analysis

Filtering the EEG signal removes artifact and preserves frequencies of interest. The user

can specify properties of a band-pass filter. The filtered signal is then displayed in the frequency

domain [Fig. 5].

Utility

Experts in EEG review use waveform pattern recognition to detect aberrancies such as

seizures. The additional use of spectrograms in the clinical setting could facilitate EEG-based

diagnosis by providing information about the intensity of the signal, delineated across time and

frequency [Lehmkuhle et al. 2008]. In addition, spectrogram and Fourier analyses could aid in

seizure classification and may illuminate new types of seizures based on frequency-dependent

EEG properties; moreover, these seizures may be amenable to drug therapy targeting certain ion

channels to produce frequency-specific results. Furthermore, some anticonvulsants are equally


efficacious based on their abilities to shorten seizure duration; however, this type of EEG analysis

can be used to differentiate drugs based on seizure quality. Finally, just as contemporary

earthquake warning systems rely on detection of early, high frequency mechanical waves, EEG

Fourier analysis may be used one day to warn clinicians of impending seizures, facilitating

therapeutic intervention.

Figures

Fig. 1. General overview of the program. CSV inputs are static and thus have fixed number of points and
sampling frequency (A). Via the command line, the user can adjust the duration of the EEG and downsample
the data (B). The user can adjust both the time and frequency bin sizes to produce a spectrogram based on the
EEG trace in B (C); additionally, the signal can be passed through a Butterworth filter and then analyzed in
the frequency domain (D).

CSV Read Versus Binary Load


50
Ratio of time-to-complete

40

30

20

10

0
1.E+00 1.E+02 1.E+04 1.E+06
Number of data pionts

Fig. 2. During runtime, loading binary files is significantly more efficient Fig. 3. EEG trace showing seizure activity. Panel A is 60 seconds in
than reading CSV files. The graph shows the ratio of time required to read duration while panel B is 2 seconds and shows individual spikes.
N number of data points in CSV versus binary format. The former is about
45X slower for 1 million points.
Fig. 4. Total power and spectrogram of status epilepticus in a rat, which Fig. 5. Seizure activity in the frequency domain, showing narrow-band
begins seizing at 5 minutes. Total length is 1 hour. The colormap shows peak activity at 6-7 Hz. The lower panel shows the corresponding band-
the power of each 2D bin in decibels. Time is binned into 30 second pass filter: 1 ≤ f ≤ 60 Hz.
intervals while frequency is binned at 1 Hz.

Equations
𝑖
Eq. 1: 𝐴(𝑡𝑖 )| ∀𝑖∈1…𝑁 {𝑡𝑖 = } A(ti) is a discrete function consisting of N data points with ti defined as shown.
𝑓
𝑖∗𝑘
Eq. 2: 𝐴′(𝑡𝑖 )|∀𝑖∈1…𝑁 {𝑡𝑖 = } A’(ti) is a downsampling of A(ti) by a factor of k.
𝑘 𝑓
𝑁
Eq. 3: 𝑁𝑇 = Average number of data points within each time bin
𝑘𝑇
𝑁𝑇 𝑁𝑇 Average number of data points within each 2D bin (i.e. within each frequency bin
Eq. 4: 𝑁𝑇𝐹 = =
𝑘𝐹 𝑘 𝑇 ∗ 𝑘𝐹 within each time bin)
𝑁
1 The Parseval relationship for a DTFS describing the equivalence of power in
Eq. 5: ∗ ∑|𝐴(𝑡𝑖 )|2 = ∑|𝐻(𝑥)|2
𝑁 amplitude and frequency domains.
𝑖=1 𝑥
𝐴2 Power is a function of the square of the amplitude of the signal. It can be converted
Eq. 6: 𝐼𝑑𝐵 = 10 ∗ log 10 into decibels by taking the logarithm base 10 relative to a reference amplitude (set at
𝐴2𝑟𝑒𝑓 1V in this case).

Tables
Symbol Meaning
A(t) Discrete function of electrical amplitudes in time
H(x) Discrete function of amplitudes in frequency, the DTFT of A
N Total number of data points
f Sampling frequency
k Downsampling factor
kT Number of bins across time
kF Number of bins across frequency
Table 1. List of symbols and their meanings.

References

Arif, H., Hirsch, L.J., Moeller, J. “EEG in the diagnosis of seizures and epilepsy.” UpToDate. 12.0, Aug.,

2014.

Lehmkuhle, M.J., Thomson, K.E., Scheerlink, W.P., Pouliot, W., Greger, B., Dudek, F.E. “A simple

quantitative method for analyzing electrographic status epilepticus in rats.” Journal of

Neurophysiology 101.3: 1660-1670, 2008.