Optimal Parameters of Adaptive Segmentation for Epileptic Graphoelements Recognition

Manual review of EEG records, as it is performed in common medical practice, is very time-consuming. There is an effort to make this analysis easier and faster for neurologists by using systems for automatic EEG graphoelements recognition. Such a system is composed of three steps: (1) segmentation, which is a subject of this article, (2) features extraction and (3) classification. Precision of classification, and thereby the whole recognition, is strongly affected by the quality of preceding segmentation procedure, which depends on the method of segmentation and its parameters. In this paper, Varri’s method for segmentation of real epileptic EEG signals is used. Effect of input parameters on segmentation outcome is discussed and parameters values are proposed to achieve optimal outcome suitable for the following classification and graphoelements recognition. Only the results of segmentation are presented in this paper.


Introduction
EEG analysis is one of the most common parts of neurological examination.Manual review of the whole EEG record is very time-consuming; therefore, there is an effort to develop a system that helps physicians to make their work faster and easier.The system for automatic EEG graphoelements recognition introduced in [1], [2] is one of them.This system consists of three steps.First, the signal is divided into small quasi-stationary segments.Then features of these segments are computed and segments are divided into classes based on a classification process.Precision of classification, and thereby the whole recognition, is strongly affected by the quality of preceding segmentation procedure, which depends on the used method of segmentation and its parameters.Exact values of these parameters have to be set according to a specific character of individual records (frequency, density of epileptic spikes, sharpness etc.), therefore it is difficult to design a default set of parameters that can be used for all EEG recordings in general.This paper describes new combinations of parameters for adaptive segmentation (AS) of EEG signal with a method using two connected windows sliding together along the signal [1], its impact on segmentation result and optimal setting of parameters for epileptic graphoelements recognition.In our previous study [3] the possible application of this method was demonstrated on artificial epileptic signals consisting of single epileptic spikes and spike-wave complexes.The suitable ranges of parameters WL, STEP and DWL (see description in Tab. 1) for optimal results on artificial signals were proposed in [3].In this paper we add several new parameters improving the method and we describe their optimal settings for a proper segmentation of real EEG data.
Segmentation in general is a process of dividing signal into short segments that are believed to be quasi-stationary.These segments can be either of fixed length or of variable length, i.e. fixed or adaptive segmentation.The adaptive segmentation was originally proposed by Bodenstein and Praetorius in 1977 [4].They combined the linear prediction algorithm (first applied on EEG by Lopes de Silva [5]) and two windows (fixed and moving).Similar method introduced by Michael [6] uses the same fixed and moving windows but the segments are divided according to the change of autocorrelation function.Appel and Brandt [7], [8] introduced a method also based on two windows but the reference window is prolonging with every move of the test window, so there is no gap between the reference and the test window.None of the methods mentioned above are suitable for multichannel online segmentation due to desynchronization during the boundary identifying process that forced us to segment each channel separately [1].
Skrylev [9] first came up with a method using two connected moving windows sliding together along the signal, which was later modified by Nieminen [10].These two windows also use Varri's method [1], where the amplitude and the frequency difference are calculated for each of them.Then the total difference (also called global G function, shortly Gf) is calculated.The biggest advantage of using the two connected windows is the suitability for multichannel segmentation, where instead of segmenting each channel separately we can use two connected multidimensional windows reaching along all the channels.
Agarwal and Gotman's segmentation method [2] is based also on two connected sliding windows but nonlinear energy operator (NLEO) was used as a difference measure for the G function calculation.This operator was improved in [11].The method was further improved by Hassanpour [12], who applied stationary wavelet transformation (SWT) on signal before NLEO calculation.This improved method is called INLEO.
A new approach to the issue of the adaptive segmentation was introduced by Anisheh [13].The EEG signal is first filtered by SWT, then the fractal dimension (FD) is calculated using Katz algorithm [14] and the G function is calculated as a variation of FD in the last step.There are two important parameters for FD calculation: window length and overlapping percentage of two windows.Few articles [15][16][17] deal with optimization of these two parameters.First, the evolution algorithm particle swarm optimization (PSO) was used in [15], then the genetic and the imperialistic evolution algorithm was applied in [16] and PSO with mutation and bee colony optimization (BCO) was used in [17].Moreover, in [16] signal is filtered by Kalman filtering instead of SWT.
In this paper, we use Varri's algorithm [1].The main advantage of this method is the computational simplicity, which makes it very suitable for processing long-term EEG recordings.However, the method is accurate enough to capture all observed changes in the signal which we intend to demonstrate in this paper.It should be noted that Varri's method is not a method of spike detection but of adaptive segmentation with a purpose of signal preparation for the following classification in systems for automatic EEG graphoelement recognition.
The aim of this study is to propose optimal values of AS input parameters for the outcome suitable for following classification and graphoelements recognition.To achieve that, first of all the effects of all parameters will be described.Different sets of parameters values and corresponding quality of segmentation will be then manually tested and proper parameters values for detection of specific epileptic graphoelements (i.e.single spike, spike-wave complex and whole epileptic activity) will be proposed in this study.

Method and Material
Varri's method of the adaptive segmentation (see Fig. 1) was used on real EEG data.The principle of this method is based on two connected windows sliding along the signal (see Fig. 2).
The length of both windows together is defined by the parameter Window Length (WL) (i.e. one window has size of half WL).The amplitude (A dif ) and frequency (F dif ) dif-1.Two connected windows of size WL are set on the beginning of the signal 2. Amplitude and frequency difference are calculated for each window 3. Global function Gf is calculated from the differences 4. Gf is scanned for local maxima by detection window of DWL size 5.If local maximum is found, boarder is set to this position 6.Both windows move together by STEP parameter forward along the signal Fig. 2. Principle and basic parameters of Varri's method [1] of the adaptive segmentation.In the upper part, there are two connected windows sliding along the signal sample in time.In the lower part, there is a corresponding G function in time.
ference is separately calculated for each window as follows: N is the number of samples in one window and x i are particular values of the signal, where i goes from 1 to N. The total difference (also called G function, shortly Gf) is computed by equation: Weights k 1 and k 2 are empirically set in [1] as 1 and 7, respectively.L and R mean left and right window.The G function is calculated for each position of the sliding windows.This movement is defined by parameter STEP (Fig. 2).Then the local maxima of the G function are found by the detection window, which slides along the G function.The size of the detection window is defined by the parameter Detection Window Length (DWL).This detection process is depicted in Fig. 3.
To mark a local maximum as a segment boundary, it must be higher than a threshold, defined as parameter THR (in Fig. 2 and 3 shown as a dotted horizontal line).The main purpose of this threshold is to avoid a detection of small fluctuations of G function caused by signal noise.In this paper THR is set as the mean value of G function calculated from the block of data being processed [1].Two new parameters are introduced in this paper.Both of them take place in processes performed after the segmentation itself and their purpose is to modify segmentation results.The reason of their usage is to overcome some mistakes that can appear during segmentation.The first new parameter added in this paper is called Minimal Segment Length (MSL).This parameter is able to decrease oversensitivity of AS that can appear when low values of WL parameter are set.The low WL values are needed for segmentation of short graphoelements (i.e epileptic spikes), but lead to creation of too short redundant segments as shown in Fig. 4. MSL parameter can be used for suppres-sion of these redundant segments by choosing only one of the most significant boarder per time region with size defined by parameter's value.The maximal value of MSL should not be higher than the length of the fastest (shortest in time) observed graphoelement, otherwise this graphoelement cannot be correctly boarded by segmentation.
Another new parameter is called Zero Optimization (ZO).This parameter determines the size of surrounding area around marked boundary in which the algorithm looks for a position, where the EEG graphoelement has the minimal value and the boundary is shifted to that position.This process imitates visual segmentation performed by the physicians.Very often the boundary is set in the middle of the rising or falling edge of the graphoelement, whereas physicians would intuitively move this boundary to the start of the rising edge, respectively end of the falling edge (i.e. the minimum value).The effect of ZO parameter is shown in Fig. 5.This parameter does not serve to repair wrongly performed segmentation, but its purpose is to modify results of correct segmentation in pursuit of making it more natural to the physician.Therefore, the usage of ZO parameter is not necessary but can be used for personalization of segmentation.With combination of parameters values we can set different level (details) of the segmentation.In Tab. 1 we summarize all input parameters used in this paper and their short description.
In this paper, AS was applied on real EEG recordings that were recorded in the Hospital Na Bulovce, Prague, Czech Republic, on device BrainQuick, Micromed with sampling rate of 128 Hz and 12 bit AD convertor.The data was saved on a disk and filtered by band-pass filter 0.4-70 Hz.Then the data was processed by program EEG viewer [18] developed by one of the authors (D.K.).

Results and Discussion
There are three basic ways to segment epileptic signal (segmentation detail levels), as you can see in Fig. 6.First possibility is to differentiate only sharp spikes from the rest of the signal.However, this segmentation is not often used due to very small diagnostic benefit.The second possibility is to segment the signal into individual or groups of spikewave complexes and the least detailed level distinguishes between epileptic seizure activity and EEG background activity.Each of these segmentation levels requires different approach and setting of different parameters.
Appropriate level of segmentation must be chosen to achieve precise results leading to correct graphoelement recognition.The exact used level depends on the character of the segmented signal.The least detailed segmentation level is suitable for signals with long compact seizure activities.On the other hand, more detailed segmentation is useful for signals with self-occurred spikes or short epileptic episodes.In the next part, the optimal combination of parameters for different segmentation levels is proposed.
On signal of self-occurred epileptic spike-wave complex in Fig. 7, different sets of parameters for segmentation     of spike only and spike-wave complex are shown.It is obvious that choosing smaller values of parameters WL and STEP is necessary for the segmentation of very short graphoelements (i.e.fast single spikes).On the other hand, higher values of parameters are more suitable for detection of the whole spike-wave complex.In Fig. 11, we show few similar segmentations as these mentioned above.First, segmentation of individual complexes is shown, separation of bigger groups of complexes with similar characteristic is demonstrated in the middle, and detection of the whole seizure is shown at the bottom of the figure.Signal used for these segmentations has slightly slower frequency of spikes and due to that also parameters used for particular segmentations are slightly bigger than in the previous example.This demonstrates that every individual signal needs a little bit different parameters to obtain optimal results of segmentation.
Table 2 summarizes values of parameters used in previous segmentations.Exact values depend on individual signal character.In general, for slower signals containing long consistent epileptic seizures it is more suitable to choose higher values of parameters and conversely, smaller values are better for records with fast single complexes or single spikes.Referred ranges are tentative only and their purpose is to make physician's work easier.So far it is necessary to always check the results of segmentation and manually tune the parameters values according to the physician's need.

Conclusion
In this paper input parameters of Varri's adaptive segmentation method are analyzed on EEG epileptic records and parameters values improving a method precision are proposed.Quality of segmentation is crucial for following classification in systems for automatic graphoelements recognition.
We have tested the method on 20 real EEG signals and proposed proper settings suitable for individual types of signals.We have proposed parameter's values for three segmentation levels, i.e. single spikes, spike-wave complexes and for separation of epileptic seizure from the rest of the signal.
Problem of setting proper parameters of AS is hard to grasp because we don't work with a single parameter but with a combination of several of them.Therefore, it is necessary to set parameters with consideration of the others.Especially parameters WL and STEP have a high level of interaction (with each other).Also the character of individual signals has a huge effect on the segmentation result.For slower signals containing slow waves it is more suitable to choose higher values of parameters than in case of faster signals that consist primarily of sharp spikes and conversely.This fact also complicates the global conception of the segmentation issue and of creating generally working ranges of parameters.Therefore using of values suggested in this paper leads to proper segmentation of most common signals.
Also the ways of tuning exact values of parameters described above can apply in general.It is worth mentioning that in systems for automatic graphoelements recognition, AS is followed by classification, which classifies segments to appropriate classes and all redundant segments are grouped into one common class of segments.
The result of segmentation is so far always necessary to be checked and parameters values manually tuned according to the physician's need.Here there is space for improvement of the method.If the computer learns first on calibrating etalons how to segment the signal properly, it might be then able to make this check and additional parameters tuning on its own, or at least to suggest proper changes to the physicians.
We didn't deal with parameter THR (Threshold) in this study.Its value was set as mean value of G function calculated from the block of data being processed but with its more appropriate tuning we could probably achieve another improvement of the method.

Fig. 3 .
Fig. 3. Scheme of local maxima detection mechanism using detection window with size defined by parameter Detection Window Size (DWL).

Fig. 4 .Fig. 5 .
Fig. 4. Example of AS performed without Minimal Segment Length (MLS) parameter (a) and with MLS = 100 ms (b).Very sensitive segmentation and creation of too short redundant segments is observed on the left (i.e. with MSL = 0 ms).With the use of MSL = 100 ms (b), this effect is decreased.Moreover, the spike-wave complexes are segmented properly (as the physicians are used to).Above there is the EEG epileptic signal, below its corresponding G function in time.Vertical lines denote the segment boundaries.Other used parameters are WL = 0.5 s; STEP = 100 ms; DWL = 10 ms; ZO = 0 ms.

Fig. 6 .Tab. 1 .
Fig. 6.Three different levels of segmentation (single spikes, spike-wave complexes and whole seizure activity) depending on different combinations of input parameters.Exact segmentation level is chosen by a physician according to character of segmented signal.

Fig. 7 .
Fig. 7. Different sets of parameters for segmentation of a) typical spike-wave complex; b) spike only obtained by smaller values of WL and STEP parameters.

Fig. 8 .Fig. 9 .
Fig. 8. Separation of the signal into individual spike-wave complexes.Some very similar neighboring complexes were merged into one segment.

Fig. 10 .
Fig. 10.Separation of the whole epileptic seizure from the EEG background activity by increasing of WL and STEP at the same time.

Fig. 11 .
Fig. 11.Different segmentation of slower signal containing sharp spikes and waves.Parameters used for segmentation are slightly higher here than in the previous case because of the slower frequency of graphoelements in the signal.As well as in the previous case, higher values of parameters are applied to detect larger segments.

Figures 8 -
Figures 8-10 show different segmentations of longer epileptic activity consisted of fast short complexes and parameters optimized for it.