Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2023 Nov 1.
Published in final edited form as: J Neurosurg. 2022 Sep 23;138(4):1002–1007. doi: 10.3171/2022.8.JNS221321

Localizing seizure onset zones in surgical epilepsy with neurostimulation deep learning

Graham W Johnson 1,7,8, Leon Y Cai 1,8, Derek J Doss 1,7,8, Jasmine W Jiang 7,8,9, Aarushi S Negi 9, Saramati Narasimhan 1,7,8,9, Danika L Paulo 9, Hernán F J González 1,7,8, Shawniqua Williams Roberson 1,10, Sarah K Bick 9, Catie E Chang 2, Victoria L Morgan 1,7,8,9,10, Mark T Wallace 3,4,5,6, Dario J Englot 1,2,7,8,9,10,11
PMCID: PMC10619627  NIHMSID: NIHMS1933645  PMID: 36152321

Abstract

OBJECTIVE

In drug-resistant temporal lobe epilepsy, automated tools for seizure onset zone (SOZ) localization that use brief interictal recordings could supplement presurgical evaluations and improve care. Thus, the authors sought to localize SOZs by training a multichannel convolutional neural network on stereoelectroencephalography (SEEG) cortico-cortical evoked potentials.

METHODS

The authors performed single-pulse electrical stimulation in 10 drug-resistant temporal lobe epilepsy patients implanted with SEEG. Using 500,000 unique poststimulation SEEG epochs, the authors trained a multichannel 1-dimensional convolutional neural network to determine whether an SOZ had been stimulated.

RESULTS

SOZs were classified with mean sensitivity of 78.1% and specificity of 74.6% according to leave-one-patient-out testing. To achieve maximum accuracy, the model required a 0- to 350-msec poststimulation time period. Post hoc analysis revealed that the model accurately classified unilateral versus bilateral mesial temporal lobe seizure onset, as well as neocortical SOZs.

CONCLUSIONS

This was the first demonstration, to the authors’ knowledge, that a deep learning framework can be used to accurately classify SOZs with single-pulse electrical stimulation–evoked responses. These findings suggest that accurate classification of SOZs relies on a complex temporal evolution of evoked responses within 350 msec of stimulation. Validation in a larger data set could provide a practical clinical tool for the presurgical evaluation of drug-resistant epilepsy.

Keywords: temporal lobe epilepsy, seizure onset zone, single-pulse electrical stimulation, cortico-cortical evoked potentials, deep learning, SEEG


EPILEPSY affects over 50 million people worldwide, with temporal lobe epilepsy (TLE) being the most common focal epilepsy.1 Approximately 30%–40% of TLE patients continue to have debilitating seizures despite maximal therapy with antiseizure medications.2 Drug-resistant patients may undergo presurgical evaluation ahead of resection, ablation, or neurostimulation therapies. A major goal of presurgical workup is to find the areas of the brain responsible for seizure generation, i.e., the seizure onset zones (SOZs). However, precise localization of SOZs can be challenging with noninvasive modalities such as scalp electroencephalography (EEG), MRI, and PET. Therefore, invasive intracranial monitoring with stereoelectroencephalography (SEEG) is often pursued to provide direct electrographic recordings of seizures and to localize SOZs. Monitoring after SEEG implantation often requires long hospital stays of days to weeks to record multiple ictal events.3 Thus, it has been proposed that the use of interictal single-pulse electrical stimulation (SPES) of the SEEG contacts to elicit cortico-cortical evoked potentials (CCEP) could help localize SOZs more efficiently.46

A challenge of interpreting CCEPs with SEEG is that the foundational work in this field was done using subdural electrode grids that measured consistent electrographic phenomena after stimulation (e.g., N1 [10–50 msec] and N2 [50–300 msec] responses).4 However, N1 and N2 wave polarity and morphology are defined on the basis of the consistent electrode orientation of the subdural electrode grids relative to the cortical surface, and thus orthogonal to cortical pyramidal neurons. In contrast, SEEG has less consistent orientation relative to cortical structures, and translation of N1 and N2 terminology for subcortical gray matter is even more challenging due to heterogenous cytoarchitecture.7 Thus, it is difficult to predict the pattern of CCEP wave morphology for any given SEEG contact. Accordingly, most groups rely on coarse metrics for CCEPs (or, more broadly, evoked responses) in SEEG such as root-mean-squared power.6,8 However, these metrics may miss important electrographic features that could help characterize the epileptogenic network.

We propose that a multichannel 1-dimensional convolutional neural network (CNN) is well suited for simultaneously recognizing variable evoked wave morphology from multiple SEEG contacts. This could be a useful tool to delineate whether a given set of evoked responses resulted from stimulation of an SOZ or non-SOZ. Furthermore, by probing various time windows after stimulation, we can systematically determine which poststimulation time periods contain the most important classifying features. Overall, this technique has the potential to directly improve neurological and neurosurgical clinical workflows by quickly localizing potential therapeutic targets.

Methods

Participants and SPES

We collected over 500,000 poststimulation 900-msec SEEG epochs from 10 patients with drug-resistant TLE who underwent presurgical evaluation (Table 1). Clinical data were collected through chart review, and seizure outcomes were assigned using the Engel scale.9 This study received institutional review board approval, and informed subject consent was obtained. We conducted SPES with every adjacent bipolar pair of contacts in the gray matter for each patient. We used a 10-second, 1-Hz, 300-msec biphasic pulse at 3.0 mA with a recording sampling rate of 512 Hz.

TABLE 1.

Patient demographic characteristics

Patient No. Age (yrs) Sex Racial Identity Epilepsy Duration (yrs) Preop Seizure Frequency (no./mo) FBTC MRI Findings No. of Stimulated Contact Pairs Surgery Surgical Outcome* Postsurgical Duration (mos)
1 51 F White 20 3.5 No Normal 69 Bilat RNS >50% reduction 25
2 39 F White 15 60.5 Yes Normal 69 Bilat RNS <50% reduction 21
3 30 F Multiracial 14 9.5 Yes Normal 42 Rt SAH Engel class ID 21
4 58 F Black 8 1.0 Yes Normal 45 Rt SAH Engel class IA 13
5 24 F Asian 7 10.0 No Normal 72 Bilat RNS <50% reduction 12
6 41 M White 18 1.0 No Lt MTS 71 Lt SAH Engel class IA 10
7 28 M Black 14 1.0 Yes Lt temporal encephalocele 63 Lt ATL Engel class IA 10
8 23 F White 14 32.0 Yes Normal 48 Bilat RNS >50% reduction 13
9 23 F White 7 12.0 No Normal 53 Rt ATL Engel class IA 15
10 23 M White 18 1.0 Yes Normal 65 Rt ATL Engel class IA 14

ATL = anterior temporal lobectomy; FBTC = focal to bilateral tonic-clonic seizures; MTS = mesial temporal sclerosis; SAH = selective amygdalohippocampectomy; RNS = responsive neurostimulation.

*

Outcome relative to baseline is shown.

Outcome was consistent with Engel class IA after > 1 year.

Preprocessing and SOZ Labeling

We filtered raw SEEG data by using MATLAB’s filtfilt function (MathWorks, Inc.) with Butterworth filter passbands of 1–59, 61–119, and 121–150 Hz. We then parsed the data into 900-msec epochs after each 1-Hz stimulation. This resulted in over 500,000 preprocessed epochs for training our model. SOZs were defined as regions containing any contacts involved in the ictal onset of 1 or more seizures on the basis of the interpretation of all ictal data by an epileptologist. By using custom SEEG planning software, CRAnial Vault Explorer (CRAVE), we used postimplantation CT scans to accurately localize every contact in each patient and then created a table of all intercontact Euclidean distances.10 All contact locations were verified by a staff engineer, attending neurosurgeon, and attending epileptologist.

Deep Learning

By using poststimulation EEG epochs, we trained a 1-dimensional multichannel, multiscale CNN (Fig. 1A). To accomplish this, we modified the Multi-Scale-1D-ResNet developed by Fei Wang (https://github.com/geekfeiw/Multi-Scale-1D-ResNet) to input 40 SEEG channels simultaneously. To avoid stimulation artifact and implantation bias, the epochs were distance thresholded to exclude any SEEG channels within 20 mm of the stimulation pair.11 For each training pass, we randomized a subset of 40 channels chosen from all of a patient’s available channels. We utilized a weighted binary cross-entropy loss function and stopped training after 5 model epochs. We implemented a leave-one-patient-out testing strategy across all patients. We first tested the ability of the trained model to classify SOZs by using the entire 0- to 900-msec window. Next, we tested the model with only a nonoverlapping 50-msec sliding window over the poststimulation period. We also trained the model on 3 separate randomized region labels to serve as a control.

FIG. 1.

FIG. 1.

Deep learning on distant SEEG evoked responses can accurately classify SOZs. A: We conducted SPES on all gray matter bipolar pairs of contacts in 10 patients who underwent SEEG. This resulted in over 500,000 poststimulation epochs from the recording channels. To avoid stimulation artifacts and biases related to contact implantation density due to the clinical hypotheses, we excluded recordings from contacts within 20 mm of the stimulation site. We then trained a CNN to classify whether a clinically defined SOZ or non-SOZ had been stimulated. B: We first trained the model using the entire 0- to 900-msec poststimulation window. This resulted in a sensitivity of 78.1% and specificity of 74.6%, with a significantly improved Youden index compared with the model trained with random labels. C: For the 50-msec sliding windows, the model performed better than with random labels for the 0- to 350-msec poststimulation period with 50-msec intervals. Paired t-tests with Bonferroni-Holm multiple comparison correction were conducted between the Youden index (blue) and the random-label Youden index (gray). Note that the values on the x-axis represent the ending time of the 50-msec window. D: Use of only the 0- to 350-msec window resulted in model accuracy comparable to that obtained with the 0- to 900-msec window. However, dividing this window into 0- to 175-msec or 175- to 350-msec periods resulted in a significant reduction in the Youden index. E: The model did not simply classify all mesial temporal structures as SOZs. For bilateral patients, the model classified left and right mesial temporal structures as SOZs with comparable confidence around 70%. For unilateral patients, the model correctly classified ipsilateral mesial temporal structures as SOZs at a rate of 91.5% and contralateral (i.e., non-SOZs) at a low rate of 35.1%. This suggests that the model can accurately classify unilateral versus bilateral seizure onset. F: The model correctly classified neocortical temporal SOZs 64.4% of the time, with a low false-positive rate of 26.0%. The white dots in the violin plots represent median values, the horizontal bars represent mean, and the vertical bars represent interquartile range. Figure is available in color online only.

Post Hoc Testing

We conducted post hoc testing to answer the following 3 questions: 1) Which poststimulation time period is best for SOZ classification? 2) Can the model classify unilateral versus bilateral mesial temporal onset? and 3) Can the model accurately classify neocortical temporal SOZs?

We answered question 1 by nulling the data outside the desired time window before training. To answer question 2, we compared the accuracy of left and right mesial temporal SOZ classification in patients with bilateral mesial temporal seizures (n = 4) with that in patients with a) unilateral mesial temporal seizures on ictal SEEG, b) a bilateral SEEG implant, and c) seizure-free surgical outcomes (n = 3). To answer question 3, we calculated the accuracy of neocortical temporal SOZ classification in all patients.

Statistical Methods

We calculated the sensitivity and specificity of leave-one-patient-out testing across all 10 patients for the various time window analyses. We also reported the Youden index (sensitivity + specificity − 100) to summarize the usefulness of the model at a given time window. Youden index values greater than 50 are generally considered to indicate a very useful model for classification, and values close to 0 are considered useless even if sensitivity or specificity is individually high.12 We compared Youden indexes with the paired t-test using Bonferroni-Holm multiple comparison correction. Data and computer code are available upon reasonable request.

Results

CNN Trained on Long-Range CCEPs Accurately Classified SOZs

As outlined in Fig. 1B, the CNN trained on the entire 900-msec poststimulation period correctly classified the stimulation pair as SOZ with mean sensitivity of 78.1% (95% CI 67.8%–88.4%) and specificity of 74.6% (95% CI 68.7%–80.5%) according to leave-one-patient-out testing, resulting in a mean Youden index of 52.7 (95% CI 43.7–61.8). In comparison, when the model was trained with regions randomly labeled as SOZ or non-SOZ, the mean Youden index significantly decreased to 16.5 (95% CI 9.62–23.4, p < 0.001, t-test). Furthermore, for the 50-msec sliding window analysis, the model achieved significantly improved Youden index values when trained on windows ranging from 0 to 350 msec when compared with models trained using the same windows with random labels (Fig. 1C). Interestingly, the specificity and sensitivity of the model peaked during different periods in the initial 350-msec period after stimulation: sensitivity peaked in the time window that spans 100 to 150 msec, while specificity peaked in the 0- to 50-msec time window. This suggests that delayed responses are most sensitive for classifying SOZs, whereas early responses are most specific for classifying SOZs.

Important Features Were Temporally Distributed Within the Initial Poststimulation Window

We performed post hoc analyses to assess which early poststimulation window was most effective for classifying whether an SOZ had been stimulated (Fig. 1D). Using a time window of 0–350 msec, we observed a mean testing sensitivity of 74.0% (95% CI 63.3%–84.7%) and specificity of 78.5% (95% CI 75.9%–81.1%) with the leave-one-patient-out test and a mean Youden index of 52.5 (95% CI 42.1–62.9); these values are very similar to those obtained when the model was trained on the entire 0- to 900-msec period. The Youden index determined with leave-one-patient-out testing dropped significantly when we divided the 0- to 350-msec period into 0- to 175-msec and 175- to 350-msec periods, suggesting that both the early and late portions of this time window contributed to model performance.

The Model Can Classify Unilateral- Versus Bilateral-Onset Mesial TLE and Can Detect Neocortical Temporal SOZs

We observed that the bilateral-onset patients had left mesial temporal structures correctly classified as SOZs for 68.9% (95% CI 58.7%–79.1%) of the CCEP epochs, and right mesial temporal structure epochs classified as SOZs for 67.9% (95% CI 45.4%–90.4%) (Fig. 1E). For unilateral patients, the model correctly classified mesial temporal structures ipsilateral to the seizure-onset hemisphere as SOZs for 91.5% (95% CI 89.7%–93.3%) of the epochs, with a low false-positive rate of 35.1% (95% CI 16.7%–53.5%) for non-SOZs on the contralateral side. This subanalysis provides evidence that the model did not simply classify all mesial temporal structures as SOZs but rather provided accurate classification of unilateral- versus bilateral-onset mesial TLE patients. Furthermore, the model correctly classified neocortical temporal SOZs at a rate of 64.4% (95% CI 44.3%–84.5%) and misclassified neocortical temporal non-SOZs at a rate of only 26.0% (95% CI 19.7%–32.3%) (Fig. 1F).

Discussion

We have demonstrated that a CNN trained entirely on SEEG-derived evoked responses farther than 20 mm from the site of stimulation can classify an SOZ with high sensitivity and specificity in patients with TLE. This technique could augment or potentially replace lengthy SEEG recording sessions with only a brief neurostimulation session. A strength of this approach is that the model accurately classified SOZs despite the variable morphology of evoked responses during stimulation of the SEEG electrodes. Furthermore, the most important poststimulation features for classification are contained within 0–350 msec. This is not surprising considering that most previous findings obtained with root-mean-squared power have centered on N1 and N2 responses within 300 msec.4,13,14 However, separating this window into smaller segments significantly reduces model accuracy. This suggests that there is a complex pattern of evoked responses occurring at various periods after stimulation that must be considered in an ensemble to accurately classify the stimulation of SOZs—this observation could be due to the previously described various phenotypes of evoked responses.15 Additionally, on the basis of our subanalyses, we conclude that this model did not classify all mesial temporal structures as SOZs and can accurately distinguish between unilateral and bilateral mesial temporal onset. Finally, the model can also accurately classify neocortical temporal SOZs.

Limitations and Future Work

Although 500,000 nonoverlapping SEEG epochs were used to train the CNN, training and testing data sets were divided at the patient level. Thus, our relatively small sample size of 10 patients limited our assessment of generalizability and motivated our conservative strategy to use leave-one-patient-out testing across the entire cohort. Regardless, a larger cohort would greatly increase the assessment of generalizability to other epilepsy centers. Also, the mean follow-up was 15.4 months, and future seizure recurrence may decrease confidence in clinical SOZ localization and require the labels for CNN to be changed. We also did not include any focal extratemporal lobe epilepsy patients and thus cannot comment on the extension of these techniques to that population. Our future work is aimed at addressing these limitations by collaborating with other institutions that collect these rare data sets. We also hope to test this model on patients with surgical outcomes of Engel class II–IV. Perhaps, previously unidentified SOZs, including those responsible for bilateral seizure onset, could be elucidated in Engel class II–IV patients with a model trained on Engel class I patients. Inclusion of patients with Engel II–IV outcomes would help increase the generalizability of this model.

Conclusions

This work serves as the first demonstration, to our knowledge, that a CNN can learn the highly nonlinear features of SEEG-derived evoked responses that occur across multiple SEEG channels simultaneously and to classify when an SOZ has been stimulated. Furthermore, we demonstrated the importance of utilizing the entire 0- to 350-msec time window for classification. We hope that future work will consider using deep learning as a tool to explore the complex evoked responses generated with SPES. In summary, this work has the potential to greatly aid neurosurgical decision-making by drastically reducing the SEEG recording time required to accurately localize surgical targets.

Supplementary Material

supplementary_info

Acknowledgments

We thank the patients who participated in our investigation. This work was supported by the following funding sources: NINDS R01-NS112252-02, NINDS R01-NS075270, NINDS R01-NS110130, NINDS R01-NS108445, NINDS F31-NS106735, and NINDS F31-NS120401-01, as well as NIH training grants NIGMS T32-GM007347, NIBIB T32-EB021937, and NIBIB T32EB001628.

ABBREVIATIONS

CCEP

cortico-cortical evoked potentials

CNN

convolutional neural network

EEG

electroencephalography

SEEG

stereoelectroencephalography

SOZ

seizure onset zone

SPES

single-pulse electrical stimulation

TLE

temporal lobe epilepsy

Footnotes

Disclosures

The authors report no conflict of interest concerning the materials or methods used in this study or the findings specified in this paper.

Supplemental Information

Preprint Server

An earlier version of this article can be found on a preprint server.

Preprint server name: bioRxiv.

Preprint DOI: https://doi.10.1101/2022.02.28.481828.

References

  • 1.Behr C, Goltzene MA, Kosmalski G, Hirsch E, Ryvlin P. Epidemiology of epilepsy. Rev Neurol (Paris). 2016; 172(1): 27–36. [DOI] [PubMed] [Google Scholar]
  • 2.Engel J Jr. What can we do for people with drug-resistant epilepsy? The 2016 Wartenberg Lecture. Neurology. 2016; 87(23): 2483–2489. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Englot DJ. A modern epilepsy surgery treatment algorithm: incorporating traditional and emerging technologies. Epilepsy Behav. 2018; 80: 68–74. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Matsumoto R, Kunieda T, Nair D. Single pulse electrical stimulation to probe functional and pathological connectivity in epilepsy. Seizure. 2017; 44: 27–36. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.van ‘t Klooster MA, Zijlmans M, Leijten FSS, Ferrier CH, Van Putten MJAM, Huiskamp GJM. Time–frequency analysis of single pulse electrical stimulation to assist delineation of epileptogenic cortex. Brain. 2011; 134(10): 2855–2866. [DOI] [PubMed] [Google Scholar]
  • 6.Guo ZH, Zhao BT, Toprani S, et al. Epileptogenic network of focal epilepsies mapped with cortico-cortical evoked potentials. Clin Neurophysiol. 2020; 131(11): 2657–2666. [DOI] [PubMed] [Google Scholar]
  • 7.Buzsáki G, Anastassiou CA, Koch C. The origin of extracellular fields and currents—EEG, ECoG, LFP and spikes. Nat Rev Neurosci. 2012;13(6): 407–420. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Prime D, Rowlands D, O’Keefe S, Dionisio S. Considerations in performing and analyzing the responses of cortico-cortical evoked potentials in stereo-EEG. Epilepsia. 2018; 59(1): 16–26. [DOI] [PubMed] [Google Scholar]
  • 9.Engel J. Update on surgical treatment of the epilepsies: summary of The Second International Palm Desert Conference on the Surgical Treatment of the Epilepsies (1992). Neurology. 1993; 43(8): 1612–1612. [DOI] [PubMed] [Google Scholar]
  • 10.D’Haese PF, Pallavaram S, Li R, et al. CranialVault and its CRAVE tools: a clinical computer assistance system for deep brain stimulation (DBS) therapy. Med Image Anal. 2012; 16(3): 744–753. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Prime D, Woolfe M, O’Keefe S, Rowlands D, Dionisio S. Quantifying volume conducted potential using stimulation artefact in cortico-cortical evoked potentials. J Neurosci Methods. 2020; 337: 108639. [DOI] [PubMed] [Google Scholar]
  • 12.Youden WJ. Index for rating diagnostic tests. Cancer. 1950; 3(1): 32–35. [DOI] [PubMed] [Google Scholar]
  • 13.Mouthaan BE, van ‘t Klooster MA, Keizer D, et al. Single pulse electrical stimulation to identify epileptogenic cortex: clinical information obtained from early evoked responses. Clin Neurophysiol. 2016; 127(2): 1088–1098. [DOI] [PubMed] [Google Scholar]
  • 14.Zhang N, Zhang B, Rajah GB, et al. The effectiveness of cortico-cortical evoked potential in detecting seizure onset zones. Neurol Res. 2018; 40(6): 480–490. [DOI] [PubMed] [Google Scholar]
  • 15.Crocker B, Ostrowski L, Williams ZM, et al. Local and distant responses to single pulse electrical stimulation reflect different forms of connectivity. Neuroimage. 2021; 237: 118094. [DOI] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

supplementary_info

RESOURCES