Journal of Neuroscience Methods 152 (2006) 255–266
Efficient unsupervised algorithms for the detection of seizures in continuous EEG recordings from rats after brain injury Andrew M. White a , Philip A. Williams b , Damien J. Ferraro b , Suzanne Clark b , Shilpa D. Kadam b , F. Edward Dudek b , Kevin J. Staley a,∗ a
Department of Neurology, University of Colorado Health Sciences Center, 4200 E. 9th Avenue, Denver, CO 80262, USA b Department of Biomedical Sciences, Colorado State University, Fort Collins, CO 80523, USA Received 2 March 2005; accepted 15 September 2005
Abstract Long-term EEG monitoring in chronically epileptic animals produces very large EEG data files which require efficient algorithms to differentiate interictal spikes and seizures from normal brain activity, noise, and, artifact. We compared four methods for seizure detection based on (1) EEG power as computed using amplitude squared (the power method), (2) the sum of the distances between consecutive data points (the coastline method), (3) automated spike frequency and duration detection (the spike frequency method), and (4) data range autocorrelation combined with spike frequency (the autocorrelation method). These methods were used to analyze a randomly selected test set of 13 days of continuous EEG data in which 75 seizures were imbedded. The EEG recordings were from eight different rats representing two different models of chronic epilepsy (five kainate-treated and three hypoxic-ischemic). The EEG power method had a positive predictive value (PPV, or true positives divided by the sum of true positives and false positives) of 18% and a sensitivity (true positives divided by the sum of true positives and false negatives) of 95%, the coastline method had a PPV of 78% and sensitivity of 99.59, the spike frequency method had a PPV of 78% and a sensitivity of 95%, and the autocorrelation method yielded a PPV of 96% and a sensitivity of 100%. It is possible to detect seizures automatically in a prolonged EEG recording using computationally efficient unsupervised algorithms. Both the quality of the EEG and the analysis method employed affect PPV and sensitivity. © 2005 Elsevier B.V. All rights reserved. Keywords: Epilepsy; EEG; Animal models; Kainate; Seizure detection; Computer processing; Epileptogenesis; Radiotelemetry
1. Introduction A large fraction of epilepsy patients have poorly controlled epilepsy. Several recent conferences have addressed the need for better therapies for this patient population (Stables et al., 2002, 2003). These conferences recommended the development of more predictive epilepsy models to assess the clinical efficacy of drugs to suppress seizures and epileptogenesis. In the rat, such chronic epilepsy models include kainic acid (Ben-Ari et al., 1979; Nadler et al., 1978), pilocarpine (Turski et al., 1983), selfsustained status epilepticus (Lothman et al., 1993), and hypoxiaischemia (Williams et al., 2004). To determine latency to first seizure after injury, seizure frequency, and mean seizure duration, these models require
∗
Corresponding author. Tel.: +1 303 315 5679; fax: +1 303 315 4815. E-mail address:
[email protected] (K.J. Staley).
0165-0270/$ – see front matter © 2005 Elsevier B.V. All rights reserved. doi:10.1016/j.jneumeth.2005.09.014
long-term seizure monitoring. Previous attempts at seizure monitoring have employed simple behavioral observations (Hellier et al., 1998). These attempts suffered from the difficulties implicit in providing 24-h monitoring and from the inability to detect subtle or sub-clinical (non-convulsive) seizures. Continuous EEG monitoring can circumvent these problems. Digitization of the EEG data permits the use of computerized algorithms that automate the seizure detection process; this is a substantial improvement over visual analysis of thousands of hours of video or EEG data. However, long-term digital EEG monitoring generates massive data files, so that efficiency becomes an important factor in the design of the seizure detection algorithms. Computer algorithms for spike and seizure detection in human EEG recordings have been developed (Dumpelmann and Elger, 1999; Flanagan et al., 2003; Gotman, 1985, 1990, 1999). The detection techniques developed and marketed for humans are designed to evaluate data from large electrode arrays acquired over relatively short-term recordings (i.e. hours). The
256
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
algorithms are tuned to state, spike and seizure parameters found in human patients, and require significant computational resources. They are therefore not optimized for analysis of longterm (i.e., months-long) recordings of continuous EEG data from smaller electrode arrays acquired in animal models of epileptogenesis and chronic epilepsy. In addition, available analysis packages for such data are not in the public domain. In this paper, we describe the signal characteristics of seizures and spikes in two animal models of chronic epilepsy, and then discuss several computationally efficient algorithms used to identify seizures and spikes in continuously acquired radiotelemetric EEG data in these epileptic rats. We also report the sensitivity (true positives divided by the sum of true positives and false negatives, or the likelihood of detecting a true spike) and specificity (true negatives divided by the sum of true negatives and false positives, or the likelihood of identifying an instance where there is no event) of each seizure-detection algorithm.
2. Materials and methods 2.1. Animal models of chronic epilepsy One cohort of adult rats was implanted with EEG telemetry equipment (described below and in the companion paper by Williams et al., submitted), and 1–2 weeks later was treated with kainate as previously described (Hellier et al., 1998). A second cohort underwent perinatal hypoxic-ischemic injury (Rice et al., 1981; Williams et al., 2004) and then was implanted with radiotelemetry equipment at 6 weeks of age. 2.2. Radiotelemetry Fig. 1 shows the design of the EEG recording system (Data Systems International or DSI, Arden Hills, MN). Analog data from the DSI system were redigitized at 250 Hz using a 64-
Fig. 1. EEG radiotelemetry system. The rat was implanted with a radiotelemetry transmitter and placed in a cage above a receiver plate (cage not shown). The signal was frequency-encoded at 100 Hz and sent to the receiver plate. This digital signal was then converted to an analog signal, which was sampled at 250 Hz on an A/D board using routines written in Visual Basic.
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
channel PCI-DAS board (Computer Boards, Inc., Middleboro, MA) and then recorded using routines written in Visual Basic 6 (Microsoft). Three channels of EEG data were recorded, one from a subdural screw electrode and one from each hippocampus using 90-m Teflon-coated stainless steel wire. Three-channel EEGs from as many as 16 rats were recorded simultaneously. The digitization rate was adequate to detect seizures and interictal spikes. With 16-bit precision, 1 gigabyte (Gb) of data was produced per week per rat. A typical experiment lasted between 3 and 5 months, which resulted in over 20 Gb of data per rat. To investigate the consistency between electrographic and behavioral seizures, Samsung video recording systems were used to monitor each rat continuously during the entire experiment. Information was recorded on videotape and evaluated by trained personnel to determine the time, seizure score (as described in Racine, 1972), and daily rate of behavioral seizures. 2.3. Model of EEG signal 2.3.1. Mathematical model The EEG signal can be modeled as the sum of several components, i.e. signal = artifact + noise + state activity + epileptic activity 2.3.2. Artifact, noise and state We define artifact as that portion of the signal which was a result of an identifiable feature of the system, but that did not emanate from the brain whereas noise was the component of the signal that was not attributable to identifiable categories. Principal contributors to artifact included: jaw motion (chewing), cage removal, scratching, heart beat, drinking, digitization, severe head movements, and electrical artifacts of unknown source. Furthermore, state of alertness (“state”) influenced the signal. State activity involved the basal, non-epileptic rhythm of normal electrical signals of the rat. Often, a strong theta rhythm was seen (5–8 Hz), which was variable and depended on the activity level of the rat (sleeping versus awake). Changes in state often resulted in a significant change in the amplitude of the signal and/or resulted in a shift in the signal’s power spectrum. 2.4. Spikes 2.4.1. Spike detection issues Two of the seizure detection methods we tested relied on spike counting. We therefore developed and tested two methods for spike detection. Detection of EEG spikes is complicated by variation in spike amplitude and morphology, variation of the signal with state, presence of noise and artifact, and the large volume of data to be processed. Spike amplitude can change within a recording, and is sometimes less than the amplitude of the noise (they can still be identified because of similarity in morphology to larger spikes and their presence in multiple channels). Spike morphology is dependent on the respective locations of spike generation, placement of the recording electrode, and the field created by the neuronal circuit that produces the spike.
257
Variation in spike morphology can be attributed to the differences in lesions between rats. Further, as the lesions changed with time and new electrical pathways are created, the electrical signal from a given rat also can change. Spikes evolve over a short period of time (several minutes) during a period in which they occur in rapid succession. The change in morphology complicates application of techniques such as wavelet analysis (Clarencon et al., 1996). Because the rat is not in the same state all of the time, the EEG is non-stationary; its statistical characteristics vary as a function of state. Noise and artifact both have characteristics that closely mimicked those of an interictal spike, and therefore parameter values must be set to eliminate noise and artifact while still being able to detect true spikes. Finally, because these experiments yield large volumes of data, sophisticated and time consuming algorithms (such as those used in human EEG) are not practical. Instead, relatively simple algorithms must be developed to scan these months-long recordings. Also, with large databases, even random noise can simulate spikes at times. There are several parameters that can be examined to determine if a spike is real or simply artifact (i.e., the feature set). These include the spike amplitude and duration, shape, difference from local and global mean, maximum slope, second derivative and the presence of nearby spikes (“spiking epochs”) or spikes in other channels (synchrony). 2.4.2. Spike detection algorithms Two techniques were extensively investigated using a “test” data set. This test data set was composed of 13 EEG recordings, each 24 h long from 8 different rats. 2.4.2.1. Multi-parameter windowing algorithm. The first algorithm identified all peaks within a restricted domain (typically 40 s) by establishing all local maxima and minima. It was assumed that state does not change significantly during that time. The parameters for each peak were then determined, and if they were sufficiently different from the average parameters, a spike was recognized. One specific problem with a method of this type was that if much of the restricted domain was filled with spikes, the sensitivity was poor because the mean and standard deviation of the segment were influenced by the frequent spiking. The particular method that was being used in our investigation attempted to compensate for this by identifying obvious peaks and eliminating these from the calculation of background parameters, thereby negating their impact on the mean and standard deviation in a particular segment. An estimate of the effectiveness of this algorithm was obtained by considering the detected spikes and their polarity. In some rats, a single type of spike occurred at a particular time and this event almost always had the same polarity in a limited time period. Therefore, if one compared the number of positive to negative spikes, it was possible to estimate the number of true spikes. The effectiveness was much more difficult to determine if there were multiple foci, or if the spikes were biphasic. 2.4.2.2. Maximum slope algorithm. The second technique used a single parameter, the maximum slope computed over 16 ms
258
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
Fig. 2. Basis for unsupervised interictal spike detection. (A) This illustrates the varied morphology of interictal spikes, which made it impractical to use rectangular amplitude-time windows to identify interictal activity. This EEG was from a rat made epileptic by kainate administration 8 weeks earlier. (B) Normal EEG power spectrum, demonstrating that EEG power falls off logarithmically with frequency. (C) Spikes (arrow) in the EEG (green) had a large first derivative (red). The blue trace is the first derivative (dV/dT) after rectification and rescaling (right Y axis) to illustrate the dV/dT of the interictal spike vs. normal EEG activity. Numbers under the top trace are time (ms). (D) Plot of dV/dT amplitude vs. frequency for a sine wave demonstrated that dV/dT was proportional to frequency. Because any signal can be represented by a series of sine waves, the dV/dT of any signal (including EEG) is proportional to its frequency composition. Thus dV/dT amplitude can be used as a proxy for the power spectra. (E) Amplitude histogram of dV/dT of normal rat EEG activity (computed over 24 h of EEG at 16 ms time intervals), plotted on a log scale. The dV/dT amplitude histogram falls off logarithmically with amplitude, similar to the power spectrum of the EEG in Fig. 3B. Red line is least-squares fit to the dV/dT amplitude histogram for dV/dT amplitudes < 100 V/s. (F) Long-term effect of kainate treatment on the dV/dT amplitude histogram (same rat as in (E), 1 month after kainate). Frequent interictal spikes recorded from a rat produced an excess of high-amplitude first derivatives such as those shown in this figure. Red line fit as in (E).
(five data points), as the criterion for selection of spikes. This method has the advantage that multiple different spike morphologies could be identified, such as those which might result from two different neuronal circuits (Fig. 2A). This method was based on the observation that the power of the normal EEG signal decreased logarithmically with the frequency (Freeman et al., 2003; Matthis et al., 1981). While the power could not
be rapidly computed, the first derivative or slope of a signal with respect to time could be easily calculated. The slope was proportional to the frequency content of the signal (Fig. 2D), and as shown in Fig. 2B, the distribution of slopes of the EEG signal had a characteristic logarithmic distribution. First derivatives that had values outside the expected distribution of first derivative values were identified as spikes. Mechanistically, this
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
was done by rectifying the EEG data and then computing the maximum slope over 16 ms intervals; only positive slopes were included in the distribution (Fig. 2C). An upper limit of normal for slope amplitude was established from a histogram of slope values, usually generated from 24 h of EEG data. Histograms from normal EEG activity fell off logarithmically with increasing slope amplitude (Fig. 2E). By linearly extrapolating the log number of slopes with values near 0 (these slopes were least likely to be associated with a spike), the normal activity in an EEG containing spikes could be identified. This cutoff between normal and abnormal activity was then set at a slope value where the probability of normal EEG activity was 0.1 and the probability of spike was 0.9, based on the extrapolation from low-valued slopes. If there were spikes in the signal, these would result in the presence of segments with slopes greater than the cutoff value. Fig. 2E and F show the change in the histogram that occurred when seizure or spike activity were present. This method was very rapid, did not require the user to input any parameter thresholds, and was insensitive to changes in spike morphology which may occur over time. However, it was sensitive to the presence of high-frequency artifacts. 2.5. Seizure detection Seizure detection algorithms generally rely on the ability to identify high amplitude, correlated activity. In our study, the most invariant aspect of seizures included the presence of multiple spikes and of high degrees of autocorrelation (based on the regular appearance of spikes). We evaluated four algorithms. Mathematically, seizure detection is similar to that of spike detection. This is a mapping from n EEG points (n dimensional space) to a binary one-dimensional space (seizure or not). The morphology of a seizure varied significantly from one rat to the next and from one time period to another. The detection of seizures was significantly easier than that of spikes and the use of many different metrics resulted in good accuracy, as long as the signal-to-noise ratio was large and the amplitude of the signal was relatively large during the seizure compared to the normal EEG activity. The detection was however complicated by decay of the signal over the weeks of recording, varying EEG seizure morphologies and by interictal noise and artifact in the signal. The same statistical quantities and principles which applied to spike detection also applied to seizure detection. The number of true negatives had to be established to determine the specificity. In this study, the three parameters calculated were (1) the positive predictive value, defined as true seizures detected divided by the total number of seizures detected, (2) the sensitivity, and (3) the specificity. To establish a seizure detection algorithm it was necessary to identify specific changes that occur to the signal when a seizure occurs. Using this knowledge, an algorithm was developed that exploited these characteristics. Characteristics of seizures included: (1) an increased number of spikes with either amplitudes or slopes that were greater than those found in a normal EEG recording, (2) an increased average amplitude of the signal over that found in the remainder of the record—this typically increased over time during each seizure, as well, and was usu-
259
ally significantly less than the average at the beginning of the seizure, (3) an increased power of the signal (amplitude squared) over time during the seizure—this was generally increased over the background, especially towards the end of the seizure, (4) a progression from low-amplitude, high-frequency to higheramplitude, lower-frequency signals during the seizure, (5) a decreased randomness of the signal and an increased autocorrelation in both slopes and amplitudes compared to the normal record, (6) a significant decline in the amplitude of the signal following the completion of a seizure (post-ictal period), (7) a relatively fixed frequency of spikes during a seizure, and (8) a high likelihood of a preceding high-amplitude, wide sharpwave that had morphology similar to that found in interictal spikes. These characteristics were exploited using different metrics. In the following sections, we present several detection methods. 2.5.1. Spike frequency method The first method for seizure detection used the presence of a fixed number of spikes over a given interval to define a seizure. In this algorithm, a seizure was detected if more than 20 spikes occurred over a 10-s period. This algorithm was extremely robust if one could properly identify spikes (i.e., all seizures that have been recorded to date did have 20 spikes over a 10-s period, and there were no instances of non-seizure activity producing 20 true spikes over a 10-s period). As discussed in the previous section, this could be difficult because the detection method may have either falsely identified spikes (false positive) or may have failed to identify them (false negative). The presence of largeamplitude, high-frequency artifact (such as that obtained when the rat is removed from the receiver plate) was interpreted as a spike and resulted in a false positive event (see Section 3). Further, high frequency noise could fool the algorithm (cut-off limit could be set too high), which resulted in the non-detection of both spikes and seizures. In this algorithm, the method used to identify spikes was the maximum upslope method (described in Section 2). This algorithm made no use of the shape of the spike, the correlation of the signal from one time to the next, nor, the evolution of the seizure over time. 2.5.2. Coastline method This algorithm used the sum of the absolute value of the distances from one data point to the next as a metric (Korn et al., 1987), i.e. metric1 =
1000
ABS(xi − xi−1 )
i=1
where x represents the EEG voltage, ABS represents the absolute value function, and the sum was over 1000 points (4 s). This method used the fact that during a seizure there was a relatively high-amplitude, high-frequency signal. It failed when there was large amplitude noise (some of this noise was 10–20 times greater in amplitude than that found during a seizure). It also failed if the amplitude of the signal during the seizure was less than that encountered during the normal recording.
260
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
2.5.3. Power method The third algorithm detected seizures using either the signal magnitude (defined as the sum of the absolute deviations from the mean) or the signal amplitude squared over a fixed window (1000 points or 4 s). metric2 =
1000
(xi − µ)2
i=1
where x was the vector of EEG data points and µ was the mean value for the 1000 points. This algorithm also failed when the magnitude of the noise was too high relative to that of the seizure signal. This algorithm exploited neither the increased temporal autocorrelation of the EEG during seizures, nor the presence of spikes in the EEG signal. 2.5.4. Autocorrelation method When the EEG data were reviewed, it was noted that seizures could be detected even when 30,000 points were compressed to 1000 display points. The data sampling rate was 250 Hz and therefore the time interval between data points was 4 ms. This indicated that the dimensionality could be significantly reduced without impacting detection probability. When this reduction was made, the 30-point EEG data set (120 ms) which mapped into the width of a single pixel was converted into a vertical line with ends at the minima and maxima of the set. The characteristics that made the seizure identifiable at this resolution included: (1) the increased height over baseline of these lines, (2) the increased correlation of the minima and maxima from one pixel to the next, (3) the presence of an initial spike, (4) the increased amplitude as the seizure progressed, and (5) the dramatic decrease in amplitude after the seizure ended. This algorithm used the first and second of these characteristics as a “first pass” test in the identification of seizures. Because all seizures identified contained repetitive spikes with similar maxima and minima, and the frequency of spikes was in the range of 10–20 Hz during a seizure, one would expect a correlation between the maxima and minima of successive 30-point intervals. This correlation was readily apparent to the EEG reviewer and allowed the quick review and identification of seizures at low resolution. The correlation held well if each 30-point interval contained a spike; however this was not always the case. In our experience, the correlation algorithm was much more likely to find a spike in the succeeding 60-point interval (240 ms), (i.e., although each spike might be encompassed in a 30-point interval, the inter-spike distance could be as great as 60 points). In the case of noise, the relatively high amplitude sharp waves typically did not correspond with repetitive phenomena and therefore did not have a high degree of correlation from one interval to the next. The correlation described above was used as the basis for the autocorrelation method. This method used none of the information present in the morphology of the individual spikes of the seizure; instead it compressed the vector of 30 data points into a two dimensional vector containing only the maximum and minimum over the 30-point interval. This dramatically increased the processing speed while only marginally reducing the informa-
tion content (and therefore the accuracy) of the method. When the method was combined with the requirement that a fixed number of spikes be present in the interval, it further increased the specificity (i.e., decreased the number false positives). The mechanics of this method are as follows. A set of 3000 points (12 s) was considered. The maximum and minimum values for each 30-point group were computed. These were termed max(Si ) and min(Si ) where Si represents a group of 30 points. One could simply sum the difference between the max and min over the 100 values of the set, but this would not take into account the correlation of the different time periods, and therefore would still be subject to noise. Instead, only the portion of the signal that was within the boundaries of the next two groups was summed, yielding the expressions: HVi = min[max(Si ), max(max(Si+1 ), max(Si+2 ))] and LVi = max[min(Si ), min(min(Si+1 ), min(Si+2 ))] where HVi was the ith high value and LVi was the ith low value. Two metrics resulted from this formulation; one was simply the sum of the difference, i.e. metric3 =
100
(HVi − LVi ).
i=1
The mechanics of the method are illustrated in Fig. 3. The size of the red arrows demonstrated the difference in metric 3 for spikes whose amplitudes were highly correlated to the two subsequent EEG windows (Fig. 3A) versus spikes with low correlations to the subsequent two EEG windows (Fig. 3B). In the case where significant EEG autocorrelation was present, metric 3 is large. Where there was little EEG autocorrelation, metric 3 is much smaller. We also estimated the correlation of spikes to nearby EEG windows using metric 4, which normalized each 3-pixel overlap to the range of the index pixel (30-point group), i.e. 100 HVi − LVi metric4 = max(Si ) − min(Si ) i=1
Although metric 4 was much more indicative of the actual autocorrelation, we used metric 3 for seizure detection because the denominator in metric 4 made it susceptible to lowamplitude, high-frequency noise, which resulted in significantly decreased specificity. The autocorrelation method provided a very sensitive indicator for seizure detection (i.e., all seizures had well-correlated, relatively high amplitude spikes). However, this method was not specific in our test studies. To improve specificity, this method was combined with method 1, spike frequency analysis. A seizure was indicated if there were more than 40 spikes in the 3000-point interval. This additional seizure criterion filtered out very high-amplitude noise which did not contain relatively high frequency spiking and resulted in significantly improved specificity.
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
261
Fig. 3. The autocorrelation metric was determined by the overlap in range of the first 30 data points with the second 60 points. (A) When a strong periodic signal exists (such as that found during a seizure), the overlap was significant (as was seen in this case). The green lines indicate the range of the first 30 data points, the blue indicates the range of the succeeding 60 points, and the red indicates the overlap. (B) When there was an isolated spike or non-repetitive artifact, the contribution to the metric was small compared to the range.
2.6. Statistical tests When hypothesis testing is performed there are four outcomes. They are indicated in the matrix below: Test result
Actual state
Positive Negative
True True positive False negative
False False positive True negative
Two other measures used more commonly in hypothesis testing are sensitivity and specificity; sensitivity is the likelihood that should there be a spike or seizure, it is detected (i.e., the number of true positives divided by the sum of the number of true positives and false negatives) and specificity is the likelihood that if an event is not a true spike or seizure, that an event is not detected (i.e., the number of true negatives divided by the sum of the number of true negatives and false positives). It is desirable to make both of these as large as possible. Methods to increase both sensitivity and specificity include increasing the signal-to-noise ratio (i.e., decreasing artifact and noise), or improving the detection method (i.e., better characterization of a true spike). A true negative occurs whenever a spike or seizure is not present, and none is detected. The number of epochs in an EEG record that do not contain spikes or seizures depends on the epoch size. We used the approximation that the epoch size should be the average duration of a spike (100 ms) or a seizure (60 s). The positive predictive value is defined as the true positives divided by the sum of the true positives and false positives and does not rely on the number of true negatives. This gives an indication as to what fraction of detected spikes are actual spikes. 3. Results 3.1. EEG recordings In all of the recordings shown below there were three channels. The first corresponded to subdural leads and the second two corresponded to bilateral hippocampal leads.
3.1.1. Artifacts Frequent artifacts included jaw motion, cage removal, and scratching. Less frequent artifacts included heart beat, drinking, digitization, and severe head movements. Jaw motion artifact was a high-frequency, high-amplitude signal (Fig. 4A) which differed from spikes in that it was shorter in duration with higher frequency components than interictal spikes. It was often present in multiple channels, but it was sometimes more prominent in a given channel. It was present intermittently for hours at a time, could be present when spikes were occurring, but was not identifiable during seizures because the rats do not chew food during seizures. Cage removal artifact resulted in a characteristic signal produced when the rat was removed from the receiver plate (Fig. 4B). This signal appeared as a flat line, but with intermittent high frequency, high amplitude activity which dwarfed all other activity. Scratching artifact (Fig. 4C) was a common problem, but was reduced dramatically through improved experimental technique (closing the surgical wound so that there were no exposed surfaces and clipping toenails post-operatively and later as needed). Scratching artifact was rhythmic but did not have the progression seen with seizure activity. Bare, exposed wires made it significantly worse. Artifacts due to heart beat (Fig. 4D), drinking, digitization (Fig. 4E), and severe head movements were less common, but required detection. Unknown artifacts were items which had a characteristic signal, but which could not be attributed to a specific source. 3.1.2. Spike recordings Fig. 5A demonstrates the spikes produced immediately after kainate treatment. Fig. 5B demonstrates periodic spikes that were observed at lower frequency 7 h after the kainate treatment; these spikes occurred at a significantly lower frequency. After an initial decrease in spike frequency immediately after kainate, the interictal spike frequency increased as seizure frequency increased. For the same rat, Fig. 5C shows the spikes produced 2 months after kainate treatment. The polarity of the major spike is the same as that of spikes that occurred during the kainate treatment (this occurred in all rats). Note also the presence of a down-going spike best seen in channels 2 and 3 on the left hand side of the figure. This likely represents a different spike focus and occurred multiple times throughout the record.
262
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
Fig. 4. (A) Three-channel recording of jaw motion artifact. The top channel corresponded to dural EEG and the bottom two were from bilateral hippocampal electrodes. The artifact was most obvious in channel 3. This artifact was often present in one or more channels and because of its high slope, significantly disrupted many of the algorithms. Note however that the amplitudes of the spikes were not highly autocorrelated, as was found in true seizures. (B) Removal of rat from receiver plate, resulting in spikes. This led to very high-amplitude spikes which were sporadic and also yielded flat spots. (C) Scratching artifact. This was present in many of the earlier implanted rats. In these, the rats were able to scratch the wires directly, creating this artifact. Ensuring that the wires were short and that the surgical wounds healed dramatically reduced this artifact. (D) Heart beat artifact in channel 2 and jaw artifact in channel 3. The presence of heart beat artifact was quite rare, but could simulate a seizure. It, however, did not progress with time. (E) Digitization artifact. Note that there appears to be steps in the amplitude. The lack of exact steps was due to the multiple signal processing steps and conversions, which resulted in a small amount of noise. Note the small signal amplitude and the fact that the last two channels were essentially the same. All traces were from rats 13–38 days after kainate treatment except for 4D which was recorded prior to treatment.
Fig. 5D shows some of the complexities involved in identifying spikes. The different morphologies were likely the result of multiple spike foci. The presence of different foci and the variation of the spike morphology from a single spike focus made the task of automated spike identification much more difficult. At least two different types of interictal spike patterns were seen. The first pattern was random. Spikes varied in amplitude and duration, but their morphology was relatively constant. The second type of spike pattern was periodic. Spikes in this pattern were generally of greater amplitude and duration than randomly timed spikes. During epochs of periodic spiking, the spikes appeared at relatively constant intervals, but the interspike interval was much longer than observed during a seizure (cf. Figs. 6 and 7). These epochs appeared without warning, then decayed (in both amplitude and duration), and then reappeared multiple times without totally disappearing. They appeared to be similar in morphology to the initial periodic spikes present during the kainate treatment of the rat. Fig. 6A shows a spiking epoch after kainate treatment. This epoch began as well demarcated periodic spikes which then tran-
sitioned into a record with poorly defined spikes like that shown in Fig. 6B. 3.1.3. Seizure recordings Fig. 7A demonstrates a typical EEG seizure recording. Note that there was an initial spike, a slow buildup of amplitude, and a decrease in frequency. After the seizure was over, there was a significant decrease in baseline amplitude. The beginning, middle and end are more clearly seen in Fig. 7B–D. It can be seen that the seizure began as a low-amplitude and high-frequency signal and progressed to a high-amplitude and low-frequency signal, followed by a sudden cut off. This pattern was typical for almost all seizures. Fig. 7E shows a seizure that occurred immediately after kainate treatment, while periodic spiking also was occurring. Some of the seizures were solely electrographic with no behavioral component (as evidenced by the lack of seizure activity noted on the videotape). An example of one of these is given in Fig. 7F. As can be seen, there was essentially no difference in the electrical characteristics that would allow one to distinguish the behavioral seizure from a purely electrographic seizure. Both had an initial preictal spike with the standard progression from low amplitude high frequency to high
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
263
Fig. 5. (A) EEG recording within 1 h of the completion of kainate treatment showing continuous spikes. Note that these spikes were present in both hippocampal and subdural electrodes. The frequency was slightly greater than 2 Hz. (B) EEG recording 7 h after kainate treatment showing continuous spikes. Again, the spikes were present in both leads, but the frequency decreased to about 0.3 Hz. Although the morphology of spikes changed somewhat, the direction did not change. (C) A single spike 2 months after kainate. Note that spikes occurred either singly as in this figure, or occurred in clusters (epochs; cf. Fig. 6A). (D) Complex spiking pattern with multiple morphologies (86 days after kainate treatment). There are at least two spike morphologies in the figure above.
Fig. 6. (A) Spiking epoch 1 month after kainate treatment. There were several epochs each day for the kainate treated rats. Although spikes were produced with a constant frequency for a short period of time, these epochs, like seizures, also evolved over minutes. The evolution was not as orderly as for a seizure discharge, but typically the spikes became higher in frequency and lower in amplitude, until they finally blended in with the normal brain activity. (B) The haze containing spikes which follows a spiking epoch. Note that there were many spikes present of lower amplitude and higher frequency, but with the same polarity as those found earlier in the spiking epoch. In this figure, these are most visible in channel 3. Traces shown were recorded 38 days after kainate treatment.
amplitude lower frequency signal and a relatively quiet post-ictal period. 3.2. Comparison of seizure detection methods A comparison of all methods described above is given in Table 1 below for the test set of 75 seizures. The total recording time in this test set was 312 h. The results given are those from the channel that produced the results closest to
that obtained from expert review of the EEG data (each rat has three channels). The channel with the best signal always corresponded to one of the hippocampal electrodes. The three characteristics used to assess each model were: (1) sensitivity, (2) specificity and (3) positive predictive value. As discussed in Section 2, we used an approximation of the number of true negatives (the amount of recording time divided by the average time of a seizure) to obtain the specificities given in Table 1.
Table 1 Results of seizure detection in the test data set of EEG recordings from eight different rats using both hippocampal and subdural leads in kainate and HIE models Method
True seizures identified
False positives
Positive predictive value
Sensitivity
Specificity
Spike frequency Coastline Power Range autocorrelation
59 59 75 75
3 76 317 3
95 44 18 95
78 78 95 100
99.98 99.59 98.31 99.98
Seizure detection algorithms are described in Section 2.
264
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
Fig. 7. (A) Typical seizure (89 days after kainate treatment). Evident in this figure are many of the features of a typical seizure, including the initial spike, increase in amplitude with time, and dramatic drop off of activity following the seizure. (B) Beginning of the seizure shown in (A). This shows the initial spike on the left of the figure (large arrow) and the slow buildup in amplitude. The morphology of the initial spike was the same as that of many of the interictal spikes and of the spikes found during spiking epochs. (C) Middle of the seizure. During this portion, the amplitude increased or was relatively stable and the frequency decreased. In this example, as in others, there was incomplete uniformity in the progression. (D) End of the seizure. At the end of the seizure the frequency dropped off dramatically and the waveforms became increasingly more complex, sometimes having multiple peaks on top of each spike. Note also that following the seizure, the amplitude decreased dramatically (asterisk), usually to levels below that of normal activity. (E) Seizure in the middle of continuous spiking 3 h after kainate treatment. The seizure was differentiated from background spiking by higher frequency discharges (hence the increase in ink density) and progression from low amplitude to high amplitude. This was not as evident in the periodic spikes on either side of the seizure. (F) Seizure which was non-convulsive (i.e., purely electrographic). Note that the morphology was the same as that found for seizures which were convulsive, with the initial spike, amplitude buildup and suppression following the seizure (58 days after kainate treatment).
The results show that algorithms relying on EEG spike frequency, coastline or power had lower sensitivity. This was because in these methods, noise and artifact had greater impact; in these methods most seizures were detected, but there were many false-negatives. If the parameters were set to reduce falsenegatives, many seizures were not detected. From this table, it appears that the use of spike detection combined with autocorrelation yields the optimal sensitivity and specificity. 4. Discussion This paper describes several methods used to detect seizures in rat EEG recordings. For these methods, the positive predictive value, sensitivity and specificity were determined and compared to expert analysis of the data (the current standard). These methods are relatively simple to program and all yield relatively
high accuracy. They depend largely on the presence of multiple high amplitude spikes within a specified interval that are well correlated with each other. Because of the simplicity, the algorithms can be run on relatively inexpensive computers (Pentium PC’s) and can process large amounts of data in a reasonable amount of time. The expense is restricted to program development and PC procurement. This compares favorably with the expense involved in procuring other larger software packages that are used for human spike detection, and which require more sophisticated algorithms and more computer power. 4.1. Spike detection A fundamental issue with all spike detection techniques is the lack of a gold standard, due to disagreement among encephalographers as to what is and is not an EEG spike. While most
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
265
experts agree on large-amplitude spikes, as spike amplitude approaches background amplitude, there is significant disagreement as to what is a spike (Wilson et al., 1996, 1999) or seizure (Wilson et al., 2003). The earliest methods of spike detection used simple parametric rules that employed either the time or frequency domain with moving windows (Gotman, 1985). Subsequent improvements included detection of the state of the patient (sleep versus awake) and elimination of artifacts associated with that state (Gotman and Wang, 1991, 1992). Other algorithms have been employed using such techniques as neural networks (Gabor et al., 1996; Gabor, 1998; James et al., 1999; Ko and Chung, 2000), independent component analysis (Kobayashi et al., 1999, 2001, 2002), and wavelet analysis (Khan and Gotman, 2003). Most recently, non-linear techniques (Jing and Takigawa, 2000; Lehnertz, 1999; Li et al., 2003; Litt and Echauz, 2002; Navarro et al., 2002) have been employed using such quantities as the correlation dimension, Lyapunov exponent, Kolmogrov entropy, marginal predictability and similarity index. These are measures of the chaos or disorder of the system; the rationale is that when a seizure occurs, the neuronal system becomes more ordered, requiring fewer dimensions or parameters to characterize the electrical activity. Several factors directed our development of spike detection algorithms. First, spike morphology frequently changed over the course of the months-long experiment. This could be due to skull growth, electrode movement, gliosis and shrinkage of the brain, ongoing circuit reorganization, or all of the above. Second, the large size of our data sets precluded use of transforms of the data due to computational constraints. However, we found that differentiation of the data provided many of the advantages of spectral analysis without the computational cost (Fig. 3), and that this method was most insensitive, of methods tested, to changes in spike morphology. However, layered neural networks might provide similar accuracy and efficiency. Spike detection was not as accurate as seizure detection, due to, in part, issues related to the difficulties identifying small spikes (as discussed above), and in part to the transient nature of the signal, which was mimicked by several artifacts. In the present study we have used a referential montage in which one lead is located in the hippocampus and the other is on the dura. We expect that use of bipolar electrode montages in which both leads are located within the hippocampus will significantly increase the accuracy of our detection methods by improving the signal to noise ratio, and this will permit a more quantitative study of spiking.
human seizures (Bragin et al., 1999; Walczak et al., 1992), perhaps related to the decreased complexity, simpler geometry and far smaller volume through which seizure activity was conducted and distorted in the rat brain. Third, the signal-to-noise/artifact ratio was much higher in the rat, because depth electrodes and subdural screws were used. Finally, the states of arousal and sleep were much less complex in the rat. Considering all these factors, development of an algorithm for the automated processing of rat EEG was less complicated than an equivalent algorithm for humans, and very high accuracies were achieved through relatively simple algorithms. The situation concerning seizure detection is far more favorable than for spike detection. Because a seizure is a much more prolonged and stereotyped event, there are few artifacts that mimic seizures. Further, there are more characteristics of seizures (see Section 2) that can be used to increase the specificity of detection without sacrificing sensitivity. Thus we were able to obtain essentially 100% sensitivity and specificity when the additional features of seizure activity, such as high temporal autocorrelation, were included in the detection scheme. The inclusion of these additional features did not significantly increase computational time, because the process could be performed stepwise, only applying the more sophisticated algorithms to candidate regions which had passed initial testing. The ability to detect seizures using unsupervised easily programmed algorithms on inexpensive platforms makes feasible the use of chronic epilepsy models for studies of both epileptogenesis and screening of the efficacy of candidate anticonvulsant drugs. It is possible, but time consuming, to screen the data by expert EEG evaluation. It is however much more efficient and less costly to use these automated tools.
4.2. Seizure detection
4.4. Future directions
Our algorithms exploited several differences between the rat and human EEG that made detection of seizures simpler in animals versus humans. First, the number of spikes and seizures was significantly greater in rat recordings (Hellier et al., 1998; Sutula et al., 1981; Wilson et al., 1996). Therefore, the need for extremely high sensitivity and specificity was not as critical in these rat models, and this was particularly true for the seizure detection algorithms that relied on spike frequency. Second, there was less morphological variability in rat seizures recorded from chronic sub-dural or depth electrodes versus
It is our plan to continue to increase the accuracy of both seizure and spike detection. Improvement in the signal-tonoise/artifact ratio and improvement of the detection algorithm should improve the unsupervised detection of seizures. The signal-to-noise/artifact ratio can be improved by refinements in the electrode placement (dural versus hippocampal versus other locations) and montage (bipolar versus monopolar/referential) and by altering the type and composition of the EEG electrodes. As pointed out in this paper, the noise and artifact have already been greatly reduced.
4.3. Limitations of this study Our algorithms were designed for animal use, and exploit the size and simple geometry of the animal’s brain, the simplified sleep architecture, and the abundance of spikes to rapidly identify seizures. Most of these features are not present in the human EEG, so the applicability of our algorithms to humans is unknown. As shown in Fig. 4C and D, several artifacts can produce high-frequency noise with good autocorrelation. These algorithms are best suited for use with EEG data obtained from intracranial electrodes with high signal-to-noise characteristics.
266
A.M. White et al. / Journal of Neuroscience Methods 152 (2006) 255–266
The second improvement concerns the detection method. Although we used the two characteristics which best distinguished seizures from other signal types (presence of spike and autocorrelation), there were other features of the seizures that could be exploited (e.g. presence of pre-ictal spike and postictal suppression) to improve our detection algorithms. Further, in our analysis, we used only a single channel. There are clustering algorithms (Gotman, 1999) which allow one to consider multiple channels, increasing the probability of spike or seizure detection. There are also additional methods such as neural networks which are currently being investigated and may result in efficient algorithms with improved sensitivity and specificity. Acknowledgement Work performed above was sponsored by NIH Grant #NS34360. References Ben-Ari Y, Lagowska J, Tremblay E, Le Gal La Salle G. A new model of focal status epilepticus: intra-amygdaloid application of kainic acid elicits repetitive secondarily generalized convulsive seizures. Brain Res 1979;163(1):176–9. Bragin A, Engel Jr J, Wilson CL, Vizentin E, Mathern GW. Electrophysiologic analysis of a chronic seizure model after unilateral hippocampal KA injection. Epilepsia 1999;40(9):1210–21. Clarencon D, Renaudin M, Gourmelon P, Kerckhoeve A, Caterini R, Boivin E, et al. Real-time spike detection in EEG signals using the wavelet transform and a dedicated digital signal processor card. J Neurosci Meth 1996;70(1):5–14. Dumpelmann M, Elger CE. Visual and automatic investigation of epileptiform spikes in intracranial EEG recordings. Epilepsia 1999;40(3):275–85. Flanagan D, Agarwal R, Wang YH, Gotman J. Improvement in the performance of automated spike detection using dipole source features for artifact rejection. Clin Neurophysiol 2003;114:38–49. Freeman WJ, Holmes MD, Burke BC, Vanhatalo S. Spatial spectra of scalp EEG and EMG from awake humans. Clin Neurophysiol 2003;114(6):1053–68. Gabor AJ. Seizure detection using a self-organizing neural network: validation and comparison with other detection strategies. Electroencephalogr Clin Neurophysiol 1998;107:27–32. Gabor AJ, Leach RR, Dowla FU. Automated seizure detection using a self-organizing neural network. Electroencephalogr Clin Neurophysiol 1996;99:257–66. Gotman J. Seizure recognition and analysis. Electroencephalogr Clin Neurophysiol Suppl 1985;37:133–45. Gotman J. Automatic seizure detection: improvements and evaluation. Electroencephalogr Clin Neurophysiol 1990;76:317–24. Gotman J. Automatic detection of seizures and spikes. J Clin Neurophysiol 1999;16(2):130–40. Gotman J, Wang LY. State-dependent spike detection: concepts and preliminary results. Electroencephalogr Clin Neurophysiol 1991;79:11–9. Gotman J, Wang LY. State dependent spike detection. Electroencephalogr Clin Neurophysiol 1992;83:12–8. Hellier JL, Patrylo PR, Buckmaster PS, Dudek FE. Recurrent spontaneous motor seizures after repeated low-dose systemic treatment with kainate: assessment of a rat model of temporal lobe epilepsy. Epilepsy Res 1998;31(1):73–84. James CJ, Jones RD, Bones PJ, Carroll GJ. Detection of epileptiform discharges in the EEG by a hybrid system comprising mimetic, selforganized artificial neural network, and fuzzy logic stages. Clin Neurophysiol 1999;110:2049–63.
Jing H, Takigawa M. Comparison of human ictal interictal and normal nonlinear component analyses. Clin Neurophysiol 2000;111:1282–92. Khan YU, Gotman J. Wavelet based automatic seizure detection in intracerebral electroencephalogram. Clin Neurophysiol 2003;114:898–908. Ko CW, Chung HW. Automatic spike detection via an artificial neural network using raw EEG data: effects of data preparation and implications in the limitations of online recognition. Clin Neurophysiol 2000;111:477–81. Kobayashi K, Akiyama T, Nakahori T, Yoshinaga H, Gotman J. Systematic source estimation of spikes by a combination of independent component analysis and rap-music. I. Principles and simulation study. Clin Neurophysiol 2002;113:713–24. Kobayashi K, James CJ, Nakahori T, Akiyama T, Gotman J. Isolation of epileptiform discharges from unaveraged EEG by independent component analysis. Clin Neurophysiol 1999;110:1755–63. Kobayashi K, Merlet I, Gotman J. Separation of spikes from background by independent component analysis with dipole modeling and comparison to intracranial recording. Clin Neurophysiol 2001;112:405–13. Korn SJ, Giacchino JL, Chamberlin NL, Dingledine R. Epileptiform burst activity induced by potassium in the hippocampus and it regulation by GABA-mediated inhibition. J Neurophysiol 1987;57(1):325–40. Lehnertz K. Non-linear time series analysis of intracranial EEG recordings in patients with epilepsy—an overview. Int J Psychophysiol 1999;34:45–52. Li D, Zhou W, Drury I, Savit R, Non-linear. Non-invasive method for seizure anticipation in focal epilepsy. Math Biosci 2003;186:63–77. Litt B, Echauz J. Prediction of epileptic seizures. Lancet Neurol 2002;1:22–30. Lothman EW, Bertram IIIrd EH. Epileptogenic effects of status epilepticus. Epilepsia 1993;34(Suppl 1):S59–70. Matthis P, Scheffner D, Benninger C. Spectral analysis of the EEG: comparison of various spectral parameters. Electroecephalogr Clin Neurophysiol 1981;52(2):218–21. Nadler JV, Perry BW, Cotman CW. Intraventricular kainic acid preferentially destroys hippocampal pyramidal cells. Nature 1978;271(5646):676–7, Feb 16. Navarro V, Martinerie J, Le Van Quyen M, Clemenceau S, Adam C, Baulac M, et al. Seizure anticipation in human neocortical partial epilepsy. Brain 2002;125:640–55. Racine RJ. Modification of seizure activity by electrical stimulation. II. Motor seizure. Electroenceph Clin Neurophysiol 1972;32:281–94. Rice JE, Vannucci RC, Brieriey JB. The influence of immaturity on hypoxicischemic brain damage in rat. Ann Neurol 1981;9:131–41. Stables JP, Bertram EH, Dudek FE, Holmes G, Mathern G, Pitkanen A, et al. Therapy discovery for pharmacoresistant epilepsy and for diseasemodifying therapeutic: summary of the NIH/NINDS/AES models II workshop. Epilepsia 2003;44(12):1472–8. Stables JP, Bertram EH, White HS, Coulter DA, Dichter MA, Jacobs MP, et al. Models for epilepsy and epileptogenesis: report from the NIH workshop, Bethesda, Maryland. Epilepsia 2002;43(11):1410–20. Sutula TP, Sackellares JC, Miller JQ, Dreifuss FE. Intensive monitoring in refractory epilepsy. Neurology 1981;31(3):243–7. Turski WA, Cavalheiro EA, Schwarz M, Czuczwar SJ, Kleinrok Z, Turski L. Limbic seizures produced by pilocarpine in rats; behavioral, electroencephalographic and neuropathological study. Behav Brain Res 1983;9(3):315–35. Walczak TS, Radtke RA, Lewis DV. Accuracy and interobserver reliability of scalp ictal EEG. Neurology 1992;42(12):2279–85. Williams PA, Dou P, Dudek FE. Epilepsy and synaptic reorganization in a perinatal rat model of hypoxia-ischemia. Epilepsia 2004;45(10):1210–8. Wilson SB, Harner RN, Duffy FH, Tharp BR, Nuwer MR, Sperling MR. Spike detection i correlation and reliability of human experts. Electroencephalogr Clin Neurophysiol 1996;98:186–98. Wilson SB, Scheuer ML, Plummer C, Young B, Pacia S. Seizure detection: Correlation of human experts. Clin Neurophysiol 2003;114:2156–64. Wilson SB, Turner CA, Emerson RG, Scheuer ML. Spike detection II. Automatic perception-based detection and clustering. Clin Neurophysiol 1999;110:401–11.