Abstract
Electrocorticographic (ECoG) signals represent cortical electrical dipoles generated by synchronous local field potentials that result from simultaneous firing of neurons at distinct frequencies (brain waves). Since different brain waves correlate to different behavioral states, ECoG signals presents a novel strategy to detect complex behaviors. We developed a program, EEG Detection Analysis for Behavioral States (EEG-DABS) that advances Fast Fourier Transforms through ECoG signals time series, separating it into (user defined) frequency bands and normalizes them to reduce variability. EEG-DABS determines events if segments of an experimental ECoG record have significantly different power bands than a selected control pattern of EEG. Events are identified at every epoch and frequency band and then are displayed as output graphs by the program. Certain patterns of events correspond to specific behaviors. Once a predetermined pattern was selected for a behavioral state, EEG-DABS correctly identified the desired behavioral event. The selection of frequency band combinations for detection of the behavior affects accuracy of the method. All instances of certain behaviors, such as freezing, were correctly identified from the event patterns generated with EEG-DABS. Detecting behaviors is typically achieved by visually discerning unique animal phenotypes, a process that is time consuming, unreliable, and subjective. EEG-DABS removes variability by using defined parameters of EEG/ECoG for a desired behavior over chronic recordings. EEG-DABS presents a simple and automated approach to quantify different behavioral states from ECoG signals.
Keywords: Computer science, Biomedical engineering, Medical imaging, Neurology, Neuroscience
1. Introduction
Understanding animal behavior (ethology) in natural conditions has been a hallmark of biology, beginning with Charles Darwin (Burghardt, 2009). By observing individuals or groups, scientists have been able to detect and understand complex animal behaviors, such as individuals interacting with others or individuals interacting with their environment (Homburger et al., 2014). However, discerning and deciphering behavioral states typically requires continuous observations over long periods of time. Unsurprisingly, the process of analyzing hours of activity is incredibly time consuming and not always accurate, reliable, or practical. Furthermore, defining behavioral parameters from a phenotype, such as the start and end time of a particular action, is often variable. One possible solution to the ambiguity is using electrocorticographic (ECoG) signals to create clear, defined parameters. Previously, we created a graphical user interface (GUI) called EEGgui that assisted in the detection of seizures observed after traumatic brain injury (TBI) using ECoG recordings (Sick et al., 2013). This was achieved by advancing short time period Fourier Transforms (STPFs) through ECoG signal time series to asses signal power in predefined frequency bands. Fast Fourier Transforms are a well-established technique chosen for EEG-DABS analysis because it is a widely utilized and understood algorithm to convert time domain functions, such as ECoG, into the frequency domain. Power in each frequency band was normalized to reduce variability between animals, and then events were only detected when their normalized power values exceeded values from an established “normal” ECoG recording (Sick et al., 2013). Seizure activity was quantitated using a predetermined pattern of power increase in all of the spectral frequency bands at every epoch.
Building on the previous design, we have altered the GUI to provide the possibility to detect multiple behavioral states, in addition to seizures, in an automated fashion over long recording sessions. EEG-DABS functions by detecting significant changes in frequency bands at every epoch, which creates a unique pattern of events that can then be correlated to a specific behavioral state. Furthermore, EEG-DABS is designed to automatically batch process multiple hours of records, by importing and analyzing data.
EEG-DABS incorporates a power normalization algorithm to facilitate EEG/ECoG comparisons amongst animals. The normalization corrects for quality differences between animal’s EEG/ECoG recordings and slow any long-term changes that might occur in a chronic recording (Gunasekera et al., 2015). One major problem stems from the tissue electrode interface, which affect signal amplitude and consequently spectral power (Freire et al., 2011). For example, activation of microglia during an inflammatory response will alter ionic concentrations, whereas activation of astrocytes, resulting from a glial scar, might cause the electrode tip to become encapsulated, which increases electrical impedance (Polikov et al., 2005; Vetter et al., 2004; Griffith and Humphrey, 2006). In order to correct this and allow animal comparison, EEG-DABS normalizes spectral power data continuously over time using median decaying memory, which normalizes power in each epoch of data to the previous 120 epochs (see Section 2.6: Median Decaying Memory). Median decaying memory was chosen for normalization because it outperformed 5 other common normalization techniques used to detect seizures in a recent publication. Logesparan and colleagues (2015) found that when removing signal noise, median decaying memory most accurately represented the original data and did not impair seizure detection ability. Moreover, its effects were consistent across human subjects, databases, subject vigilance, and lengths of recordings (Logesparan et al., 2015). Therefore, long-term changes in signal do not affect event detection since each section is normalized to the preceding epochs.
EEG-DABS described here uses three different modes to analyze ECoG recordings: Single File Mode, Batch File Mode, and Raster Plot Only Mode, which are described in more detail in the results section. The logic of the GUI was that Single File Mode would be used first to correlate a pattern to a behavior, and then the other two modes would be used to quantify that behavior over a long series of recordings. EEG-DABS detects significant changes in ECoG power compared with the power distribution of a reference ECoG in up to 10, user defined frequency bands. There are 6 default bands that correspond to traditional ‘brain waves’: delta (0.5–4 Hz), theta (4–8 Hz), alpha (8–12 Hz), beta1 (12–18 Hz), beta2 (18–30 Hz), and gamma (30–60 Hz). Once a behavior is calibrated, EEG-DABS can then be used to quickly quantify the occurrences of that behavior over long recordings. To quantify EEG-DABS success rate, the commonly observed rodent behavior freezing was utilized. Freezing, which was defined as a moving before and after stopping, was correctly identified by EEG-DABS using a predetermined pattern of events.
2. Material and methods
2.1. Lab chart macro
In order to simplify EEG collection and analysis, our laboratory created a simple macro in LabChart that starts, stops, saves, and then begins a new recording instantly every hour (Example Macro in Supplemental File 1). After the recording has completed, the macro will export all the files automatically, adding a digit to each subsequent file. Therefore, a week long recording will be broken up into 168 segments of one hour each. After the text files are exported, EEG-DABS can begin importing the data. By breaking up ECoG recordings into smaller divisions, the file size and computational power is reduced.
2.2. EEG-DABS analysis parameters
EEG-DABS allows the user to define a number of parameters before processing. These parameters can be assigned individually or left as defaults. The parameters (defaults) are the Recording Length (60 min), Sampling Rate (2,000 samples/s), Epoch Length (4 s), Event Limit (standard deviation; 4), FFT Window (512), FFT Overlap (0.5), and Length of FFT (4,000) (Fig. 1A). The event limit is the number of standard deviations away from the control power data in each spectral band that the experimental data must reach in order for an event to be considered significant. FFT window is the number of data points for each FFT used in the MATLAB windowing function (pwelch). EEG-DABS uses the Hamming window function, which is a weighted function used to reduce the effect of discontinuities that emerge when analyzing fixed duration segments (spectral leakage) (Harris, 1978). FFT Overlap describes what proportion of each successive FFT will overlap. Increasing the overlap increases frequency resolution of the FFT at the expense of computation time. Length of FFT is the number of data points that will be used to calculate the final FFT at each epoch. The default parameter of 4,000 will produce a FFT frequency resolution of 0.5 Hz when the sampling rate is 2000 pts/s and overlap is 0.5. Frequency resolution becomes important when establishing the width of frequency bands used during analysis. Decreasing the FFT length decreases the frequency resolution but increases temporal resolution of the analysis as it will allow shorter event epochs. The FFT length must be the same or less than the number of data points per epoch (defaults produce 8,000 points), or the spectral comparisons will not be time locked to the original data.
Fig. 1.
EEG-DABS layout. A, The main window of EEG-DABS allows the user to change the default analysis parameters, choose the frequency bands they want to use, generate new control powers, generate a normalization file, and load and analyze their data. B, The first step when using EEG-DABS is to select which frequency bands will be used for the analysis. Checking “Specify Frequency Bands” opens a new window where the start frequency, end frequency, and name of frequency band can be entered. Previously used frequency ranges can instead be loaded by clicking the “Load Previous Frequency Bands” button. Pressing “Done” will store the frequency band data and close the window. C, If the file has no problems, the raw EEG will be displayed. When “New Control Powers” is selected, new buttons will appear allowing the user to enter a region (in min) where they want to generate their control powers. EEG-DABS uses median decaying memory normalization, which requires a minimum of 120 epochs to begin. A 2 s epoch requires a range of at least 4 min (4 min X 60 s ÷ 2 s per epoch = 120 epochs). The region used for normalization can be changed by selecting “New Normalization” however it must be done after the new control file is created.
2.3. Load data
EEG-DABS uses 6 default frequency bands, delta (0.5–4 Hz), theta (4–8 Hz), alpha (8–12 Hz), beta1 (12–18 Hz), beta2 (18–30 Hz), and gamma (30–60 Hz). Four additional frequency bands may be added and the size of the frequency bands may be changed. However, this must be done prior to loading the data. Once “Specify Frequency Bands” is selected, a new window will appear allowing the user to enter the start frequency, end frequency, and the name of each frequency band. In addition, the user defined frequency bands can be saved and loaded so the user does not have to repeat entering the same information (Fig. 1B).
To begin processing, which can occur off-line, all original EEG recordings must be saved as text files. The recordings should have two data entries, time and voltage, each displayed in its own column. If files contain anything other than 2 data columns, an error will occur. Once the data is loaded, the Load Data function advances through the recording, adding NaN (not a number) values whenever there are missing voltage values (e.g when files have been edited to remove recording artifacts), in order to correct inconsistencies in the file. EEG-DABS also has no restrictions on the length of file or if there are breaks in time. Therefore, the recording does not have to be continuous, which maintains flexibility when generating ECoG data over great lengths of time. This is beneficial for recordings that were paused and then later resumed. While the data is being imported, a “Loading Data…” message appears, which will be replaced with “Done” when the import has finished.
Note: Before loading data, analysis parameters must be chosen or the defaults will be used. This is the last time a user can change the parameters and will be prompted with a warning message before they can proceed.
2.4. Generating new control data
In order for the program to detect events, EEG-DABS must compare normalized power values in each selected spectral band from the experimental recordings, to normalized control power values in the same spectral bands from a comparator baseline recording. The program was designed to allow the user to generate their own baseline file. The baseline data file could be a period of ECoG during a pre-defined behavioral state (e.g. awake exploring) from a naïve animal for comparison between animals, or it could be a period of ECoG from the same animal for comparison to a later treatment or experimental condition. The user is also able to create an average baseline using multiple animals (see below).
When creating new control data, the user must first select the “New Control Powers” check box, which exposes two new features; two boxes to enter a range of time and a button labelled “Generate Control Powers” (Fig. 1A). The user will then import data by selecting their file of interest, causing a figure of the raw, un-normalized EEG to appear (Fig. 1C). The displayed figure allows the user to determine the region of EEG they wish to use for their baseline. The region that the user determines should be inputted into the time boxes in minutes, and then “Generate Control Powers” button should be clicked, which creates a baseline file. If the data is not in the correct format, an error will appear. The generated file contains the mean powers at each frequency band and their respective standard deviation, based upon the preselected analysis parameters. Due to the normalization process, the first 120 epochs need to be blank (see Section 2.6: Median Decaying Memory) or an error will appear. One hundred and twenty epochs for the default parameters (2 s epoch) would require 240 s or 4 min of recording.
Note: If the user wants to make a new control powers file composed of multiple animals, they must first create new control powers for each individual animal. Next, they need to generate an array of means and standard deviations for each selected spectral band powers for the group. Once this is completed, they will need to open the “controls.mat” file in MATLAB, replace the values stored in that array with the new calculated multi-animal means and standard deviations, and save the file with the same name. EEG-DABS only uses “controls.mat” for its comparison with the experimental segments of ECoG (Supplemental File 2).
2.5. Normalization
The GUI allows the user to manually select a region of EEG used for normalization of their file. Similar to generating new control data, if “New Normalization” is selected, boxes appear for the user to enter the start and end time. The region selected must be at least 120 epochs long (see Section 2.6: Median Decaying Memory) or an error will appear again. Once “Generate Normalization” is pressed, the normalization values are stored and will continue to be used until “New Normalization” is selected again.
Note: If the user is also planning on creating a new control powers file, it must be done prior to this point. A message will appear warning the user that both boxes need to be checked before continuing with normalization. If “New Control Powers” and “New Normalization” are both selected, the user will first generate the control powers which then displays a prompt for the user to then enter the normalization region. The region of EEG used to generate control power data and normalization can be the same.
2.6. Median decaying memory
Before events can be detected, signal normalization must be performed in order to limit variations in spectral power that might occur, due to variations among animals in ECoG signal quality or slow changes that occur over time. The goal of normalization is to adjust the raw power values among animals to reduce variability and thus facilitate power comparisons. A more limited, previous method (Sick et al., 2013), normalized spectral powers derived from ECoG signals at each epoch by dividing them by the power obtained from the frequency band out of the range of interest (e.g. power value in the 100–200 Hz frequency band). This type of normalization works well but assumes first that there are no changes in spectral power in that frequency range due to experimental conditions, and second that any long-term changes in power due to changes in signal quality are proportional over all frequency bands. EEG-DABS utilizes median decaying memory normalization to overcome these constraints. This method normalizes power in each spectral band to the power of the preceding set of epochs in the same spectral band.
Median decaying memory is based on the Osorio-Frei method for seizure detection, which normalizes the power of the EEG foreground power (FP) to the background power (BP) with an exponentially decaying memory (Osorio et al., 1998). The foreground power is a moving window over the recent 2 s sequence defined as
| (1) |
with q1 = 480, which is the order of the median filter. The background power is defined as:
| (2) |
where λ is the decaying rate for the background (λ = 0.99923) and k is the index of the current epoch that is being analyzed. The relative power (RP) is calculated by:
| (3) |
In simple terms, median decaying memory normalizes the current epoch to the median power of the previous 120 epochs (Osorio et al., 1998; Kuhlmann et al., 2009). The effect is to normalize power values and to faithfully detect more rapid changes in power while eliminating slower, systematic changes in power. Beginning with the alpha frequency, its power is calculated for 120 epochs (only in the predetermined frequency range) and its median is then determined (Eq. (2)). The median value will then be used to normalize alpha for the subsequent 120 epochs (Eq. (3)). This process will repeat for every frequency band and will continue through the entire recording. In this way, each epoch is individually normalized without overlap and any changes that would occur in the recording, such as a gradual dampening, will be corrected with median decaying memory.
Since every epoch is normalized to the previous 120 epochs, there will be a gap at the beginning of the experimental file because nothing proceeds it. If a region of interest appears within the first 120 epochs, the user can manually select a region they wish to normalize the first 120 epochs to by selecting “New Normalization.” In Batch file and Raster Plot Only mode, the last 120 epochs of the preceding file will be used to normalize the beginning of the subsequent file.
2.7. Animals and ECoG recordings
All animal procedures were approved by the Institutional Animal Care and Use Committee at the University of Miami Miller School of Medicine. To record ECoG activity, rats had two silver-silver chloride wire electrodes implanted in their skull to a depth just over the dura (one 2 mm posterior from bregma, 3 mm right of midline and one 2 mm from lambda, 2 mm lateral to midline). A third electrode, which served as the amplifier ground, was secured to a screw implanted over the contralateral hemisphere. The electrode leads were connected to one side of a magnetic electrical connector (Magsafe™, Apple, Inc.), which was secured to the skull with dental acrylic, and the animal’s skin was closed with surgical staples. Recordings began 24 h after surgery.
Animals were recorded for one hour using a custom made headstage. The headstage used a unity-gain differential integrated circuit (Linear Technologies LT1101), high pass filtered above 0.5 Hz, which passed the ECoG signal to an second stage amplifier (CWE Model 820; MITRE Corporation, Bedford, MA) providing 100X amplification and additional low-pass filtering at 500 Hz, giving an effective signal bandpass of 0.5–500 Hz. Using PowerLab and LabChart software (ADInstruments, Colorado Springs, CO), the signals were then digitized and recorded. Video was also recorded to measure animal movement. Behavioral states were visually identified from simultaneous video monitoring of the awake animals by a blinded observer. Twelve animals were used throughout the experiments.
3. Results
In order to unbiasedly detect behaviors, a MATLAB program was developed called EEG-DABS that automatically identifies changes in behavioral states based on alterations of EEG/ECoG.
Even though EEG-DABS was written in MATLAB, it was only tested on a Windows operating system, and thus Windows should be a system requirement before running the program. To demonstrate EEG-DABS behavioral detection capabilities, the commonly observed “freezing” behavior in Sprague-Dawley rats was used. The key features of EEG-DABS are as follows: 1) It provides comparisons of normalized EEG/ECoG powers in multiple spectral bands for detection of significant differences in power. 2) It can be used along with video analysis to first detect behaviors of interest and then to quantify the defined behavior rapidly based on EEG. 3) It allows user-defined frequency bands and temporal epochs for Fast Fourier Transformations. 4) It normalizes EEG/ECoG powers using median decaying memory processing to facilitate comparisons among animals and over long time periods. 5) It allows batch processing of EEG/ECoG records. To allow flexibility with data analysis, we developed three different modes to analyze EEG/ECoG data that can work alone or in concert, depending on the question the researcher is asking: Single File Mode, Batch File Mode, and Raster Plot Only Mode, which only shows the detected significant events. An executable version of EEG-DABS is provided in Supplemental File 3 with examples files available in Supplemental File 4.
3.1. Establishing user-defined comparator behavioral state for event detection
A key feature of EEG-DABS is its ability to compare the experimental states of interest with a baseline/control behavioral state using an EEG/ECoG signal. To examine freezing behavior, the EEG associated with awake, freely moving behavior was chosen for the comparator. Awake EEG/ECoG was then selected and processed to produce normalized control power data that were stored in the “controls.mat” file.
3.2. Selection of EEG/ECoG single/batch file and analysis output display
EEG-DABS has the option to analyze the data in three different modes: Single File Output Fig. 2, Batch File Output, or Raster Plot Only, displaying only EEG/ECoG power events that are significantly different from control powers. Further description of these modes and an explanation of the calculations for the analysis along with examples from data produced in our laboratory are shown below. Example outputs from each of these modes are shown below Fig. 3, Fig. 4.
Fig. 2.
Outline of data analysis. After importing the raw EEG, the GUI will perform a Fast Fourier Transform separating the signal by power and time for either the specified frequency bands or the 6 default frequency bands. The power at each frequency band is then normalized prior to event detection. Median decaying memory normalization was utilized to correct any signal alterations that sometimes occur with chronic recordings. If the normalized experimental power is significantly different from the normalized control power, based on the Event Limit parameters, the GUI will determine an event has occurred for this frequency band (denoted as a dot) when analyzing the experimental data. This is repeated for each frequency band in every epoch. If this is the first time analyzing the data, a new set of control powers will need to be created prior to experimental analysis. However, a different region for normalization can be selected after the control file is made.
Fig. 3.
Analysis Mode: Single File. Once the control powers are generated and the experimental data is loaded, there are three different types of analyses that can be performed by EEG-DABS. The first is Single File Mode, which will display two different windows. A, The first window has an independent graph for each frequency band and the raw EEG. The graph of each frequency band shows where and when an event occurs with a dot. B, The second window displays the raw EEG and the 6 frequency band events on the same graph, making it easier to discern patterns that may correspond to a desired behavior.
Fig. 4.
Batch File and Raster Plot Only Analysis with EEG-DABS. Batch File and Raster Plot Only Mode are the final two analyses that can be performed with EEG-DABS. A, Batch File analysis mode will sequentially analyze each file in the selected folder by displaying the frequency band events below the raw EEG. B, Raster Plot Only mode will analyze all the files in the selected folder and concatenate the data into one raster plot. Batch File analysis is ideal for verifying patterns associated with a behavior, and Raster Plot Only analysis is ideal for quantifying a behavior once a pattern has already been determined. Normal freezing behavior for Sprague-Dawley rats occurred under two conditions, called Type1 and Type2, which are displayed in raster plot mode (B).
3.3. Analysis and event detection
EEG-DABS advances through each EEG/ECoG recording using FFT to compute power in each of the pre-selected frequency bands. Power in each band is calculated as the area under the curve, in each frequency band. Using median decaying memory (see Section 2.6: Median Decaying Memory), power values are normalized, stored, and plotted over time. The normalized power values are then compared to the control values using the Event Limit (standard deviation) input parameter. For every epoch/frequency band in which the power value differs from the control power value by the number of standard deviations specified, EEG-DABS will display, a dot signifying an event (Fig. 2). All data were recorded using the sampling rate of 2000 samples/sec.
Note: Temporal resolution for event detection is dependent upon the epoch length. Increasing temporal resolution of event detection would require shortening epoch length but may also require changing the parameters of the FFT calculation.
3.4. Single file mode
Single file mode is useful for acquiring control power values and for testing parameter values for FFT and event detection since it uses smaller data files. Analyzing with Single File Mode will open two windows. The first window will have separate graphs of each frequency band with events displayed above their respective normalized signal, and an additional graph of the raw EEG (Fig. 3A). The second window displays all the detected significant frequency events plotted over a single graph of the raw EEG signal (Fig. 3B). Single File mode is beneficial for analyzing only one file, typically 1 h, in detail. The first window provides more information by plotting the normalized power bands and detected events. The second window is useful for deciphering if a pattern of detected events corresponds to a behavior since all the frequency bands are displayed directly above each other (Fig. 3B).
3.5. Batch file mode
Batch File Mode is designed for analyzing a series of files and ideal for identifying all instances of an event pattern that corresponds to a behavior of interest across multiple hour segments. EEG-DABS will analyze the first file, display the data (the second window from Single File Mode), and then will continue until every recording has completed in the selected folder (Fig. 4A).
Note: It is recommended to use a maximum of 24 files unless there is sufficient computer memory allocated (∼2GB of RAM per 60 min file). Even though the GUI processes files sequentially, the displayed MATLAB figures hold all the data points into RAM before creating an image. Therefore, the maximum number of hour segments a computer can handle, depends upon both the amount of files processed and the sampling rate for each file.
3.6. Raster plot only mode
Raster Plot Only Mode is useful for determining a discrete pattern for a specific behavior. This analysis mode amalgamates event data from every recording in a selected folder and presents it as a single raster plot (Fig. 4B). In order to determine specific behavioral states from raster plot data, we matched video recordings to a 3–5 h segment of events generated in Raster Plot Only Mode. Watching the freezing behavior and comparing it to the raster plots, distinct, consistent patterns began to emerge. If a distinctive pattern does not become apparent for a specific behavior, we altered the default parameters, such as the epoch length, standard deviation, or frequency bands until a new pattern appears. However, once the parameters are changed, they must be kept consistent for the duration of that behavioral analysis.
After the behavior was calibrated, we used a combination of the other two analyses to quantify the frequency and duration of the determined behavior. Batch File Mode was utilized first, processing around 10 h of recordings at a time, to quickly inspect if each hour segment had the behavior we were identifying. Then the hours of interest were analyzed closer with Single File Mode to confirm and quantify that behavior. An advantage of Raster Plot Mode was the computer memory requirements were minimized for large data sets because raw EEG/ECoG signals were not stored and displayed.
Note: Once EEG-DABS analyzes the data (regardless of analysis mode), it will create an excel spreadsheet of each frequency band’s total power wherever an event occurred. This happens at every epoch for each analysis mode. Excel can then be used to easily detect significant events and quantitation of combinations of events, in different frequency bands. This information is useful for quantification, calculating or plotting changes in power over time for any recording.
3.7. Spectrum view for different behavioral states
EEG-DABS ability to correctly identify behavioral states from a predetermined pattern was evaluated using the common rodent behavior freezing. An animal was considered to demonstrate freezing if they were moving prior to the episode and continued to move after the episode. Independent identification of freezing states by video analysis indicated that these events were associated with two distinct electrocorticographic changes. The first type of freezing was associated with seizure-like, spike/wave discharges (SWDs) that we called Type1. A Type1 event was accompanied by significant power events in all default frequency bands: delta (0–4 Hz), theta (4–8 Hz), alpha (8–12 Hz), beta1 (12–16 Hz), beta2 (16–20 Hz), and gamma (20–60 Hz). Freezing was also noted occasionally without SWDs. During these freezing states ECoG analysis indicated significant power changes in frequency bands below 20 Hz. We termed these freezing events Type2. In addition, we observed differences between the two types of freezing. Type1 freezing was associated with a maximum power at higher frequencies than Type2, and it had significantly greater power (Fig. 5) at every frequency we measured. But both types had much greater power outputs than awake behaviors (Fig. 5). For Fig. 5 analysis, a significance threshold of 3 standard deviations was used, which produced zero false negatives.
Fig. 5.
Determining Power Spectrum using EEG-DABS. Example of three different behaviors quantified with EEG-DABS. After the GUI calculates an EEG record's power spectrum, it calculates the power based upon a set of defined frequencies and then compares it with a control power. To assess freezing behavior, bins were separated into 4 Hz frequency bands ranging from 0–24 Hz. Freezing behavior appeared under two conditions, identified as Type1 and Type2. Type1 had significant power events in all frequency bands, whereas Type2 had large increases in power, but only spanning 20 Hz. There was a difference in awake behavior when the plot was zoomed in (inset). By altering the frequency bands, standard deviation, and reference recording, the user can isolate the pattern of significant events for the designated behavior. If the reference recording was from awake animals, events would occur in both Type1 and Type2. Each instance is comprised of 3 different examples from 4 different animals.
3.8. EEG-DABS detects freezing behavior
The benefit of using EEG-DABS is that once a pattern is determined for a designated behavior, the behavior will always appear with that pattern. Furthermore, the program is designed to allow the user the ability to adjust parameters in order to optimize detection of a selected behavior, both in frequency band combinations and detection thresholds. We assessed EEG-DABS’s ability to correctly identify freezing behavior by examining multiple derivations of that pattern. As the number of frequency bands used for a pattern increased, the program detected fewer instances of that pattern and produced less errors (Fig. 6A). Conversely, fewer frequency bands increased the number of occurrences of the freezing behavior EEG pattern, and it subsequently generated additional errors. Patterns using 5, 4, or 3 frequency bands all correctly identified freezing behavior and produced no errors. Lower frequency bands (0–12 Hz) created the greatest number of significant events without creating an error (Fig. 6B). Thus, there appears to be an ideal number of bands or band combinations when selecting which pattern best represents the behavior of interest. Once behavioral states are determined, the user can quantify the frequency of the specific behavior and its total duration (number of events multiplied by the epoch length) with relative ease using Raster Plot Only Mode. The total number of freezing events that were independently identified by video monitoring are displayed in Fig. 6C. A significance threshold of 3 standard deviations were used for Fig. 6 analysis.
Fig. 6.
EEG-DABS can Correctly Detect Predetermined Behaviors. The greater the number of frequency bands used, the better EEG-DABS was at recognizing the associated behavior. A, Patterns using 5, 4, or 3 frequency bands produced no errors, whereas 1 and 2 bands generated many errors. B, As the number of frequency bands used for a pattern increased, there were less examples where that pattern was identified. Lower frequency bands (0–12 Hz) were better predictors then high frequency bands at detecting freezing events and demonstrated minimal errors. The 2 pattern bands (8–16 Hz) also created no errors but appeared fewer number of times than the 0–12 Hz band. The total number of independent events, which correspond to each band’s errors are displayed in B. The number of independently identified events by video analysis are displayed in panel C.
4. Discussion
On a cellular level, cognition and behavior are simply groups of neurons interacting with each other by synchronizing their rhythmic oscillations over large regions of the cerebrum (Vetter et al., 2004). Complex rhythmic firings allow multiple lobes of the brain to communicate together in order to divide and incorporate various tasks (Lopes da Silva, 1991). In the past, researchers have proposed to quantify cognition using EEG, by correlating behavior to either individual frequency bands, evoked potentials, latency in EEG outcomes, or their spectral densities (Cavanagh and Frank, 2014; Murthy and Khan, 2014; Walsh and Anderson, 2012). However, all these methods are limited because they generally require subjective evaluation of the behavior or EEG pattern.
We have created an automated approach to record, save, export, and analyze ECoG signal in order to detect and quantify different behavioral states. EEG-DABS unbiasedly generates raster plot data from ECoG signals, which reliably reproduces discernable patterns; a task that would not have been easy or objective in the past. Once a pattern (that is associated to a behavior) is determined, EEG-DABS can be utilized to efficiently quantify the frequency and duration of that behavior using a chronic recording. Since the behavior freezing is easily observable on video, this response was utilized to evaluate EEG-DABS ability to correctly identify behavioral states. Freezing events were characterized by two unique raster plot EEG patterns that we classified as Type1 and Type2. Type1 had large power increases in frequencies ranging from 0–40 Hz, whereas Type2 only had power increases up to 20 Hz. EEG-DABS correctly identified both types of freezing behavior, although Type2 freezing occurred many more times than Type1 freezing. Furthermore, since Type2 only occurs with Type1, it appears to be a subset of Type1, suggesting that this characteristic EEG might be part of a more complicated behavior. In our recordings, large power increases in bands from 0–20 Hz were always associated with freezing. Whereas, there was a very low likelihood of freezing occurring without large increases in power in these same bands.
Despite the efficiency and ease of approach, there are some limitations with EEG-DABS. The program does require manual work initially establishing the detection criteria for a particular behavior, but once established, it allows behavior quantitation over long recordings sessions. Since EEG-DABS analysis is dependent on the control file and input parameters used, it is subject to variability. For example, if an event pattern is calibrated to a behavior, changing the control file or parameters will likely change the future pattern that emerges and thus would require a new calibration. Also, EEG-DABS is only as good as the user’s ability to initially calibrate the program. If the user cannot identify an event pattern that corresponds to a specific behavior, the program might not be useful. In order to overcome this limitation, the user has the ability to adjust the specific frequencies of interest, the standard deviation for event detection, and the reference recording. Having full control of all parameters maximizes the likelihood of identifying a unique pattern for a designated behavior. Although the procedure described here was designed to analyze a single EEG/ECoG trace, there should not be any limitation on the number of recordings (multiple electrodes) that can be processed. This would allow spatial analysis of signals, representing changes in different brain regions.
In order to maximize sensitivity when identifying a behavior, it appears there is an ideal number and range of frequency bands that determine a specific pattern of a behavior. Becoming less stringent with the number of bands, increases the instances of that pattern but also increases the number of “false positives”. This is why there are three times as many significant events with 1 frequency band as compared to 3 frequency bands. For example, since only Type1 produces significant events in higher frequency bands, if we only used Type1 criteria we would have missed all the lower events associated with Type2 freezing. Therefore, it is important to find a unique pattern using as many bands as possible that is both specific and sensitive. Moreover, if there is no significant difference from the reference recording during a behavior, a possible solution is to move the electrode. Because EEG-DABS is designed to detect EEG changes associated with behaviors, it is incredibly important to position electrodes over areas of the brain that have a large (or suspected to) neuronal output in response to that behavior. In addition, EEG-DABS should be thought of as an interactive process where the user can adjust the detection criteria in order to maximize the accuracy, while subsequently limiting the number of false positives and negatives. For example, increasing the standard deviation would increase the number of false positives, whereas decreasing the standard deviation would increase the number of false negatives. By understanding the limitations of EEG-DABS, the user can better adjust their parameters in order to discern a specific behavior.
If the EEG of a behavior is well characterized, EEG-DABS has the potential to be used in many different behavioral analyses and not just simple behaviors such as freezing (Fig. 7). For example, the whisker system on rats is well understood with around 250 neurons representing an individual whisker (barreloid) (Van Der Loos, 1976). Mechanoreceptors can respond quickly and synchronously to slight deflections (Simons and Carvell, 1989), relaying sensory information through the ventro-posterior medial nucleus (VPM) (Waite, 1973) to layer IV of the somatosensory cortex (S1) (Temereanca et al., 2008). EEG-DABS would likely produce significant and unique patterns in response to a specific whisker stimulation from recordings of the VPM or S1. Similarly, EEG-DABS might be able to detect other behaviors such as learning and memory paradigms (Klimesch, 1996; Miltner et al., 1999), motor and olfactory behavioral tasks (Hermer-Vazquez et al., 2007), fear conditioning (Stujenske et al., 2014; Hellman and Abel, 2007), stages of sleep (Borbely et al., 1981; Fell et al., 1996), memory consolidation (Axmacher et al., 2008), and mating (Fang et al., 2012). It is also conceivable that the GUI could be useful in more complex processes, such as states of awareness or sleep disorders. In addition, since the method itself is not limited to just surface recordings of brain waves, it could also be used for deep recordings as well. For example, the method might be valuable for detecting periodic theta and gamma rhythms and their relationship to memory consolidation in the hippocampus. Therefore, the ability to unbiasedly categorize various behavioral states reliably with EEG-DABS has the potential to accelerate more than just ethology.
Fig. 7.
Determining Behavioral States from Raster Plot Data. Three examples of distinct behavioral states using EEG-DABS Raster Plot Only analysis mode. Scratching will occur with a train of events in Beta 1, whereas eating occurs with a train of events in delta and alpha. A seizure appears when there is an event in every frequency band at a given epoch. Behavioral states can be quantified if the user has already established which discrete pattern correlates to a specific behavior (usually determined from video). Raster plot data can be quantified by the frequency and duration (number of epochs multiplied by the epoch length) of that behavioral state over a long period of time. All behaviors should be verified with video recordings and use clearly defined behavior criteria.
Declarations
Author contribution statement
Zachary B. Loris: Conceived and designed the experiments; Performed the experiments; Analyzed and interpreted the data; Contributed reagents, materials, analysis tools or data; Wrote the paper.
Mathew Danzi: Performed the experiments; Analyzed and interpreted the data.
Justin Sick: Conceived and designed the experiments.
Dalton Dietrich, Helen Bramlett: Conceived and designed the experiments; Analyzed and interpreted the data.
Thomas Sick: Conceived and designed the experiments; Analyzed and interpreted the data; Contributed reagents, materials, analysis tools or data.
Funding statement
This work was funded with the support of the AHA16PRE27050003, DODW81XWH-12-1-0618, NIHNS042133, Veterans Affairs grantBX000521-01, and The Miami Project to Cure Paralysis.
Competing interest statement
The authors declare no conflict of interest.
Additional information
Supplementary content related to this article has been published online at http://dx.doi.org/10.1016/j.heliyon.2017.e00344.
No additional information is available for this paper.
Acknowledgements
The authors would like to thank Neda Mokhtari for her help collecting and analyzing EEG-DABS’s event detection. We would also like to thank Joseph Wasserman and Dr. Hassan Al-Ali for their technical contributions to this study.
Appendix A. Supplementary data
The following are Supplementary data to this article:
References
- Axmacher N., Haupt S., Fernandez G., Elger C.E., Fell J. The role of sleep in declarative memory consolidation–direct evidence by intracranial EEG. Cereb. Cortex. 2008;18(3):500–507. doi: 10.1093/cercor/bhm084. [DOI] [PubMed] [Google Scholar]
- Borbely A.A., Baumann F., Brandeis D., Strauch I., Lehmann D. Sleep deprivation: effect on sleep stages and EEG power density in man. Electroencephalogr. Clin. Neurophysiol. 1981;51(5):483–495. doi: 10.1016/0013-4694(81)90225-x. [DOI] [PubMed] [Google Scholar]
- Burghardt G.M. Darwin's legacy to comparative psychology and ethology. Am. Psychol. 2009;64(2):102–110. doi: 10.1037/a0013385. [DOI] [PubMed] [Google Scholar]
- Cavanagh J.F., Frank M.J. Frontal theta as a mechanism for cognitive control. Trends Cogn. Sci. 2014;18(8):414–421. doi: 10.1016/j.tics.2014.04.012. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Fang G., Yang P., Cui J., Yao D., Brauth S.E., Tang Y. Mating signals indicating sexual receptiveness induce unique spatio-temporal EEG theta patterns in an anuran species. PLoS One. 2012;7(12) doi: 10.1371/journal.pone.0052364. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Fell J., Roschke J., Mann K., Schaffner C. Discrimination of sleep stages: a comparison between spectral and nonlinear EEG measures. Electroencephalogr. Clin. Neurophysiol. 1996;98(5):401–410. doi: 10.1016/0013-4694(96)95636-9. [DOI] [PubMed] [Google Scholar]
- Freire M.A., Morya E., Faber J., Santos J.R., Guimaraes J.S., Lemos N.A. Comprehensive analysis of tissue preservation and recording quality from chronic multielectrode implants. PLoS One. 2011;6(11) doi: 10.1371/journal.pone.0027554. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Griffith R.W., Humphrey D.R. Long-term gliosis around chronically implanted platinum electrodes in the Rhesus macaque motor cortex. Neurosci. Lett. 2006;406(1-2):81–86. doi: 10.1016/j.neulet.2006.07.018. [DOI] [PubMed] [Google Scholar]
- Gunasekera B., Saxena T., Bellamkonda R., Karumbaiah L. Intracortical Recording Interfaces: Current Challenges to Chronic Recording Function. ACS Chem. Neurosci. 2015;6(1):68–83. doi: 10.1021/cn5002864. [DOI] [PubMed] [Google Scholar]
- Harris F.J. On the use of windows for harmonic analysis with the discrete Fourier transform. Proc. IEEE. 1978;66(1):51–83. [Google Scholar]
- Hellman K., Abel T. Fear conditioning increases NREM sleep. Behav. Neurosci. 2007;121(2):310–323. doi: 10.1037/0735-7044.121.2.310. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Hermer-Vazquez R., Hermer-Vazquez L., Srinivasan S., Chapin J.K. Beta- and gamma-frequency coupling between olfactory and motor brain regions prior to skilled, olfactory-driven reaching. Exp. Brain Res. 2007;180(2):217–235. doi: 10.1007/s00221-007-0850-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Homburger H., Schneider M., Hilfiker S., Luscher A. Inferring Behavioral States of Grazing Livestock from High-Frequency Position Data Alone. PLoS One. 2014;10:1371. doi: 10.1371/journal.pone.0114522. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Klimesch W. Memory processes, brain oscillations and EEG synchronization. Int. J. Psychophysiol. 1996;24(1-2):61–100. doi: 10.1016/s0167-8760(96)00057-8. [DOI] [PubMed] [Google Scholar]
- Kuhlmann L., Burkitt A., Cook M., Fuller K., Grayden D., Seiderer L. Seizure Detection Using Seizure Probability Estimation: Comparison of Features Used to Detect Seizures. Ann. Biomed. Eng. 2009;37(10):2129–2145. doi: 10.1007/s10439-009-9755-5. [DOI] [PubMed] [Google Scholar]
- Logesparan L., Rodriguez-Villegas E., Casson A.J. The impact of signal normalization on seizure detection using line length features. Med. Biol. Eng. Comput. 2015;53(10):929–942. doi: 10.1007/s11517-015-1303-x. [DOI] [PubMed] [Google Scholar]
- Lopes da Silva F. Neural mechanisms underlying brain waves: from neural membranes to networks. Electroencephalogr. Clin. Neurophysiol. 1991;79(2):81–93. doi: 10.1016/0013-4694(91)90044-5. [DOI] [PubMed] [Google Scholar]
- Miltner W.H., Braun C., Arnold M., Witte H., Taub E. Coherence of gamma-band EEG activity as a basis for associative learning. Nature. 1999;397(6718):434–436. doi: 10.1038/17126. [DOI] [PubMed] [Google Scholar]
- Murthy G., Khan Z.A. Cognitive attention behaviour detection systems using Electroencephalograph (EEG) signals. Res. J. Pharm. Technol. 2014;7(2):238–247. [Google Scholar]
- Osorio I., Frei M.G., Wilkinson S.B. Real-time automated detection and quantitative analysis of seizures and short-term prediction of clinical onset. Epilepsia. 1998;39(6):615–627. doi: 10.1111/j.1528-1157.1998.tb01430.x. [DOI] [PubMed] [Google Scholar]
- Polikov V.S., Tresco P.A., Reichert W.M. Response of brain tissue to chronically implanted neural electrodes. J. Neurosci. Methods. 2005;148(1):1–18. doi: 10.1016/j.jneumeth.2005.08.015. [DOI] [PubMed] [Google Scholar]
- Sick J., Bray E., Bregy A., Dietrich W.D., Bramlett H.M., Sick T. EEGgui: a program used to detect electroencephalogram anomalies after traumatic brain injury. Source Code Biol. Med. 2013;8(1):12. doi: 10.1186/1751-0473-8-12. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Simons D.J., Carvell G.E. Thalamocortical response transformation in the rat vibrissa/barrel system. J. Neurophysiol. 1989;61(2):311–330. doi: 10.1152/jn.1989.61.2.311. [DOI] [PubMed] [Google Scholar]
- Stujenske J.M., Likhtik E., Topiwala M.A., Gordon J.A. Fear and safety engage competing patterns of theta-gamma coupling in the basolateral amygdala. Neuron. 2014;83(4):919–933. doi: 10.1016/j.neuron.2014.07.026. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Temereanca S., Brown E.N., Simons D.J. Rapid changes in thalamic firing synchrony during repetitive whisker stimulation. J. Neurosci. 2008;28(44):11153–11164. doi: 10.1523/JNEUROSCI.1586-08.2008. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Van Der Loos H. Barreloids in mouse somatosensory thalamus. Neurosci. Lett. 1976;2(1):1–6. doi: 10.1016/0304-3940(76)90036-7. [DOI] [PubMed] [Google Scholar]
- Vetter R.J., Williams J.C., Hetke J.F., Nunamaker E.A., Kipke D.R. Chronic neural recording using silicon-substrate microelectrode arrays implanted in cerebral cortex. IEEE Trans. Biomed. Eng. 2004;51(6):896–904. doi: 10.1109/TBME.2004.826680. [DOI] [PubMed] [Google Scholar]
- Waite P.M. Somatotopic organization of vibrissal responses in the ventro-basal complex of the rat thalamus. J. Physiol. 1973;228(2):527–540. doi: 10.1113/jphysiol.1973.sp010098. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Walsh M.M., Anderson J.R. Learning from experience: event-related potential correlates of reward processing, neural adaptation, and behavioral choice. Neurosci. Biobehav. Rev. 2012;36(8):1870–1884. doi: 10.1016/j.neubiorev.2012.05.008. [DOI] [PMC free article] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.







