Figures
Abstract
Epilepsy is a prevalent neurological disorder that affects approximately 1% of the global population. Approximately 30-40% of patients respond poorly to antiepileptic medications, leading to a significant negative impact on their quality of life. Closed-loop deep brain stimulation (DBS) is a promising treatment for individuals who do not respond to medical therapy. To achieve effective seizure control, algorithms play an important role in identifying relevant electrographic biomarkers from local field potentials (LFPs) to determine the optimal stimulation timing. In this regard, the detection and classification of events from ongoing brain activity, while achieving low power consumption through computationally inexpensive implementations, represents a major challenge in the field. To address this challenge, we here present two algorithms, the ZdensityRODE and the AMPDE, for identifying relevant events from LFPs by utilizing time series segmentation (TSS), which involves extracting different levels of information from the LFP and relevant events from it. The algorithms were validated validated against epileptiform activity induced by 4-aminopyridine in mouse hippocampus-cortex (CTX) slices and recorded via microelectrode array, as a case study. The ZdensityRODE algorithm showcased a precision and recall of 93% for ictal event detection and 42% precision for interictal event detection, while the AMPDE algorithm attained a precision of 96% and recall of 90% for ictal event detection and 54% precision for interictal event detection. While initially trained specifically for detecting ictal activity, these algorithms can be fine-tuned for improved interictal detection, aiming at seizure prediction. Our results suggest that these algorithms can effectively capture epileptiform activity, supporting seizure detection and, possibly, seizure prediction and control. This opens the opportunity to design new algorithms based on this approach for closed-loop stimulation devices using more elaborate decisions and more accurate clinical guidelines.
Citation: Galeote-Checa G, Panuccio G, Canal-Alonso A, Linares-Barranco B, Serrano-Gotarredona T (2025) Time series segmentation for recognition of epileptiform patterns recorded via microelectrode arrays in vitro. PLoS ONE 20(1): e0309550. https://doi.org/10.1371/journal.pone.0309550
Editor: Gennady S. Cymbalyuk, Georgia State University, UNITED STATES OF AMERICA
Received: December 3, 2023; Accepted: August 9, 2024; Published: January 24, 2025
Copyright: © 2025 Galeote-Checa et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: The algorithm implementations and experimental results that support the findings of this study are openly available in Zenodo repository (https://doi.org/10.5281/zenodo.10154332).
Funding: This work was partially supported by the European Union (https://research-and-innovation.ec.europa.eu/index_en) through grants 824164 (HERMES, with Principal Investigators TSG and GP) and 101070908 (CROSSBRAIN, with Principal Investigator BLB).
Competing interests: The authors have declared that no competing interests exist.
Introduction
Epilepsy is a prevalent neurological disorder that affects approximately 1% of the global population [1]. The standard treatment of epilepsy relies on medical therapy; however, 30-40% of the patients respond poorly, if at all, to anti-seizure medications, falling into Drug-Resistant Epilepsy (DRE) patients. Surgical removal of the epileptic focus is the current gold standard for those DRE patients. However, the success of ablative surgery highly depends on the accurate identification of the seizure focus. Brain stimulation has emerged as a promising and less radical alternative to ablative neurosurgery. In recent years, there has been a rapid growth of brain implantable devices, driven by the recent contributions in wireless power transmission techniques [2–4], flexible electronics for implantable devices [3, 5], and device design miniaturization [6–8]. Among the diverse devices under pre-clinical and clinical research, NeuroPace (Mountain View, CA), which is the first FDA-approved responsive neurostimulation system for focal epilepsy, offers a median seizure reduction range of 50-70% across different studies [9]. Given the promising results in seizure suppression by responsive brain stimulation and the latest advances in brain implantable devices, the growth of these devices for treating epilepsy is expected to accelerate in the next years. However, important aspects such as long-term viability, biocompatibility, power harvesting, and the need for more efficient and optimized algorithms make clinical results still improvable.
To operate effectively, brain stimulation devices should detect relevant electrographic biomarkers to determine the optimal stimulation timing and pattern to suppress, or ideally prevent, the seizure. Typically, local field potential (LFP) recordings are used for this purpose. Various biomarkers of interest, such as high-frequency oscillations (HFOs) [10–12], can be detected using embedded algorithms in the implantable device, allowing low latency real-time seizure suppression. In essence, the identification of those different biomarkers in the LFP would help to create decision models for closed-loop brain stimulation. However, the identification of electrographic biomarkers remains challenging due to their diverse characteristics in terms of morphology, time/frequency features, and their correlation with seizure events [12]. To address this challenge, various algorithms have been proposed, such as principal component analysis [13], linear support vector machine [14], approximate entropy [15], K-nearest neighbor and naïve Bayes classification [14], feature extraction using support vector machines [16], or complex multi-feature-based decision models [17]. These algorithms are complex and computationally intensive, and as such their potential for real-time operation is limited. More power-efficient approaches such as phase synchronization in multichannel recordings [18], multilevel wavelet transform [19], Izhikevich neural networks [20], auto-ranging threshold detection [21], or the Wiener algorithm [22], have proven more effective real-time seizure detection in hardware implementations.; However, the main drawbacks are associated with energy and memory consumption, as well as reduced performance caused by simpler implementations due to hardware constraints.
Designing efficient algorithms requires reducing three main aspects: computation, memory, and power consumption. By reducing the computational cost, we can also decrease power consumption. This involves: (i) reducing algorithm complexity by optimizing the number and type of operations performed by it, (ii) minimizing memory access, (iii) increasing parallelism, and (iv) optimizing hardware architecture. Following these principles, we propose two novel algorithms that focus on optimizing computation and memory. Based on the principles of optimization, we have developed two innovative algorithms that aim to reduce computational complexity by minimizing the number of operations required and lowering memory usage. Additionally, our algorithms address the issue of complex and recursive computations, which can be inefficient and time-consuming. By prioritizing efficiency and effectiveness, we hope to create algorithms that can be easily implemented and utilized in a variety of settings. A time series segmentation approach is used to detect and classify epileptiform events within LFPs. This method involves dividing a continuous signal into discrete segments that share common characteristics. The goal is to identify common patterns, states, or behaviors within the data, which will provide varying levels of information. [23, 24]. In the scope of this work, time series segmentation can be used to divide LFPs into distinct categories such as spiking events, firing patterns, or different network states. This approach can help manage a large amount of data and facilitate the application of various algorithms to post-process these segments, such as seizure prediction or control. The objective of this work is to classify ictal and interictal events in LFP data based on their temporal and morphological characteristics. We also aim to determine the current state of the brain network in real time. The principal goal is to ensure that the algorithms we propose have low computational complexity, thereby making them suitable for hardware implementation. We have achieved this goal by developing two new algorithms and validating them through microelectrode array (MEA) recordings of epileptiform activity generated by mouse hippocampus-cortex (CTX) slices treated with the convulsant drug 4-aminopyridine (4AP). This model is widely used to study limbic ictogenesis in vitro. [25], as it offers several parallelisms with the most common type of DRE in humans, i.e., mesial temporal lobe epilepsy (MTLE), including the primary origin of ictal activity in the entorhinal cortex [26–29].
The two algorithms use different approaches; the first (ZdensityRODE) utilizes an adaptive z-score method, which uses a short-term memory strategy to provide a smooth detection of the brain’s states. The second algorithm (AMPDE) uses scalogram-based peak detection and density estimation in the signal for extracting events of interest determined by their density of excitation. Both algorithms incorporate a post-processing technique with a cumulative look-forward time integration based on their density and can distinguish among ictal discharges, interictal events, and baseline. The ZdensityRODE algorithm was designed for faster computation and reduced operations, while the AMPDE was designed for better adaptability to long-term variations but at the cost of more complex computation.
Materials and methods
Microelectrode array recording of epileptiform activity generated by brain slices
Horizontal hippocampus-cortex (CTX) slices (400 μm-thick) were obtained from 4-8 weeks old male CD1 mice. Epileptiform activity was acutely induced by treatment with 4-aminopyridine (4AP, 250 μM). Extracellular field potentials were acquired using a 6 × 10 planar MEA with TiN electrodes (diameter: 30 μm, inter-electrode distance: 500 μm) and a MEA1060 amplifier. Signals were sampled at 2 kHz, low-pass filtered at half the sampling frequency before digitization, and recorded to the computer’s hard drive via the McRack software. All recordings were performed at 32°C. The full methodological details describing brain slice preparation and maintenance can be found in [30]. Animal procedures were conducted in accordance with the National Legislation (D.Lgs. 26/2014) and the European Directive 2010/63/EU, and approved by the Institutional Ethics Committee of Istituto Italiano di Tecnologia and by the Italian Ministry of Health (protocol code 860/215-PR, approval date 24/08/2015). Animals were monitored daily and euthanized under deep isoflurane anesthesia, verified as the lack of reflexes upon feet, paws, and tail pinch, compliant with FELASA standards. The equipment for MEA recording and temperature control was obtained from Multichannel Systems (MCS), Germany. Fig 1 highlights the electrode mapping relative to the brain slice position on the MEA, showing the different regions from where the LFP signals are recorded.
(A) Mouse brain slice placed on a planar 6 x 10 MEA grid (grid separation of 500 μm). Electrodes are grouped by their position in the brain structures comprised within the brain slice preparation. (B) Representative MEA recordings from the electrodes marked as CTX in panel A. The epileptiform pattern comprises both interictal and ictal events. The inserts show representative instances of each event type at an expanded time scale.
Dataset preparation
A validation dataset was generated from 7 brain slices. Brain slices coupled to 60-channel MEAs provided 11 ± 5 (mean ± SD) valid electrodes. A total of 68 records, each being 30 minutes long, were extracted and then annotated. Epileptiform events were identified through a semi-automated process. Namely, an automated wavelet-based algorithm was first used to detect the events; then, the marked events were visually inspected and confirmed or manually corrected as required. This is detailed in [31]. Overall, the used dataset comprises a total of 521 ictal events and 6318 interictal events. LFPs were labeled as ictal, interictal, and baseline, coded as 2, 1, and 0, respectively. To ensure the homogeneity of the dataset, we established the following inclusion criteria: i) uniform sampling rate of 2 kHz to standardize disparate sample rates and ensure consistent recording precision; ii) records from the electrodes within the parahippocampal cortex (See Fig 1). All data and metadata are publicly available via the zenodo repository (10.5281/zenodo.10154332).
Experimental design: Parameter search and optimization procedure
All records were maintained for training in different scenarios, similar to online operation, under low and high SNR conditions, to avoid a possible overfitting of the algorithm. Table 1 summarizes the dataset characteristics for this experiment. Algorithms were trained with an optimization matrix including variations for each of the parameters of the algorithms. The complete set of combinations is described in Table 2, where the parameter search frame is detailed. The experimental protocol devised for this study is depicted in Fig 2. The dataset is divided into 70-30 test-validation splits. After running the algorithms in the training dataset, the best 10 scores were averaged. This particular number was chosen heuristically to obtain a winning combination. For recordings with low Signal-to-Noise Ratios (SNR) (< 20 dB), parameters were further fine-tuned before the validation stage, to improve the accuracy.
A) Compendium of MEA recording datasets. B) Annotated signals showing the three different patterns, highlighted in different colors: baseline (green), interictal (yellow) and ictal (red). C) Test/train split of the dataset. D) Experiment design block diagram with the sequence of stages chosen for the experimental stage.
Optimization matrix for the two algorithms. Combinations for each of the parameters of the algorithm and experiments.
Z-score Density-based Robust Outlier Detection Estimation (ZDensityRODE)
Since the LFP signal in the used dataset primarily consists of baseline activity, then we may presume that any deviation from the signal’s trend could indicate an interictal or ictal event. By analyzing the outlier’s temporal duration, proximity to other outliers, and magnitude, we could somewhat estimate the type of event it may represent. The ZdensityRODE algorithm utilizes the statistical Z-score test to determine outliers in data trends using the distribution’s historic mean and standard deviation. The Z-test is a reliable measure of variability that can be used to identify outliers. By using historical data, the algorithm can adjust to changes in amplitude caused by factors like electrode degradation. Once the outliers are identified through a z-score test, they are stored for later spike density analysis. The density of these events is evaluated using a lookup window that meets specific search criteria and then classified based on their temporal characteristics and density.
This algorithm can be configured using four parameters lag (λ), threshold (τ), influence (ι), and delta (Δ). The lag parameter determines how many past samples are considered for computing the historic average and standard deviation. A longer lag provides stability against rapid changes but increases memory load, while a shorter lag enables quicker adaptation to new information but increased variability. The threshold parameter sets the z-score level at which a data point is deemed significant, allowing for more precise detections based on signal features like the SNR. The influence parameter (ranging from 0 to 1) controls the weight given to incoming samples when recalculating averages and standard deviations, with 0 disregarding new data and 1 providing high adaptability. Lastly, the delta parameter defines the refractory time between peaks, crucial for pattern classification during the post-processing analysis of peak candidates. This parameter regards the duration of events and their separation in time. The algorithm workflow is depicted in Fig 3. The pseudocode for this algorithm is also provided in Code 1. The algorithm’s complexity was assessed, resulting in a O(n + m) complexity, where n is the input data size and m is the number of relevant outliers found in the signal. If the signal contains no outliers or those are very limited, the spike density classifier is much faster as there are fewer events to compare.
Block diagram with the workflow of the Z-score Density-based Robust Outlier Detection Estimation algorithm.
Code 1. Pseudo code for Z-score Density-based Robust Outlier Detection Estimation algorithm.
Algorithm 1 ZdensityRODE Peak Classification
1: Input: signal, lag (λ), influence (ι), threshold (τ), delta (Δ)
2: Output: classified regions
3: Define an intermediary signal for filtered input values: Y
4: for xi in signal do
5: if Training stage then update buffers μ and σ buffers
6: else
7: if (xi − μi−1) > threshold ⋅ σi−1 then
8: xi is an outlier
9: Y ≔ (ι ⋅ xi) + ((1 − ι) * Ui−1);
10: else U ≔ xi
11: end if
12: avg ≔ average(Get Chunk of Y for last λ samples);
13: std ≔ Standard deviation(Get Chunk of Y for last λ samples);
14: for peak stored in processed window do
15: Account number of peaks in a Δ window
16: if N peaks in Δ time-lapse ≥ Threshold_A then
17: Classify interval as A label
18: if Threshold_B ≤ N peaks in Δ window ≤ Threshold_A then
19: Classify interval as B label
The algorithm starts with a training stage, in which during the first λ samples, the algorithm does not provide any detection but fills the buffers and calculates the initial trend of the data. Only a notch filter at 50 Hz to remove powerline noise (here, 50 Hz) is used in the signal conditioning stage. During this stage, which lasts as long as the lag time parameter, initial mean (μ), and standard deviation (σ) buffers are filled (See Fig 3). Once the algorithm is trained, it starts the operation mode by processing each incoming sample in three steps: (i) a z-score test relative to μ and σ, which are estimated values from previous samples in the signal (Eq 1); (ii) local maxima evaluation by first-derivative test (Eq 2); (iii) refractory period evaluation.
(1)
(2)
Where xn is the current sample, μ is the historic mean and σ is the historic standard deviation. Both historic μ and σ are implemented as FIFO, storing the λ last samples and recalculating on each sample with the influence parameter depending on the evaluation of the z-score. the μ and σ filters are updated following the expression in Eq 3. When the z-score exceeds the threshold, it indicates a significant and prominent peak, thus, the historical data is updated based on the influence defined by ι. If the z-score test is negative, implying noise or irrelevant information, the filters μ and σ are updated without considering the influence parameter, that is providing less importance to the current sample. This removes the influence of this value on the adaptation of the threshold.
(3)
When detecting outliers, these are transformed into intervals by observing the density of spikes over a continuous period of time. The number of events is recorded with a timestamp, which will be used to determine the type of event. The time intervals are measured based on the event length, the up-spike and down-spike, and their proximity to the next peak, using a simple incremental counter. If there are one or more peaks that occur within the integration time interval Δ, the detection window is extended until the peaks are separated by a time greater than the refractory period. When this condition is not met, the integration is stopped and the interval is classified. Interval classification is determined by duration, amplitude, and spike density. These characteristics provide information about event frequency and intensity.
Automatic multiscale-based peak detection (AMPDE)
The scalogram technique has proven to be effective and reliable in identifying peaks, especially in scenarios with noise and various peak shapes [32]. This algorithm uses a multiscale decomposition based on scalograms and various windows, followed by peak identification in each row of the scalogram matrix. As demonstrated by Scholkmann et al. [33], this method shows remarkable performance in detecting relevant events. The algorithm comprises six stages: Signal Conditioning, calculation of Local Maxima Scalogram (LMS), determination of optimal scale, LMS rescaling, peak detection, and estimation of peak density for brain activity pattern classification. A comprehensive block diagram of the algorithm is provided in Fig 4, offering a visual representation of each step within the processing pipeline and input/output (I/O) delineation. The algorithm’s pseudocode is also available in Code 2. Its complexity was evaluated, resulting in an O(n2) time complexity. This is because of the nested loops used in the matrix operations that significantly increase the algorithm’s complexity.
Block diagram with the workflow of the Automatic multiscale-based peak detection (AMPDE) algorithm. In the first stage, a bandpass filter between 0.5 and 50 Hz is set. Then an LMS calculation is performed for each window in the signal. A summation of each row in the LMS returns the vector γ, which after a rescaling obtains the final vector of peaks candidate, filtered with an evaluation method to identify the peaks on the vector.
Code 2. Pseudo code for AMPDE algorithm.
Algorithm 2 Automatic Multiscale-based Peak Detection Enhanced (AMPDE)
1: Input: Signal (x), Scale range (k), threshold (α), delta (Δ)
2: Output: Detected peaks p
3: Calculate Linear Detrended Signal x′ by subtracting the least-squares fit of a straight line
4: for k in 21, 22, …, 2L where L = ⌈N/2⌉ − 1 do
5: for i in k + 2, k + 3, …, N − k + 1 do
6: if r + α where r is a number ∈ [0, 1] and α = 1 then
7:
8: else
9: mk,i = 0
10: end if
11: end for
12: end for
13: Compute Local Maxima Scalogram (LMS) matrix M using mk,i values
14: Row-wise summation to get for each scale k
15: Find global minimum λ = argminkγk
16: Reshape matrix Mr by removing elements mk,i for k > λ
17: for i in 1, 2, …, N do
18: for j in 1, 2, …, λ do
19: Calculate σi using Eq (7) column-wise standard deviation formula
20: end for
21: end for
22: Detect peaks: p = {i ∣ σi = 0}
23: Peak sorting task
24: for each peak, count all consecutive peaks within a delta (Δ) time do
25: if next peak exceeds the integration (Δ) window then
26: if Number of peaks exceeds classification threshold for ictal then
27: Mark the event as Ictal
28: else
29: if Within interictal kind of events then
30: Mark the event as Interictal
31: end if
32: end if
33: end if
34: end for
=0
Let us now consider a univariate signal, x(i), with N uniformly sampled points, 1 ≤ i ≤ N, containing periodic or quasi-periodic peaks. The first step involves preprocessing the input signal to remove the offset and eliminate the power line interference (here, 50 Hz) by applying a notch filter with a quality factor of 90. Then the LMS is computed by analyzing all input values (x = x1, x2, x3, x4, …, xn) using a moving window approach. The LMS uses the scalogram for the detection of peaks in the time series. The scalogram is the signal’s frequency distribution over time, analogous to the spectrogram. This representation enables the extraction of significant features such as peaks, edges, and patterns. In this work, we are interested in the detection of peaks and this representation provides a trustworthy measure of relevant events and their frequency components. To obtain the LMS matrix, the signal x is first detrended by subtracting the least-squares fit of a straight line from x. This operation removes the long-term memory of the signal and avoids adding carried trends into the current portion of the signal where the scalogram has to be computed. Next, the signal is averaged with a moving window average filter with varying lengths. The window length wk is varied from 2 to L, wk = 2k, k = 1, 2, …, L, where L is defined as . This is performed for every scale k and for i = k + 2, …, N − k + 1.
(4)
where r is a uniformly distributed random number in the range [0, 1] and α a constant factor (α = 1). Each mk,i element is formed as the value r + α for i = [1, 2, …, k + 1] and for i = [N − k + 2, …, N]. The result of performing all those operations for each of the windows is a matrix L x N defined as Eq 5. Each row in this matrix corresponds to a window length wk. It represents the local maxima scale of the signal for each window. To gather information about the scale-dependent distribution of zeros (and consequently local maxima) in the signal segment, a row-wise summation is performed for each LMS level, as shown in Eq 6.
(5)
(6)
The vector [γ1, γ2, …, γL] contains information about the distribution of zeros that is scale dependent, including the local maxima. The next step uses a parameter λ to reshape the LMS matrix M by removing all elements mk,i for which k > λ holds. It allows one to reshape the LMS matrix leading to the new λ × N-matrix (rk,i), for i ∈ 1, 2, …, N and k ∈ 1, 2, …, λ. From the matrix, the peak detection is performed by: (i) Calculating the column-wise standard deviation of the matrix according to Eq 7 and (ii) Finding all indices i that satisfy σi = 0. These values are stored in the vector with
being the total number of detected peaks of the signal x.
(7)
In the last step, a similar strategy as in the ZdensityRODE is followed to estimate the peak density by considering factors such as amplitude, duration, and proximity to other events. Peaks are searched within a period denoted by Δ, and if one or more peaks are found within that duration, the detection interval is extended until the peaks are separated by a time greater than the refractory time. This process continues as long as the peaks are close and Δ time is not exceeded.
Performance metrics
In the context of TSS problems, the evaluation of the performance of an output model relies on its agreement with the reference model. A positive detection corresponds to a sequence of labels that collectively represent a category or type of event in the LFP signal. To compare reference and output annotations, a set-theory-based approach is necessary. To determine a true positive (TP) detection, the intersection between the time intervals associated with the detected event and the reference event has to be found. The degree of overlap between these events settles a robust metric for measuring algorithm performance. The reference and output interval intersection is computed as per Eq 8. By dividing the coincidence segment by the reference segment, the coincidence ratio is obtained, which quantifies the degree of overlap between the two events (refer to Eq 9).
(8)
(9)
Where r and y are reference and output intervals of bounds [n, n+1] and [m, m+j], respectively. Both are defined as vectors since they are a sequence of labels that together constitute events. Here, a TP detection is considered when more than 80% of the output event coincides with the reference events and the length does not exceed 50% of the boundaries of the reference event. Similarly, a False positive (FP) occurs when an event is detected where no reference event is found. False negative falls for a missed detection, either not detected or not sufficient for being classified as TP. In this context, Precision (P +) measures the proportion of true positives over false positives, quantifying how well the output events match the expert’s annotations (Eq 10). Recall (Re) gauges the reliability of the algorithm’s actual detections, signifying the fraction of positive patterns correctly classified (Eq 11). The F-measure, also known as the F1 score, provides a unified score balancing precision and recall. (Eq 12). We also employ the Jaccard/Tanimoto similarity index (Jaq) to assess the degree of overlap between detected events by comparing reference and output vectors [34], as shown in Eq 13, where A and B are output and reference intervals from the recorded signal. These metrics provide comprehensive insights into the algorithm’s performance.
(10)
(11)
(12)
(13)
A Multi-Criteria Decision Analysis (MCDA) is proposed, to combine precision, recall, Jaccard index, and f-measure to extract a more comprehensive score of the algorithm performance. There is no clear indication as to which metric should be prioritized, nor there is a preferred metric for assessing such kinds of problems. For instance, in [7, 18, 35], recall is used as a fundamental metric for seizure detection, while in [14, 15, 36–38] precision is used as a key indicator. Sensitivity is also employed by [16, 37–39] or specificity in [38, 39]. In this work, we place special emphasis on the accuracy of detecting ictal events. To improve the precision, we incorporate the Jaccard index in addition to interval intersection. Along with precision, recall is also equally important in detecting ictal events and ensuring reliable detection. In the case of interictal events, precision, and recall are given equal importance. The equation presented in Eq 14 is a scoring function that prioritizes the detection of ictal events over interictal detection. However, the algorithm can be trained using a different metaparameter configuration to match the expected result. This means that the algorithm can be adjusted to detect different types of events’ detection depending on the specific needs. During the training stage, the weight assigned to each metric determines how the algorithm is prepared for the online operation mode.
(14)
where PrecisionIctal is given a weight of 60% and Jaccardinterical is given a weight of 20%. The metric RecallIctal is given 10%, Precisioninterical is given a 5% and Recallinterical a 5%.
Results
LFP signal characteristics vary remarkably among brain regions. This study concentrates on LFP recorded from the CTX, identified as the primary site of ictal onset in the in vitro model of limbic ictogenesis utilized in this work [25]. Fig 5 illustrates the power spectral density (PSD), entropy, kurtosis and spectral components of an LFP signal containing ictal and interictal events recorded from the entorhinal cortex. The differences are notable between interictal and ictal, marked as yellow and red respectively in Fig 5. Such distinction is relevant to the effective automatic identification of both events.
A) Raw signal showing recurrent ictal and interictal events. B) Signal Kurtosis computed in 5 s windows. C) Shannon entropy, highlighting the variance and complexity of the signal over time. D) Spectrogram highlighting the wide range of frequency components in epileptiform events. E) Signal after high-pass filtering at ≥ 300Hz. F) Signal after low-pass filtering at ≤ 300Hz.
In terms of morphology, ictal events, which are the electrographic correlate of seizures, manifest as sustained high-amplitude, high-frequency discharges. In contrast, interictal epileptiform discharges, occurring between ictal events, are brief electrographic transients of various morphologies, such as single spikes, spike bursts, or oscillations of low/high frequency [40]. In the in vitro model used for this study, ictal discharges typically last 50 ± 24 seconds, whereas interictal events last 1.5 ± 0.8 seconds. The baseline section represents the signal’s noise floor, denoting the absence of epileptiform events, and is typified by a low-amplitude, uniformly shaped signal that remains relatively stable over time. The frequency characteristics of ictal events typically concentrates on the range of 0.5 to 30 Hz. Interictal events exhibits diverse natures, leading to variations in their spectral representation across different event types [12, 41]. Utilizing spectral features for event identification typically increases computational complexity as complex math, sucha as Fourier transform, need to be computed, demanding more hardware resources and power consumption compared to other approaches. In our pursuit of reducing computational costs, we have employed only temporal characteristics to differentiate between ictal and interictal events. More precisely on spikes amplitude range and duration for their simplicity and low computational cost. Fig 6 illustrates the differences between all the analyzed ictal and interictal events in the dataset, highlighting the effectiveness of temporal characteristics for classification.
A) Overlayed ictal and ictal discharges and average signal (black). B) Violin plots of a selected number of features, highlighting distinctive characteristics of ictal and interictal events.
The proposed approach for detecting epileptiform activity approaches the problem through time series segmentation using the ZdensityRODE and AMPDE algorithms. Both algorithms were evaluated against validation datasets to assess their performance in detecting ictal and interictal events. A comprehensive evaluation of the algorithms’ performance was conducted following MCDA approach. Both algorithms consistently achieved high scores, with a global score exceeding 90%, indicating their robustness and reliability in detecting ictal events. However, for interictal events, the precision was higher than 50%, but sensitivity and Jaccard index were lower. Fig 7 demonstrates the performance of the two algorithms on a sample signal, including reference annotations from the dataset, to exemplify their operation.
Output comparison for ZdensityRode and AMPDE algorithms against reference annotations for two representative signals, depicting high and low SNR scenarios. A) Representative signal with SNR ≥ 20 dB. B) Representative signal with SNR ≤ 20 dB. (0: baseline, 1: interictal event, 2: ictal event).
The Zdensity-RODE algorithm achieved a precision (P+) of 93% and a recall (Re) of 93%, with a Jaccard index (Jaq) of 86% and an F1-score of 91% for ictal event detection. For interictal events, it achieved a precision (P+) of 42% and a recall (Re) of 45%. The AMPDE algorithm achieved a precision (P+) of 96% and a recall (Re) of 90%, with a Jaccard index (Jaq) of 86% and an F1-score of 92% for ictal event detection, and a precision (P+) of 54% and a recall (Re) of 33% for interictal events. The algorithm was trained to prioritize ictal detection, reflecting its lower performance for interictal detection. Table 3 provides detailed results for each recording session and each evaluation metric. Overall, the results demonstrate high detectability for ictal events, with both high recall and high precision (see Fig 8).
A) Distribution of scores for each experimental session in the training stage; B) Distribution of SNR for each experimental session in the training stage; C) Distribution of scores for the validation dataset; D) Distribution of SNR for the validation dataset; E) Distribution of scores for classifier ZdensityRODE; F) Distribution of scores for classifier AMPD; G) Scores for each metric used in the experiment for ZdensityRODE algorithm and H) Scores for each metric used for AMPD algorithm.
This table shows the averaged results for each experimental session in the validation dataset. On the top, are the results for the ZdensityRODE algorithm, and on the bottom, are for the AMPD algorithm.
It is relevant to note that the SNR substantially influences the algorithmic performance. To assess the effect of SNR on detection performance, we used Pearson correlation analysis. This analysis resulted in a Pearson’s correlation coefficient of r = 0.7 within the training dataset and r = 0.4 within the validation dataset. This correlation is observable in Fig 8, where A) and C) represent the corresponding results for each dataset, while B) and D) depict the SNR ranges for each recording session. The performance of the algorithms indeed correlates with the SNR. This variability is akin to selecting the MEA channels based on their anatomical position and assessing signal quality for SNR threshold compliance. Despite this variability, the algorithm exhibits an outstanding overall performance. Besides, the correct choice of parameters highly determines the algorithm performance as illustrated in Fig 8E and 8F.
Discussion
We have proposed a novel methodology for detecting epileptiform activity, addressing the problem through time series segmentation utilizing the ZdensityRODE and AMPDE algorithms. The effectiveness of both algorithms was verified by testing them on epileptiform activity recorded from 4AP-treated rodent brain slices via MEA. Both algorithms demonstrated remarkable performance in detecting ictal activity. It should be noted that these algorithms are capable of detecting interictal events as well, as they perform a time series segmentation task.
The detection and classification of ictal and interictal events is typically based on three primary approaches: (i) morphological features, such as maximum amplitude, spike slope, absolute mean of windowed events, and successive spike density [7, 14, 42, 43]; (ii) spectral features, including power content across different frequency bands [7, 15, 18, 43–45]; and (iii) statistical features, encompassing variations in median and variance [7, 14, 22], kurtosis, and skewness [42].
To improve epilepsy diagnosis and treatment, several seizure detection algorithms have been proposed. In [18], a magnitude and phase synchronization between electrodes could achieve a 66% true positive rate (TPR). Yoo et al [7], used SVM yielding a TPR of 82.7% for seizure classification. Shoeb et al [46] proposed a machine learning technique through a feature vector for the detection of seizures, achieving a 96% of sensitivity and a 2/24h FPR. Kurtosis, skewness, and coefficient of variation from decimate Discrete Wavelet Decomposition were proposed by [47], achieving a precision of 92.66%. Ronchini et al [38], uses entropy- and-spectrum features for seizure detection algorithm, boasting an accuracy of 97.8%. In [44], seizure detection is done by decimating discrete wavelet decomposition and interquartile range and mean absolute deviation, obtaining a precision of 84.2%, a sensitivity of 98.5% and latency of 1.76 seconds.
Table 4 summarizes the performance and algorithmic approaches for the works mentioned above in a comparative table. Many of those implementations were tailored around the single patient rather than being designed as patient-agnostic approaches. In this regard, there is a great debate on the advantages of one approach over the other [48]. On the one hand, personalized algorithms offer a broad range of adjustable parameters and involve a training process; on the other hand, patient-agnostic approaches employ a fixed-parameter detector without the need for additional training [48, 49]. This decision requires a trade-off between detection accuracy, simplicity, and speed. Following any of those approaches determines the accuracy of the algorithm and its applicability to different patients and scenarios. In this study, we have prioritized the perspective development of a seizure detection method that is not patient-specific but, at the same time, implements minimum levels of customization for improved accuracy.
The identification of relevant biomarkers in LFP signals poses a significant challenge in the epilepsy field, because of the complex dynamics and different morphologies of ictal and interictal events. Further, the SNR significantly influences the performance of event detection algorithms. In various applications, signal quality assessment techniques improve algorithm performance by preventing unnecessary processing under unfavorable conditions [50, 51]. In this work, a low SNR particularly challenged accurate detection by ZdensityRODE, whereas AMPDE proved robust to additive noise, excelling in analyzing frequency bursts.
Conclusion
We have introduced a TSS approach as a novel strategy for seizure detection, toward improved seizure control via closed-loop brain stimulation. The detection of pathological biomarkers in LFPs recorded from epileptic patients is fundamental for the timely detection (or better, prediction) of seizures to improve brain stimulation strategies for epilepsy treatment. Furthermore, such electrographic biomarkers can provide additional information to advance our understanding of brain states related to epilepsy. ZdensityRODE and AMPDE have proved efficient in biomarkers detection, while using minimal and straightforward computation, as opposed to complex algorithmic approaches, such as neural networks. We believe that these algorithms provide a novel perspective to the field and establish the foundation for a growing subset of algorithms for the classification of epileptiform events and the prediction of seizures.
References
- 1. Falco-Walter J. Epilepsy–Definition, Classification, Pathophysiology, and Epidemiology. Seminars in neurology. 2020;40(6):617–623. pmid:33155183
- 2.
Galeote-Checa G, Nabaei V, Das R, Heidari H. Wirelessly powered and modular flexible implantable device. ICECS 2020—27th IEEE International Conference on Electronics, Circuits and Systems, Proceedings. 2020.
- 3. Ray TR, Choi J, Bandodkar AJ, Krishnan S, Gutruf P, Tian L, et al. Bio-integrated wearable systems: A comprehensive review. Chemical Reviews. 2019;119:5461–5533. pmid:30689360
- 4. Ho JS, Kim S, Poon AS. Midfield wireless powering for implantable systems. Proceedings of the IEEE. 2013;101(6):1369–1378.
- 5.
Galeote-Checa G, Panuccio G, Linares-Barranco B, Serrano-Gotarredona T. Baseline Features Extraction from Microelectrode Array Recordings in an in vitro model of Acute Seizures using Digital Signal Processing for Electronic Implementation. 2021 IEEE International Conference on Omni-Layer Intelligent Systems (COINS). 2021; p. 1–6.
- 6. Burton A, Obaid SN, Vázquez-Guardado A, Schmit MB, Stuart T, Cai L, et al. Wireless, battery-free subdermally implantable photometry systems for chronic recording of neural dynamics. Proceedings of the National Academy of Sciences of the United States of America. 2020;117:2835–2845. pmid:31974306
- 7. Yoo J, Yan L, El-Damak D, Altaf MAB, Shoeb AH, Chandrakasan AP. An 8-Channel Scalable EEG Acquisition SoC With Patient-Specific Seizure Classification and Recording Processor. IEEE Journal of Solid-State Circuits. 2013;48(1):214–228.
- 8. McGlynn E, Nabaei V, Ren E, Galeote-Checa G, Das R, Curia G, et al. The Future of Neuroscience: Flexible and Wireless Implantable Neural Electronics. Advanced Science. 2021;8. pmid:34026431
- 9. Geller EB, Skarpaas TL, Gross RE, Goodman RR, Barkley GL, Bazil CW, et al. Brain-responsive neurostimulation in patients with medically intractable mesial temporal lobe epilepsy. Epilepsia. 2017;58(6):994–1004. pmid:28398014
- 10. Zijlmans M, Jiruska P, Zelmann R, Leijten FS, Jefferys JG, Gotman J. High-Frequency Oscillations as a New Biomarker in Epilepsy. Annals of Neurology. 2012;71(2):169–178. pmid:22367988
- 11. Fisher R, Salanova V, Witt T, Worth R, Henry T, Gross R, et al. Electrical stimulation of the anterior nucleus of thalamus for treatment of refractory epilepsy. Epilepsia. 2010;51(5):899–908. pmid:20331461
- 12. Chvojka J, Kudlacek J, Chang WC, Novak O, Tomaska F, Otahal J, et al. The role of interictal discharges in ictogenesis—a dynamical perspective. Epilepsy & Behavior. 2021;121:106591. pmid:31806490
- 13. Topalovic U, Barclay S, Ling C, et al. A Wearable Platform for Closed-Loop Stimulation and Recording of Single-Neuron and Local Field Potential Activity in Freely Moving Humans. Nature Neuroscience. 2023;26:517–527. pmid:36804647
- 14. Page A, Sagedy C, Smith E, Attaran N, Oates T, Mohsenin T. A Flexible Multichannel EEG Feature Extractor and Classifier for Seizure Detection. IEEE Transactions on Circuits and Systems II: Express Briefs. 2015;62(2):109–113.
- 15. Cheng CH, Tsai PY, Yang TY, Cheng WH, Yen TY, Luo Z, et al. A Fully Integrated 16-Channel Closed-Loop Neural-Prosthetic CMOS SoC With Wireless Power and Bidirectional Data Telemetry for Real-Time Efficient Human Epileptic Seizure Control. IEEE Journal of Solid-State Circuits. 2018;53(11):3314–3326.
- 16. Park YS, Cosgrove GR, Madsen JR, Eskandar EN, Hochberg LR, Cash SS, et al. Early Detection of Human Epileptic Seizures Based on Intracortical Microelectrode Array Signals. IEEE Transactions on Biomedical Engineering. 2020;67(3):817–831. pmid:31180831
- 17. Aarabi A, He B. Seizure prediction in patients with focal hippocampal epilepsy. Clinical Neurophysiology. 2017;128(7):1299–1307. pmid:28554147
- 18. Abdelhalim K, Smolyakov V, Genov R. Phase-Synchronization Early Epileptic Seizure Detector VLSI Architecture. IEEE Transactions on Biomedical Circuits and Systems. 2011;5(5):430–438. pmid:23852175
- 19. Imfeld K, Maccione A, Gandolfo M, Martinoia S, Farine PA, Koudelka-Hep M, et al. Real‐time signal processing for high‐density microelectrode array systems. Wiley Online Library. 2009;23:983–998.
- 20.
Ahmadi-Farsani J, Linares-Barranco B, Serrano-Gotarredona T. Digital-signal-processor realization of izhikevich neural network for real-time interaction with electrophysiology experiments. 2019 26th IEEE International Conference on Electronics, Circuits and Systems, ICECS 2019. 2019; p. 899–902.
- 21. Kim C, et al. Sub-μ V rms-Noise Sub-μ W/Channel ADC-Direct Neural Recording With 200-mV/ms Transient Recovery Through Predictive Digital Autoranging. IEEE Journal of Solid-State Circuits. 2018;53(11):3101–3110.
- 22. Rajdev P, Ward MP, Rickus J, Worth R, Irazoqui PP. Real-time seizure prediction from local field potentials using an adaptive Wiener algorithm. Computers in Biology and Medicine. 2010;40(1):97–108. pmid:20022319
- 23. Carmona-Poyato A, Fernandez-Garcia NL, Madrid-Cuevas FJ, Duran-Rosal AM. A new approach for optimal time-series segmentation. Pattern Recognition Letters. 2020;135:153–159.
- 24. Chung FL, Fu TC, Ng V, Luk RWP. An evolutionary approach to pattern-based time series segmentation. IEEE Transactions on Evolutionary Computation. 2004;8(5):471–489.
- 25. Avoli M, D’antuono M, Louvel J, Köhling R, Biagini G, Pumain R, et al. Network and pharmacological mechanisms leading to epileptiform synchronization in the limbic system in vitro. Progress in Neurobiology. 2002;68(3):167–207. pmid:12450487
- 26. McIntyre DC, Gilby KL. Mapping seizure pathways in the temporal lobe. Epilepsia. 2008;49:23–30. pmid:18304253
- 27. Bartolomei F, Khalil M, Wendling F, Sontheimer A, Régis J, Ranjeva JP, et al. Entorhinal cortex involvement in human mesial temporal lobe epilepsy: an electrophysiologic and volumetric study. Epilepsia. 2005;46(5):677–687. pmid:15857433
- 28. Bartolomei F, Chauvel P, Wendling F. Epileptogenicity of brain structures in human temporal lobe epilepsy: a quantified study from intracerebral EEG. Brain. 2008;131(7):1818–1830. pmid:18556663
- 29. Spencer SS, Spencer DD. Entorhinal-hippocampal interactions in medial temporal lobe epilepsy. Epilepsia. 1994;35(4):721–727. pmid:8082614
- 30. Panuccio G, Colombi I, Chiappalone M. Recording and modulation of epileptiform activity in rodent brain slices coupled to microelectrode arrays. JoVE (Journal of Visualized Experiments). 2018;(135):e57548. pmid:29863681
- 31. Caron D, Canal-Alonso A, Panuccio G. Mimicking CA3 Temporal Dynamics Controls Limbic Ictogenesis. Biology. 2022;11(3). pmid:35336745
- 32. Bishop SM, Ercole A. Multi-Scale Peak and Trough Detection Optimised for Periodic and Quasi-Periodic Neuroscience Data. Acta Neurochir Suppl. 2018;126:189–195. pmid:29492559
- 33. Scholkmann F, Boss J, Wolf M. An Efficient Algorithm for Automatic Peak Detection in Noisy Periodic and Quasi-Periodic Signals. Algorithms. 2012;5:588–603.
- 34. Chung NC, Miasojedow B, Startek M, Gambin A. Jaccard/Tanimoto similarity test and estimation methods for biological presence-absence data. BMC Bioinformatics. 2019;20(Suppl 15):644. pmid:31874610
- 35. Gregg NM, Marks VS, Sladky V, Lundstrom BN, Klassen B, Messina SA, et al. Anterior nucleus of the thalamus seizure detection in ambulatory humans. Epilepsia. 2021;62(10):e158–e164. pmid:34418083
- 36. Truong ND, Nguyen AD, Kuhlmann L, Bonyadi MR, Yang J, Ippolito S, et al. Convolutional neural networks for seizure prediction using intracranial and scalp electroencephalogram. Neural Networks. 2018;105:104–111. pmid:29793128
- 37. Ronchini M, Zamani M, Huynh HA, Rezaeiyan Y, Panuccio G, Farkhani H, et al. A CMOS-based neuromorphic device for seizure detection from LFP signals. Journal of Physics D: Applied Physics. 2021;55(1):014001.
- 38. Ronchini M, Rezaeiyan Y, Zamani M, Panuccio G, Moradi F. NET-TEN: a silicon neuromorphic network for low-latency detection of seizures in local field potentials. Journal of Neural Engineering. 2023;20(3):036002.
- 39. Bin Altaf MA, Yoo J. A 1.83 μJ/Classification, 8-Channel, Patient-Specific Epileptic Seizure Classification SoC Using a Non-Linear Support Vector Machine. IEEE Transactions on Biomedical Circuits and Systems. 2016;10(1):49–60. pmid:25700471
- 40.
de Curtis M, Jefferys JG, Avoli M. Interictal epileptiform discharges in partial epilepsy. Jasper’s Basic Mechanisms of the Epilepsies [Internet] 4th edition. 2012;.
- 41. Staba RJ, Stead M, Worrell GA. Electrophysiological Biomarkers of Epilepsy. Neurotherapeutics. 2014;11(2):334–46. pmid:24519238
- 42. Khan YU, Farooq O, Sharma P. Automatic detection of seizure onset in pediatric EEG. International Journal of Embedded Systems and Applications. 2012;2(3):81–89.
- 43. Shoaran M, Haghi BA, Taghavi M, Farivar M, Emami-Neyestanak A. Energy-Efficient Classification for Resource-Constrained Biomedical Applications. IEEE Journal on Emerging and Selected Topics in Circuits and Systems. 2018;8(4):693–707.
- 44. Ahammad N, Fathima T, Joseph P, et al. Detection of epileptic seizure event and onset using EEG. BioMed research international. 2014;2014. pmid:24616892
- 45. Huang SA, Chang KC, Liou HH, Yang CH. A 1.9-mW SVM processor with on-chip active learning for epileptic seizure control. IEEE Journal of Solid-State Circuits. 2019;55(2):452–464.
- 46.
Shoeb AH, Guttag JV. Application of machine learning to epileptic seizure detection. In: Proceedings of the 27th international conference on machine learning (ICML-10); 2010. p. 975–982.
- 47. Das K, Daschakladar D, Roy PP, Chatterjee A, Saha SP. Epileptic seizure prediction by the detection of seizure waveform from the pre-ictal phase of EEG signal. Biomedical Signal Processing and Control. 2020;57:101720.
- 48. De Cooman T, Vandecasteele K, Varon C, Hunyadi B, Cleeren E, Van Paesschen W, et al. Personalizing heart rate-based seizure detection using supervised SVM transfer learning. Frontiers in Neurology. 2020;11:145. pmid:32161573
- 49.
Birjandtalab J, Jarmale VN, Nourani M, Harvey J. Impact of Personalization on Epileptic Seizure Prediction. In: 2019 IEEE EMBS International Conference on Biomedical & Health Informatics (BHI); 2019. p. 1–4.
- 50. He J, Liu D, Chen X. Wearable exercise electrocardiograph signal quality assessment based on fuzzy comprehensive evaluation algorithm. Computer Communications. 2020;151:86–97.
- 51. Satija U, Ramkumar B, Manikandan MS. A Review of Signal Processing Techniques for Electrocardiogram Signal Quality Assessment. IEEE Reviews in Biomedical Engineering. 2018;11:36–52. pmid:29994590