Introduction

Patients suffering from drug-resistant epilepsy, who are either refractory to surgery or not surgical candidates, represent a sizable and challenging-to-treat population [1]. These people suffer from reduced quality of life, social isolation, stigma, and the negative effects of multiple anti-epileptic drug (AED) use. In addition, those with drug-resistant epilepsy have an increased risk for severe complications stemming from poor seizure control, such as severe injuries and sudden unexplained death (SUDEP) [2]. Improved seizure control is imperative for drug-resistant patients yet advances in pharmacological treatment over the past four decades have not had any effect on rates of seizure freedom [3]. Thus, alternative methods of control for those who do not or cannot benefit from resective surgery are under active investigation [4].

Over the past two decades, the Food and Drug Administration (FDA) has approved multiple neural stimulation devices to address existent therapeutic shortcomings. Open-loop, or non-responsive, neural stimulation, such as vagal nerve stimulation (VNS), has been shown to reduce seizure frequency by as much as 56% after two years [5]. Although FDA-approved for focal epilepsy, in practical terms its primary use is in generalized epilepsy. The first closed-loop device, the NeuroPace RNS System, was approved by the FDA for drug-resistant epilepsy in 2013 and demonstrated a median reduction in seizure frequency of 53% at two years and 72% at six years [6, 7]. The device consists of a programmable onboard processor with four recording channels coupled to up to two bi-directional leads capable of both recording and stimulating, as well as storing a subset of information for offline analysis, which target primary seizure foci [8]. Only recently was open-loop deep brain stimulation approved for the treatment of epilepsy in the USA, in contrast to the larger experience in Europe, where regulatory approval followed the conclusion of the Stimulation of the Anterior Nucleus of the Thalamus in Epilepsy (SANTE) trial, which demonstrated a median reduction in seizure frequency of 41% at one year and 69% at five years [9, 10].

Closed-loop stimulation, which may hold the greatest therapeutic potential, is increasingly used in the USA, despite a limited understanding of optimal patient selection criteria, electrode locations, and the effect of adjustments to detector and stimulation parameters. The intent of this paper, therefore, is to provide the necessary context for understanding the current state of the art. We begin with a brief history of neural stimulation for epilepsy, beginning with its modern inception rooted in Penfield’s early work. We then describe in detail the technical features, including hardware, parameter space, and software, of the RNS System device. Next, we discuss recent insights into mechanisms and biomarkers of neural stimulation in the epileptogenic brain. Finally, we discuss the challenges of using closed-loop devices and propose a strategic path forward for implementing an evidence-based personalized medicine approach to closed-loop brain stimulation.

History of Neural Stimulation for Epilepsy

The modern concept of closed-loop neural stimulation is rooted in Penfield’s reports on the modulatory effects of electrical stimulation on neural tissue. As early as 1954, Penfield reported on the modulatory effects of acute electrical stimulation to cortical tissue observed by ECoG [11]. Inhibitory effects of stimulation on seizure activity have since been demonstrated in vitro [12] and in epilepsy patients [13,14,15]. Based on these and other observations, the NeuroPace RNS System was developed as a closed-loop brain modulation device capable of detecting and responding to abnormal brain activity by delivering programmable stimulation targeted to seizure foci [16]. The RNS System consists of a programmable onboard processor with four recording channels coupled to up to two bi-directional leads capable of responsive detection, recording, and stimulation (Fig. 1) [7, 17, 18]. The default or baseline settings for parameters such as frequency, pulse width, and current used in brain stimulation for epilepsy have been borrowed from deep brain stimulation for movement disorders [19]. The efficacy of the RNS System in seizure reduction has been recently demonstrated by several multi-center outcomes studies, where a median of 70% of patients with mesial temporal or neocortical seizure onset experienced a 78% seizure frequency reduction at 6 years (Table 1) [6, 7, 18, 20].

Fig. 1
figure 1

Computed tomography imaging of three patients post-implantation of the RNS System, demonstrating the range of cases in which the device may be used. (A) Two cortical strips targeting the right anterior and posterior premotor cortex. (B) Two depth electrodes targeting a heterotopia in the left frontal lobe. (C) Two depth electrodes targeting the left and right hippocampi

Table 1 Summary of RNS System outcomes. A responder is defined as having ≥ 50% seizure reduction in total disabling seizures. All data come from studies published using the RNS Pivotal Trial cohort [6, 7, 20]

RNS System Technical Overview

We performed an in-depth investigation of the RNS System parameter space and event logging capabilities in order to obtain the necessary background and context needed to develop a platform for quantitative evaluation of parameter settings. First, we created a simplified representation of RNS System detection and stimulation parameters, shown in Fig. 2A with sample configurations. The RNS System parameter space can be separated into two main categories: detection parameters and stimulation parameters. The three primary types of detectors are bandpass, line length, and area, with additional built-in detectors for saturation and noise. Up to two leads, which contain four electrodes each, may be implanted using any combination of depth electrodes and cortical strips. Four electrode pairs are assigned to one of four amplifier channels, and two channels are selected to be detection channels for a total of two detecting electrode pairs. Next, up to two first-order Patterns, referred to as Pattern A and Pattern B, are configured. Each Pattern can be further comprised of up to two second-order patterns, referred to as Pattern A1, Pattern A2, Pattern B1, and Pattern B2. Each of these second-order Patterns corresponds to a single detection channel and detector.

Fig. 2
figure 2

(A) Simplified representation of RNS System detection and stimulation parameters with sample configuration. Icons represent configurable groups of configurable settings. Highlighted icons (green) represent a sample of enabled settings. Hardware. Two depth electrodes (leads 1 and 2) are connected to a programmable processor. Detection. Detection is enabled for channels 1 and 2. Pattern A1 is enabled with a line length detector to trigger when a detection occurs on channel 1. Pattern A2 is enabled with a bandpass detector to trigger when a detection occurs on channel 2. Pattern A triggers when Pattern A Detector 1 or Pattern A Detector 2 trigger. Pattern B2 is enabled with a bandpass detector to trigger when a detection occurs on either channel 2. Pattern B1 is disabled. Stimulation. Therapy 1 only is configured with different response for Pattern A versus Pattern B. The montage is configured in bipolar fashion to deliver subsequent therapy in bursts that alternate between lead 1 and lead 2. (B) Closed-loop sequence of events. This sequence of events shows how the sample configuration (see Fig. 1) responds to monitored brain activity. Each ECoG snippet (top) represents activity that corresponds with a schematic (middle) and description (below). Detection (D) occurs, followed by a therapy (T) comprised of up to two bursts (B). Each subsequent therapy is contingent upon re-detection and represents a closed-loop; two bursts may occur for a single re-detection

Next, we mapped the sequence of events in the detection-stimulation loop (Fig. 2B). Stimulation can occur from all eight electrodes, and settings are configured for up to five consecutive discretely triggered stimulations, referred to as therapies, comprised of up to two consecutive bursts each. The cathode (positive) and anode (negative) electrode montage and current affect the volume of tissue treated and must be configured for each burst. The bursts of the first therapy only may be configured to respond differently to specific Patterns. The recording amplifier is deactivated during stimulation to prevent signal saturation and damage. The maximum total number of therapies in a given 24-h window is also configurable.

We next evaluated several types of event timestamps generated by the device when detecting and stimulating an electrophysiological event, such as pattern detection, saturation, magnet swipe, and therapy events. Pattern detection occurs when the criteria of configured detector are met and a detection flag is triggered. Saturation events occur when neural signal amplitude exceeds a programmable threshold of a recording channel. Magnet swipe events occur when a patient uses the handheld RNS magnet (wand) to indicate a subjective event. Therapy events mark the delivery of neural stimulation bursts. Detection, magnet swipe, scheduled, and saturation events may be configured to trigger the storage of a corresponding ECoG recording on the RNS device. The length of recording is also configurable and is typically set to 90 s, comprised of 30 s of pre- and 60 s of post-trigger activity. Contiguous detection events, comprised of an initial detection followed by one or more re-detections without interruption, are called episodes. Episodes that last less than a configurable amount of time (15–30 s) are considered to be aberrant activity, interictal spikes, or subclinical discharges. Detection events that exceed this amount of time are called long episodes and, along with saturation events and magnet swipes, considered to be electrographic seizure patterns, potentially corresponding to clinical or subclinical seizures. Storage is limited to approximately four 90-s four-channel recordings, after which the device begins overwriting the oldest recordings. Patients are instructed to upload the preserved recordings via a handheld telemetry device on a daily basis. The recordings and other information from the device, including event timestamps and total numbers of events since last upload, are then transferred from the handheld device to the NeuroPace Patient Data Management System (PDMS). The PDMS is a web-based tool that functions as an RNS-specific electronic medical record system and contains information about device programming epochs, device event history, and some basic analytics to assist in interpreting the data.

Medtronic has also developed a closed-loop brain modulation system (Activa PC+S and Activa RC+S). We have unique first-hand experience with these devices, implanted in a non-human primate with idiopathic epilepsy [21, 22]. The Activa platform is also comprised of four channels but has a higher sampling rate of up to 1000 Hz, making it capable of detecting higher frequencies as compared to the RNS System. The battery is also rechargeable via a transcutaneous wand and is implanted in the chest rather than intracranially. In addition to onboard storage, the device is also capable of streaming data in real time to a nearby platform. The Activa platform, however, currently is not FDA-approved.

Challenges in Programming Closed-Loop Systems

There exist numerous obstacles to successful implementation of closed-loop devices, which may only be apparent through first-hand experience with this newer technology. First, the device generates a considerable volume of neural recording data for each patient, which must be reviewed and interpreted by a physician and the clinical team [23]. The tools currently available for analyzing and understanding the nuances of a patient’s course, including but not limited to cumulative therapy, unique seizure onset patterns, and ictal spectral dynamics, are currently inadequate and onerous to implement. Further, the number of ECoGs the device can store at a given time is limited and determined by a combination of customized device configurations and the patient’s unique neurophysiology. These factors can significantly bias recordings available to the clinician (Sisterson et al., under review). Second, there is a paucity of experimental data to inform the configuration of either detection or stimulation parameters in order to maximize both therapeutic benefit and implant lifespan [24, 25]. The wealth of recordings generated by the implant could theoretically be used to motivate patient-specific device programming; however, there is a lack of analytic tools to synthesize these data into actionable results. Third, despite years of working with neural stimulation, there is a general lack of mechanistic explanation for its effects, as well as biomarkers to measure and track patient response. To maximize the utility and efficacy of closed-loop stimulation, the mechanisms of neural stimulation must be better understood, and a more precise understanding of what types of neurophysiologic signals (e.g., interictal vs ictal) to target for stimulation is needed.

The RNS System generates a considerable volume of neural recording data and associated metadata for each patient, requiring equally considerable time devoted to its review and interpretation by both physicians and the RNS clinical team. Further, it is crucial to understand that the ECoG recordings may represent only a small and temporally biased view of what the RNS System is actually detecting and stimulating. However, this bias can be partially compensated for using a weighted extrapolation of the RNS System log files, rather than relying solely on the ECoG-driven reports (Sisterson et al., under review). The extrapolated calculation is an improvement to observing only the ECoG recordings, and provides greater insight into what the RNS System is actually doing in terms of detection and stimulation with respect to the patient’s neurophysiology.

Closed-loop devices offer unprecedented access to years of chronic human brain ECoG recordings. However, it is important to note the limitations of working with neural stimulation devices in human subjects. Currently, it is not possible to discern the efficacy of detection, and the effect of stimulation, during a given event (Table 2). The ability to delineate these scenarios retrospectively, using ECoG snippets, would provide a better understanding of potential therapeutic mechanisms, as well as valuable data for informing detection and stimulation parameter adjustments. It may be possible to discern a deterministic signature in the pre-seizure ECoG, such that recordings can be retrospectively analyzed as true positive detections where seizures were successfully terminated by neural stimulation versus false positive detections. The current systems have limited processing capabilities that are not capable of running computationally complex algorithms, such as machine learning, which has shown promise in offline seizure detection [26]. While such an analysis would likely be too computationally expensive to be useful for real-time detection, it would allow for better exploration of different stimulation durations, frequencies, and currents.

Table 2 Summary of the possible outcomes of event detection and stimulation

Additionally, the population of patients implanted with the RNS device is unique among other populations of patients with epilepsy. These patients have typically had a protracted and severe course of disease. Standard outcomes, such as seizure frequency and employment status, may not adequately reflect the therapeutic benefits of responsive neural stimulation. Seizure intensity and duration must also be considered [27, 28]. Quality of life scores may offer the most clinically relevant outcome, but are often time-consuming to administer, particularly in high volume centers. We propose using a subsection of the standard neurological quality of life assessment that fits well with clinical care and is already standard protocol at a number of centers. Better standardization of closed-loop stimulation therapy outcomes will enable more meaningful and impactful research, guide patient selection, device configuration—i.e., a more personalized medicine approach—and allow both patients and physicians to make better informed decisions.

One final barrier to overcoming the challenges posed in this discussion is the limited patient population at individual institutions. Development of more robust seizure detection parameter adjustments and prediction of closed-loop stimulation responder status warrants further exploration of the effect of different stimulation dosages on seizures of different etiologies and classifications.

Informatics for Personalized Medicine

In a closed-loop device, such as the RNS System, stimulation is triggered by pattern detection. Thus, an important way to consider the function of detector settings is as a prescription for determining the amount of stimulation therapy to deliver. However, the numerous parameters of the device are large and therefore complex to configure. Some previous studies suggest that optimal stimulation should occur at random intervals, at the highest tolerable doses (i.e., charge density) [29]. Other studies suggest that the effect of neural stimulation on factors such as gene and protein expression may be cumulative, reaching maximum efficacy after a certain duration of treatment or accumulation of stimulation delivered [30]. Detection and stimulation parameters currently are adjusted primarily based on recommendations by the device manufacturer (NeuroPace), guided by data gathered during their pivotal clinical trials, anecdotal experience, and ongoing work.

A limited understanding, however, of detection parameters, stimulation parameters, and therapeutic mechanisms of action represent significant barriers to optimizing therapeutic response in a truly personalized fashion [23, 31, 32]. For example, it is critical to understand both this parameter space and exactly what the device is doing on a daily basis, in order to adjust treatment settings in a rational fashion. This goal is challenging, because the numerous parameters of the device create a near-infinite number of possible settings and are therefore complex to configure [33]. To date, experimental and clinical data to guide the configuration of either the seizure detection or the stimulation parameters, in order to maximize both therapeutic benefit and implant lifespan, are extremely limited [25, 34, 35]. To begin developing a biophysically rational approach for analyzing and manipulating these parameters, we evaluated our initial experience with the RNS System using a bottom-up, data-driven approach based on device-captured neurophysiology data.

To address the huge amount of data generated by the RNS device, we created an extract, transform, and load pipeline to acquire and organize the information in an ongoing fashion. This system runs on the Microsoft SQL Server 2012 platform. Extract, transform, and load jobs are scheduled to update the database on a nightly basis. ECoG recordings are obtained directly from NeuroPace on a quarterly basis. To analyze the data, we wrote a series of scripts in MATLAB, making use of ECoG spectral analysis, basic statistics, and machine learning algorithms. This platform for biophysically rational analysis of individualized neural stimulation data (BRAINStim) augments the basic trend graphs presented in the PDMS and was used to generate the statistics reported in the results section. Further, this platform places the raw data at the disposal of both the researcher and clinician and facilitates exploration, aggregate reporting, and spectral analysis (Fig. 3). The BRAINStim platform also allows us to begin asking basic questions about adjustments to basic detection and stimulation parameters and lays the groundwork for developing an algorithm to optimize the RNS detection parameters using a combined machine learning and brute-force strategies. The overall goal is to achieve seizure reduction more quickly and efficiently by better optimizing device detection and stimulation parameters.

Fig. 3
figure 3

Flow diagram of data loading, pre-processing, manual review, and calculations using the BRAINStim© platform. (A) Data crucial to the analysis of RNS System performance are loaded from the PDMS using a custom C#.NET HTML parsing tool. (B) Raw ECoG data, along with hardware diagnostic information, are loaded from files provided by NeuroPace. (C) ECoG data are sorted into groups by programming epoch, which are exported as .EDF files. (D) ECoG data are manually reviewed, and EIP onset and laterality are annotated. All data are imported back into the database and merged with the original files. (E) Weighted calculation scripts are executed on the database. (F) The results of the scripts are loaded back into the database and used to generate figures, as well as to facilitate further analysis

Chronic human brain recordings have also revealed phase-correlated circadian and multidien rhythms in both interictal epileptiform activity (IEA) and electrographic seizure patterns [36]. We successfully replicated these findings in our own data, and additionally performed an autocorrelation coefficient analysis using BRAINStim, which revealed long-term temporal patterns in theta oscillations and seizure frequency [37]. Further development of these analytic methods may allow for detection of infradian brain state patterns that correlate with seizure frequency and inform future neuromodulation strategies involving closed-loop seizure prediction.

Mechanisms of Therapeutic Response to Closed-Loop Brain Stimulation

Recently, we analyzed recordings from the RNS System in our patients, for clues to the effects of invasive brain stimulation on patients’ neurophysiological signals and discovered novel electrophysiological signatures of stimulation-induced modulation of the seizure network (Kokkinos et al., under review). Spectral analysis revealed two primary categories of modulatory effects on electrographic seizure patterns. Direct effects occurred shortly after (< 5 s) the first stimulation pulse, while indirect effects occurred well after (> 27 s) the first stimulation pulse. Importantly, we found that indirect effects were correlated with patient outcomes, whereas direct effects were not.

Two types of direct effects were observed, which we termed direct inhibition and direct frequency modulation. Direct inhibition is consistent with that expected from prior literature (Fig. 4A) [14]. In addition to inhibitory effects, we identified modulation of the spectral constituents of electrographic seizure patterns that occurred in conjunction with individual stimulation events. This direct frequency modulation effect was variable in nature and consisted of both attenuation of the baseline frequencies, as well as the genesis of novel oscillations at higher-than-baseline frequencies.

Fig. 4
figure 4

Mechanisms of electrographic seizure pattern modulation in closed-loop neural stimulation. (A) Direct inhibition. Stimulation directly inhibits the progression of an electrographic seizure pattern. (B) Indirect inhibition. Baseline alpha-range rhythm (top) is replaced by a double-band of independent theta and beta frequencies (bottom)

We identified five types of indirect effects, which did not result from individual stimulation events. We observed seizure patterns whose progression was spontaneously discontinued in the absence of a direct stimulation event, during periods of baseline activity (Fig. 4B). We termed this effect indirect attenuation, given that the delay between the nearest stimulation and the effect observed precludes causality from a single stimulation event. We also identified changes in the spectral constituents of electrographic seizure patterns that were not related to individual stimulation events, i.e., indirect frequency modulation, which emerged over time during the course of responsive neural stimulation therapy. Likewise, we observed indirect fine fragmentation of electrographic seizure patterns, in which the refractory interval between consecutive seizure spike discharges increased. We also observed examples of indirect coarse fragmentation of electrographic seizure patterns, in which the continuity of an ongoing discharge was interrupted by segments of normal background activity. These seizure fragments occurred in random intervals from the onset of any given stimulation and with variable duration. Finally, we observed significant bi-directional changes in the mean duration of electrographic seizure patterns that occurred in the absence of direct stimulation events.

The fact that indirect modulation effects are strongly correlated with improved seizure control, rather than the effects of direct stimulation on triggered seizures, indicates that neural plasticity is required for a therapeutic response, and constitutes a paradigm shift in thinking about neuromodulation for epilepsy. Our findings suggest that chronic electrical stimulation progressively disrupts the connectivity of the epileptogenic network and reduces the core synchronized population, rendering the clinical manifestation of seizures less severe. Ongoing work seeks to identify the specific stimulation scenarios that produce chronic neuromodulation effects on seizure networks, in order to improve the therapeutic speed and efficacy of closed-loop brain stimulation.

Conclusions

Closed-loop parameter space and event logging is vast and complex. The amount of data generated, lack of experimental evidence for configuring detection and stimulation parameters, and unclear mechanism of action are key challenges that must be addressed in order to maximize the benefits of closed-loop therapy for drug-resistant epilepsy. A bottom-up informatics-based approach, employing machine learning and brute-force combinatorics, offers the potential for a more personalized approach to elucidate optimal parameters, with reduced clinical burden. Questions of causality and selection of appropriate patient outcome measures must be acknowledged when using data generated by closed-loop devices. Nonetheless, we have identified several neuromodulatory mechanisms that may account for changes in clinical seizure manifestation. Further advancements in our understanding of the mechanisms underlying the clinical effects of closed-loop neural stimulation may provide biomarkers useful for patient selection, monitoring patient response, and guiding adjustments to detection and stimulation settings. As the evidence for therapeutic benefit of the RNS System continues to grow, we expect this technology to be increasingly utilized in additional epileptic populations, such as pediatrics and generalized epilepsy. Novel mechanistic evidence implicates the role of neural plasticity induced by programmable closed-loop stimulation and suggests this therapy may be useful in certain psychiatric populations as well, such as obsessive-compulsive disorder. Continued advancement in the field of closed-loop brain stimulation likely will be facilitated by multi-institution collaborations for more generalizable and better powered results.