Automatic Detection of Generalized Epileptic Seizures

Sensed signals from the human body provide information about the health status. The basic clinical methods used for the diagnosis of neural disorders include electroencephalography (EEG). There are a number of algorithms for automatic localization of epileptic graphoelements. Currently, the most widespread disease of the brain is epilepsy which can be diagnosed by using EEG. We will further deal with three following methods: simple arithmetic detector, detector based on median filtering and the combined application of previous methods.


Introduction
Epilepsy is the most wide-spread disease of the brain diagnosed by EEG.This is reflected in the form of repeatedly uncontrolled, sudden changes of brain activity called seizures.The name comes from the Greek word "epilambien" meaning seizures fall.Manifestations of epilepsy are very heterogeneous.From a clinical point of view, epilepsy is defined as a fault of consciousness, behavior, motoric disorder or sensitive functions, or combination thereof.In one patient, there may be various forms of seizures that differ from one to another such as twitching of muscles or prolonged seizures.Epileptic seizure is physiologically sudden and transient cerebral cortical activity.This disorder is uncontrollable and is accompanied by electric discharge in the gray matter of the brain.Electric discharge du-ration is in the order of seconds, minutes or, in severe cases, several hours.The patient can be absolutely without health problems in the time between seizures.
Generalized epileptic seizures are bilaterally symmetrical and have no beginning of focuses.These seizures are accompanied by disorder of consciousness or motor skills.It is assumed that the epileptic discharges begin in reticular formations and affect the whole brain diffusely.The seizures may have convulsionary, i.e. spasmodic, and non-convulsionary, i.e. non-spasmodic character.There are 5 basic types of generalized seizures: • tonic -clonic (grand mal) -there is an overall increase in convulsion accompanied by cramps especially in the facial area, • absence (petit mal) -failure of consciousness when a person can continue in previous activities, and does not perceive his surroundings, • clonic seizures -spasmodic status of the whole body, • tonic seizure -reflected as increased muscle tension, • myoclonic seizures [1], [2].
From a clinical point of view, epilepsy is defined as a fault of consciousness, behavior, motoric disorder or sensitive functions [3].
Imaging methods help to classify the epilepsy disease, particularly magnetic resonance of the brain which can detect structural abnormalities leading to the formation of an epileptic seizure.EEG has irreplaceable role in the diagnosis of epilepsy.

EEG Signal Processing
Our aim is to design an optimal algorithm for localization of epileptic graphoelements in the MATLAB programming language.The work deals with following three methods: simple arithmetical detector, detector based on median filtering and the combined application of simple arithmetic detector and median detector.In clinical practice the selection of computing speed of each method is important to obtain results as fast as possible.

Specification and Stabilization of EEG Recording
These basic technical parameters of EEG recording are used in clinical practice: • device sensitivity (100 µV per cm), • frequency band (from 0.5 Hz to 110 Hz), • sampling frequency (from 100 Hz to 256 Hz), [4].
The measured EEG data has a small amplitude and therefore the signal has to be amplified for further processing.The frequency range of signal is modified by analog filters before using A/D converter or after conversion by using digital filters [4].

Morphology of Epileptic Seizures
Morphology of epileptic seizure signal is constantly changing with age and can transform from one type to another according to the progress of the disease.Epileptic signal is most commonly found in the temporal area and gradually spreads to different parts of the brain.Epileptic EEG wave is always accompanied by a sharp first wave followed by a slow wave.The epileptic wave is within a certain frequency interval, typically 2-6 Hz, although this is not always the case.Two types of curves are observed in patients with epilepsy: interictal curve (between seizures, i.e. ordinary record) and ictal curve (recording during a seizure) [5].
The onset of epileptic seizure in the EEG is accompanied by: • sudden change of frequency of the EEG record, • a sudden drop of amplitude, • sudden increase of amplitude [5].

Signal Processing and Development of Automatic Detection
There are a number of algorithms for the automatic localization of epileptic graphoelements.They are based on different principles.We created three methods: • simple arithmetical detector, • detector based on median filter, • combination detector [4].

1) Simple Arithmetical Detector (SAD)
SAD consists of 3 basic components: • difference filter which is mathematically the first derivation of signal, • product operator which is an important component of the arithmetic detector.The function of the operator is to smooth out and modify the resulting signal, • border comparison is the last component of the detector.Boundary crossing indicates the presence of searched components.Threshold can be set according to subjective judgment (experimentally), or on the basis of statistically relevant patterns [4].
The principle of SAD is depicted in Fig. 1.

2) Detector Based on Median Filter (MF)
The second algorithm, which we chose in the final design, can be used to detect epileptic graphoelements based on median filter.The principle of the algorithm is as follows: • MF eliminates pulses shorter than the length of the filter window, • subtraction of filtered EEG signal, i.e. signal without spikes from the original (with spikes) results in a signal that includes a pulse component (spikes), • the resulting signal is smoothed out, adjusted and finally compared with threshold values.
The disadvantage of MF is its sensitivity to rapid EMG activity and resistance to sharp jump in the signal [4].

3) Combination Detector (CD)
Combined application of both of the above mentioned algorithms.The epileptic spikes are detected when both algorithms recognize spike activity [4].

Software Solution
All algorithms were designed in the MATLAB programming language.
The algorithm used for localization of epileptic graphoelements was divided into several parts.The individual functions are called recursively and share necessary variables known as global variables.In MAT-LAB we used built-in functions from signal processing toolbox and the result is shown in application with graphical user interface (GUI).For this purpose we used the MATLAB tool named GUIDE for creating GUI application.

EEG Data File
The EEG data recorded from patient is stored in EDF file (with ".edf" extension).This type of file has specific data structure.The file contains 32 channels -19 channels are EEG channels; the others are supplementary channels such as EMG, ECG, EOG, etc.The international electrode placement system "10/20" is used in our experiment.The data sample rate is set to 256 with 12-bit resolution.We were working with real data which included artifacts of biological and technical origin.The first necessary step in processing of EEG data was to remove 50 Hz AC noise from all channels using digital filter.
In the Fig. 2 we can see a 10 second EEG recording with 19 channels after removing power line noise.Epileptic activity is present between 3 rd and 8 th second.
For better clarity, we randomly selected 1 channel from all EEG channels.The selected channel is further processed for demonstration.In Fig. 3 we can see the 15th channel from the recording shown in Fig. 3.

Frequency Mapping
In neurology the analysis in frequency domain helps to diagnose the disease, e.g.deceleration of the brain  activity is characteristic for brain tumors or epileptic seizures [6].
Frequency mapping shows a graphical presentation of the brain activity -frequency mapping.We chose 10 second segment in which epileptic brain activity is detected (Fig. 4).We used theoretical knowledge for correct frequency mapping and we defined the frequency ranges of EEG waves.These frequencies were loaded into the corresponding alpha, beta, theta and delta domain matrix.
Frequency analysis has great a significance in medicine, e.g.lower frequencies in frontal part of brain indicate onset of epileptic seizures, etc.

Simple Arithmetical Detector (SAD)
The aim of this detector is to find epileptic graphoelements.In the first step, the frequency of epileptic components is shown by applying band pass filter.Application of band pass filter reveals the necessary frequency components of epileptic graphoelements in the range from 10 Hz to 25 Hz.This frequency range is determined by width of epileptic spike (70-200 ms).In the following steps, it is important to keep in mind that digital filters cause a signal time shift.The shift can be approximately determined as a half of the filter order.The signal after application of pass band filter is shown in Fig. 5.The epileptic spikes are amplified by first derivation of signal (difference filter).
Product operator is an important component of the SAD.The function of the said operator is to smooth out and rectify the resulting signal.The most important step in creating the SAD algorithm was to set the threshold.We consider the following scenario -the actual limit, in our case, is a vector with length equal to that of the applied signal, determining the threshold where we can locate epileptic discharges.The threshold level is set experimentally.Threshold exceedance indicates the presence of epileptic spike in the original EEG signal (Fig. 6).The SAD algorithm is applied to the original signal adjusted by filters and detected epileptic spikes are denoted by color markers (Fig. 7).

Detector Based on Median Filter (MF)
The second algorithm we employed was based of MF detector.An important preliminary step in MF is to appropriately set the length of window that removes pulses shorter than the length of this window.Length of the MF window is calculated as a proportion of the sampling frequency and the frequency of epileptic spike.For demonstration purposes, we applied MF with order of 10 on the same EEG signal as in previous detector.The resulting signal is shown in Fig. 8.The spikes were partially removed.
Components of pulse signal are obtained by subtracting the filtered signal -without spikes, from the original signal -with spikes (Fig. 9).
The resulting signal is smoothed out, rectified and compared with the threshold (Fig. 10).The threshold is determined experimentally for all EEG channels in the entire recording.Threshold exceedance indicates the presence of epileptic spikes.
As with SAD, MF algorithm is applied to the original signal modified by filters and detected epileptic area is denoted by blue squares (Fig. 11).

Combination Detector (CD)
We combined all previous procedures to form a CD.A problem occurred with displaying the desired epileptic elements because the combination of filters causes information loss about the width of spikes intervals.Instead of displaying areas of epileptic activity directly within the graph, the epileptic spikes are denoted by blue squares overlaid with red diamond character (Fig. 12).As we can see in the Fig. 12, the arithmetical detector detects sudden change of magnitude which does not represent a spike.This magnitude change is not detected as spike when using a detector based on the median filter.Epileptic spikes are detected when both algorithms recognize spike activity.
Fig. 12: EEG channel after application of CD.

Application of Detectors in GUI
In the graphical user interface (GUI) we created buttons "Single arithmetical detector", "Detector based on median filter", "Combination detector" for each filter separately.
We applied the created algorithms to EEG recording with 19 channels.The algorithms were applied gradually, channel by channel.The localization of epileptic graphoelements is denoted by an asterisk (*) and ring (o) above the spikes (Fig. 13).
The recording contains various artifacts mainly of biological origin.In Fig. 14 the motion artifact caused by chewing muscles is present in all channels.Our algorithm is not yet robust against these types of artifacts.Therefore false detection of epileptic spikes can occur.

Conclusion
We created three detectors for automatic epilepsy localization in MATLAB.The algorithm is designed for files in EDF format.Each of the detectors produces certain errors caused by artifacts.One type of artifact -the eye blink artifact, can be removed by algorithm described in [7].
Reliability of localization algorithm of each detector was compared with real clinical detection (epileptic spikes were marked by doctor).Based on a simple statistical processing we can qualify which detector is the most accurate.The lowest error rate is achieved by MF and CD with fixed limits of detection.The recording has 71.43 % accurate localization of graphoelements with MF and CD.SAD has the largest error rate.This may be caused by high sensitivity of the detector to various types of artifacts.The reliability of designed algorithms can be increased by other algorithms based on different principle, e.g. as in [8].
Epilepsy seizures can be the first sign of brain tumors.Additional diagnosis of brain tumor is possible via imaging methods such as computer tomography and magnetic resonance.Contrast agents are also used for enhanced detection of pathological tissues.

Fig. 4 :
Fig. 4: Graphic presentation of brain activity -frequency mapping in the epileptic area.

Fig. 13 :
Fig. 13: Localization of epileptic graphoelements in the tool GUIDE using MF.
In 2006 he graduated (M.Sc.) at the Department of Electromagnetic and Biomedical Engineering of the Faculty of Electrical Engineering at University of Zilina.He defended his Ph.D. in the field of technical cybernetics in 2009 at the Department of Measurement and Control of the Faculty of Electrical Engineering and Computer Science at VSB-Technical University of Ostrava; his thesis title was "Detection of eye artefacts in EEG record".Since 2009 he is working as a tutor with the Department of Electromagnetic and Biomedical Engineering in Zilina.His scientific research is focusing on digital signal processing of biological signals and biomedical image processing.Dagmar FAKTOROVA received her M.Sc.and Ph.D. from University of Zilina.Her research interests include microwave technique in nondestructive testing, sensor systems and interaction of electromagnetic field with biological systems.