AUTOMATIC HIGH-FREQUENCY OSCILLATION DETECTION FROM TRIPOLAR CONCENTRIC RING ELECTRODE SCALP RECORDING

Epilepsy is the second most prevalent neurological disorder which affects about 1% of all the humans on the earth. It has different causes and symptoms with the seizures as the main symptom. The seizures are char acterized as some abnormal electrical activities of the brain. The main therap y for epilepsy is using anti-epileptic drugs which can help around 60% of the patients. Th e ot er therapy for the patients who cannot be cured by drugs is surgery. In order t o define the brain tissue which is generating the seizures, there is a need to record electrical activity from the brain (electroencephalogram) with a very good signal qual ity. Tripolar concentric ring electrodes (TCREs) were in troduced by Besio for electroencephalography (EEG) using TCREs (tEEG). Th e novelty of the TCRE and instrumentation is that two bipolar differential si gnals from three closely spaced electrode elements are recorded. Then the tripolar Laplacian derivation as a weighted sum {16*(M-D)-(O-D)} where O, M, and D are the pote n ials on the outer ring, middle ring, and central disc of the TCRE, respecti v ly, is performed. We have shown that compared with conventional EEG signals, tEEG h as nearly 4-fold (374%) the signal to noise ratio and less than one-tenth (8.27 %) the mutual information. The goal of this work is to demonstrate that TCREs provide a unique opportunity to record high-frequency oscillations (HFOs) from s calp. To do so, a procedure was developed to process the signals making time freque ncy spectrograms and short time power spectrums to automatically detect HFOs. To ac complish this goal, we first make the time-frequency spectrogram and then the sh ort time power spectrum for the whole recording. Then specify the frequency band wh ere the narrow band high power brain activities happen and check the localized pow er spectrum for one second sections at this frequency to determine the time of the HFOs. Finding the HFOs and the areas of the brain generating the seizures, whi ch is the goal of this research, can lead to very good surgical outcomes. We expect the se techniques to improve diagnosis of epilepsy.

The existence of the Epilepsy disease goes back to thousands of years ago, but it started to be understood only in the past hundred years or so. It is one of the most frequent neurological diseases with an overall occurrence between 0.5 and 1% [1].
One of the main symptoms of epilepsy is the epileptic seizure and anyone knows that the seizures can be frightening or strange if be experienced, especially when there is no access to modern science. First seizure finding records goes as far back as the first days of history and can even be found in the bible. Although some few scientifically minded have provided more empirical observations, but these records tend to be really religious or superstitious. All of them tried to explain and cure this strange phenomenon with different types of methods.
Robert Bentely Todd in 1849 in Lumleian lectures he delivered to the Royal College of Physicians, described the first electrical theory of epilepsy [2]. John Hughlings Jackson in 1873 was actually the first person who credited with the electrical theory. It was thought that unpredictable electrical discharges from the entire body was the cause of epilepsy though the brain was not designated as the source at the time. What was left for future scientists to discover about Jackson's first theory of epilepsy as an electrical abnormality was to explain the sensory alterations with this theory make better definitions.
Epilepsy is defined as a dysfunction of cerebral functions marked with attacks of anxiousness with or without convulsions [3]. Patient may experience strange sensations, emotions (auras), behaviors and or convulsions consisting of muscle spasms or possibly a loss of consciousness as a result of disturbance in the normal pattern of neural activity. It is possible to explain the dysfunction in cerebral functions in many different ways. The dysfunctions including genetic abnormalities causing the individual to be more susceptible to epilepsy, abnormalities in development, encephalitis, traumatic head injury, brain tumors, brain clots, levels of inhibitory and excitatory neurotransmitters, even changes in heart rate or using alcohol can lead to the seizure onset. There are also some types of epilepsy that have no clear, identifiable cause. These types of epilepsy that have no identifiable cause are called cryptogenic, opposed to symptomatic.
A widely accepted basic theory mentions that the loss of nerve cells in the hippocampus because of oxygen lack, results in excitatory and inhibitory neurotransmitters get imbalanced, mainly glutamate (excitatory) and GABA (inhibitory) are the results of these events in the brain. This imbalance of excitatory and inhibitory neurotransmitters will result in either too much inhibition or excitation, and the brain at this moment responses to shut down until it has stabilized [4].
Neurons normally fire at about 80 times per second, but during a seizure they may fire as much as five hundred times per second. This increase in the number of neuron fires is characterized as abnormal electrical activity like sharp spike waves which the EEG can show them [5].
Seizures can have very different effects, some with very mild effect which is hardly noticeable, even to the victim, to some with serious convulsions. There are important points to know for dealing with epilepsy including the point of the origin of the seizure if applicable and how much of the brain is affected and the way they spread. The attacks contain a wide range of different types including simple partial attacks, complex partial attacks, general attacks, secondary generalized attacks, myoclonic, atonic, and tonic-clonic attacks.
Working on a disease such varied needs a wide range of treatments. To do so, many different methods have been developed. Surgery, drugs, and many of other treatments are used in treating epilepsy currently. Each one of these treatments may vary a lot to match the particulars of epilepsy in each patient. A total cure of epilepsy may be obtained in some cases using these various treatments, but more commonly they just result in a reduction of seizures helps the patients to live with the disease easier. The first treatment used in dealing with epilepsy is anti-epileptic drug therapy.
Many anti-psychotic drugs were used as a therapy to other mental disorders, such as Depakote in the early days, which are proved that can be useful to prevent epileptic seizures and some of them are still in use today. It is proved that tranquilizers, like phenobarbital and valium, also can be useful. A new type of drugs known as anticonvulsants, with a wide variety of them available, has been developed as a therapy for this disease. Drug therapy for epilepsy is not an easy process. Before finding a successful method, it needs a wide range of trial and error.
Many different combinations and doses should be tried in order to find the most optimum treatment for the patient to reach the goal which is providing the maximum reduction of seizures with the minimum number of side effects. The actual effectiveness of drugs may vary little, but the doctor needs to find the minimum side effects. It may take a long time to try different types of drugs before a final treatment is implemented. The side effects of these drugs can be completely different, they may include things such as blurry or double vision, unsteadiness, fatigue and stomach problems and also there are some idiosyncratic side effects that may be different from drug to drug and patient to patient. Drug treatment may last for only a couple of years or may be required for the entire life time [6].
Anti-epileptic drugs can help approximately 60-70% of epilepsy cases and in the remaining which the seizures are still refractory, surgery is the next option. Surgery only works on about a third of the 30-40% that cannot be treated with drugs so it is a fairly rare procedure and falls into two general categories: surgery to remove the brain tissues generating seizures and surgery to cut the neural pathways to prevent the seizures spread. The area of the brain which generates the seizures must be discovered after it is made clear that the surgery is needed. The brain tissues can be removed only if it can be clearly identified and the removal of this tissue does not involve any serious brain injuries. After removing that area in the brain, the epilepsy is completely cured in the patient. This method of surgery is called lesionectomy. There is another version of this procedure, which is more extreme, a functional hemispherectomy that works with the complete removal of the hemisphere of the brain in which the seizure is generated. This procedure is only performed in young children who suffer from particularly severe forms of epilepsy.
Another procedure, known as multiple subpial transection, can be used if the area of the brain originating the seizure cannot be safely removed. This procedure involves a series of shallow cuts around the seizure generating area and cuts them while leaving normal brain function intact. There is a more severe form of surgery that works to prevent spreading of the seizure, a corpus callosotomy. It is used only in adults suffering from the most impairing cases of epilepsy. This process involves disconnecting the two hemispheres of the brain to prevent the seizure to spread in both halves of the brain. This procedure does not provide a full cure and just reduces generalized seizures to partial seizures. It also has some interesting side effects on brain operation.
So, in order to help the surgeons to better understand which parts of the brain are the origin of the seizures, we need to record the signals from the brain and understand if they contain abnormal activities and find their origins in the brain.

Electroencephalogram
Epilepsy is misdiagnosed in up to %50 of the patients of all ages which is really common [7], [8]. In the 1930's the first method for testing the electrical hypothesis for epilepsy was discovered by Hans Berger when he used the electroencephalogram (EEG) first in humans. The abnormal electrical patterns that occurred in the brain during an epileptic seizure proved that the problem must be electrical and also showed the brain as its origins. Sometime later in 1939, in order to allow studying the disease and experimenting treatment methods, the first animal model was developed and the first drug as epilepsy treatment was developed in this year [6].
The EEG is the noninvasive method of recording electrical brain activity with electrodes on the scalp and is one of the primary modalities for epilepsy diagnosis.
The EEG records the electrical activity from many neurons of the brain. The EEG is an important tool in studying and diagnosing neurological disorders like epilepsy, because it produces very useful information about different physiological states of the brain. The EEG is commonly used to record the abnormal brain activities which are caused by epileptic seizures. These abnormal signals in the EEG displays nonstationary behavior including spikes, sharp waves, or spike-and-wave, and focal mono-rhythmic discharges; where patients with epilepsy can have specific features in their EEG. Seizures are shown in the EEG as paroxysmal events. They are characterized by stereotyped repetitive waveforms. Therefore it is possible to detect seizure occurrence from significant parameters and dynamical changes in the EEG of epilepsy patients [9], [10].
A significant drawback of EEG, however, is that it typically has poor signal quality due to movement artifacts and muscle contractions. High-frequency oscillations (HFOs) primarily recorded from electrodes on the brain, electrocorticography (ECoG), have shown promise for localizing epileptic brain tissue [10]. Epilepsy diagnosis is complicated by the fact that electrical potentials recorded from EEG have poor sensitivity to localized epileptiform activity, especially HFOs.

High Frequency Oscillations
The HFOs are now attracting much attention as a promising marker of epileptogenesis, a process by which a normal brain develops epilepsy, and ictogenesis, processes by which seizure activity arises in the brain [11], [12]. 3. the removal of HFO-generating areas correlates with good surgical outcome [13], [14], [15].
Thus, HFOs appear to be an excellent marker for the epileptogenic zone but its recording from scalp with conventional disc electrodes is difficult. EEG has been a very useful research and clinical instrument for almost a century since its first human use. However, it has significant limitations as a tool to measure brain activity. The distance to the brain and the relatively large electrical impedance of the skull significantly reduce small electrical signals generated by individual neurons. The signal should be produced by a relatively large population of neurons acting more or less synchronously at scales of at least several centimeters in order to be detectable at the scalp [16]. Only in this case the sum of individual neuronal signals becomes large enough to be detected at the scalp. Synchronous activity within neuronal assemblies is now considered as an important mechanism of information processing, and this synchrony is expressed through neuronal oscillations occurring at different frequencies spanning several orders of magnitude from infraslow (~0.01 Hz) up to ultrafast (~1000 Hz). There is an intricate relationship between temporal and spatial scales of brain oscillations in that higher frequency oscillations (e.g., high gamma band >60 Hz) usually occur at smaller distances between sources and involve smaller neuronal populations. This is because more precise synchronization dictated by shorter oscillatory periods can be achieved only through shorter neuronal connections with shorter propagation times or non-synaptic communication such as ephaptic interactions, gap junctions, etc. Long distance connections have longer propagation times and therefore synchronization at larger distances is less precise and preferentially occurs at lower frequencies (e.g., within delta, theta, alpha and beta bands). As a result, high frequency oscillations >60 Hz usually reflect activity within well localized neuronal assemblies at spatial scales of a few mm, which are not typically "visible" from the scalp. Conventional EEG has low sensitivity to high frequency components of brain activity. Conventional scalp EEG is also contaminated by noise represented by non-brain electrical activity such as ocular artifacts, scalp muscle potentials, electrocardiogram, etc. [17]. Additional noise is occasionally produced by abnormally large electrode impedance, electrode movement, amplifier drifts, etc. The noise can be as large as, or even larger than, the brain potential of interest and represents a significant problem for electroencephalographers and neurologists. This noise shows high spatial coherence due to smearing effects of the head volume conductor [18], [19]. Conventional disc EEG recordings also have reference electrode problems. A common average reference and concentric electrodes have been proposed to resolve the reference electrode problems. However, in the common average reference recordings, it may happen that there are some components in many of the electrodes but not exactly in the electrode which we are interested in, that appear as "ghost potentials" [20].
There are a few reports of recording HFOs with EEG [21]. None of these reports describe how to automatically detect HFOs. They always include "visual inspection" to complement the signal processing. The visual inspection is time consuming and subjective to different reviewers' experience.
Thus, there is a strong need to develop new types of electrodes beyond conventional disc electrodes which are based on the principles similar to those used over eight decades ago by Hans Berger, the pioneer of electroencephalography.

Tripolar Concentric Ring Electrodes
To overcome the poor signal-to-noise ratio and reference problems of the disc electrodes, the tripolar concentric ring electrode (TCRE), a transformative electrode configuration, has been developed by Besio [22]. The TCRE consists of three electrode elements -outer ring, middle ring, and the central disc and as it is shown in Figure 2, it is distinctively different from the disc electrode which has a single element. The novelty of the TCRE lies in a new principle of recording electrical activity of the brain from the scalp through its three closely spaced elements. It can provide three separate signals from the three electrode elements, two bipolar differential signals used for the tripolar Laplacian derivation first described in [22] as a  The tripolar signal is a 'hardware realization' of the Laplacian i.e., the second spatial derivative of the scalp signal [23]. Unlike other software methods ('Laplacian montages' in conventional EEG systems) which approximate the Laplacian by taking differences between disc electrodes placed, at best, >1 cm apart, the TCRE performs the Laplacian automatically and takes bipolar differences of the surface potentials from closely spaced (~1 mm) concentric electrode elements with a custom preamplifier. With the electrode elements so close to each other, globally originating sources such as eye blinks, muscle or motion related artifacts contribute nearly equally and are attenuated sharply when bipolar differences are performed by the preamplifier [17]. Compared with disc signals, EEG recorded with the TCRE (tEEG as described by [17]) has about 374% increase in signal-to-noise ratio (SNR) and 8.27% the mutual information between signals recorded from two adjacent TCREs (which suggests a significant attenuation of volume conductance effects and, as a result, higher spatial resolution) [22]. The TCRE also has strong attenuation of various artifacts. It has also been shown that transcranial focal electrical stimulation (TFS) via TCREs in rat models was effective in reducing penicillin induced myoclonic jerks [24], pilocarpine induced status epilepticus (an extreme form of continuing seizures) [25] and in a third model, TFS was applied in rats treated by pentylenetetrazole (PTZ). TFS significantly reduced PTZ-induced hypersynchrony at the beta and gamma frequencies [26]. Most recently, an automatic noninvasive seizure control system based on TFS was tested successfully on rats [27].

METHODOLOGY
All the data were previously recorded by Dr.Besio. These recordings are available for his team to work on projects.

Patients
Patients for this study were recruited from the National Institute of Neurology and Neurosurgery (NINN; fifteen patients) and Rhode Island Hospital (RIH; two patients).
Patients were referred by the epilepsy clinic in each institution with the diagnosis of drug resistant epilepsy using the International League Against Epilepsy criteria [28].
Diagnosis of epilepsy and epileptic seizures was based on the international classification of seizures 1981 [29] and epileptic syndromes 1989 [30]. The recording protocols were approved by the institutional review boards at each hospital. Ictal and non-ictal recordings were obtained; for non-ictal recordings lateralization and localization of the irritative zone (IZ) was determined whereas in ictal recordings the SOZ or IZ was identified with the appearance of behavioral changes associated with focal low voltage, fast activity, flattening or slow wave interruption [31].
The recording protocol was designed in such a way as to avoid any interference with clinical EEG recording and evaluation. To obtain tEEG recordings in parallel with the clinical EEG, the TCREs were placed just behind the disc electrodes in locations close to the 10-10 sites as it can be seen in Figure 3. The ground was placed on the forehead (RIH, NINN) and the reference electrode Seizure onset time was defined as the beginning of the first observable seizure pattern in either EEG or tEEG.

Signal Processing
The data have been stored on the hard drive and exported from Twin (Grass Technologies, West Warwick, RI) into ASCII text files that were then imported to MATLAB (Mathworks, Natick, MA) and converted to .mat files. For the tEEG, two bipolar pairs have been recorded for each TCRE. Then the data is preprocessed with the tripolar Laplacian algorithm [22]. The tripolar Laplacian algorithm was performed on the data from six of the patients during the processing but for the eleven remaining patients, the Laplacian derivation was performed in the hardware while recording.
Next we used a modified version of the algorithm reported by Gardner et al. [32] for detection of HFOs. The algorithm performs a continuous short-time Fourier transform to calculate the power within a particular frequency band over consecutive and different overlapping one second epochs using different types of tapering windows. We selected segments up to an hour (mostly half an hour) prior to the onset of the seizures and generated spectrograms to follow the temporal dynamics of preseizure HFOs.
A spectrogram, by the definition, is a visual representation of the spectrum of frequencies in a signal as they vary with time. For simplicity, assuming spectrogram denoted as S, the strength of the spectrogram at a specific frequency component f j and the time t i is represented by the color of that point [33].
Here x(τ) is the data and h(τ) is the sliding analysis window used to section the data into quasi-stationary segments. The concept of spectrogram is very close to that of a spectrum. A spectrum describes how the energy of the signal changes over its frequency components. A spectrogram does exactly the same but also takes another factor into account: time. While spectra provide stationary information about frequency and energy (in a given interval in time), spectrograms assume quasistationary and display the spectral changes that are assumed to occur slowly over time. In order to generate spectrograms we need to apply a window h(τ) to segments of the data with some percentage of overlap on our data. The type of window helps to avoid frequency artifacts from the abrupt edges of the segments of data. It is common to overlap the windows to smooth out some of the abrupt changes from moving the window through the data. To determine if our thresholding technique (explained later) is robust, we tested various types of windows: Blackman, Hamming, and Gaussian along with overlaps of 0%, 25%, 50% and 75%.
Further, we wish to eliminate the 60 Hz interference and its harmonics from the spectrogram and the power spectra. We tested a comb filter for this application. In order to use a comb filter properly, the sampling frequency of the filter should be exactly the same as the sampling rate of the data and also it should be divisible by 60 in order to eliminate 60 Hz and harmonics. Unfortunately, the sampling rate for our data is not divisible by 60; it is 200, 400, 800 and 1600 Hz. Alternatively, we applied different notch filters for 60 Hz and each of its harmonics. The notch filter used in this research is the filter set in MATLAB and we set the order of the notch filter (N) at 10 and the quality factor (Q) at 40.
To detect the HFOs we find the narrow-band high-power brain activity (NBHPBA) areas in the spectrogram. Currently, methods to accomplish this are either to visually analyze the spectrogram which is time consuming and subjective, or to observe the time domain (time series or the time course of power modulation, which is the sum of the powers of all the frequencies for a specific window width) [34], [35], [36].
The time course of power modulation (TCPM) is calculated based on the equation bellow: The TCPM and a new algorithm proposed in this thesis will be used to display a measure of time-varying spectral power. For the initial phase of each algorithm, the entire data set will be used for the power estimates and threshold values; later, when a region of interest is identified, only a "localized" or small subset of the data will be used for a "localized" threshold. Here, t start is the starting time of the recorded signal and t end is ending time; t min and t max denote the starting and ending time when a smaller sub set of data are used.
It was found that in our dataset, the TCPM does not guarantee the detection of NBHPBA in some cases. As it is shown in the spectrograms of Figure 4, a 19 channel tEEG recording which begins 30 minutes before the seizure onset, we can see NBHPBA in channel 17. For a better view the spectrogram for channel 17 has been expanded in Figure 5.  Applying a threshold of the mean plus one standard deviation of the TCPM to the recordings shown in Figure 3, produces the results of Figure 6.
Threshold = mean(TCPM) + one standard deviation(TCPM) In Figure 6 the light red line is the threshold and as we can see, it is clear that we cannot distinguish channel 17 from the other channels using the mean plus one standard deviation of the TCPM as the threshold shown in Figure 6. In hopes of solving this problem, I calculate the short time power spectrum (STPS) instead of calculating the TCPM within a particular frequency band. In other words, using the MATLAB coding language, the old method says that using this formula: Alternatively for this research the method shown below was used:

STPS = sum (data(frequency_range, time_range), 2) ;
In this explanation, the word "data" is our spectrogram which is dependent on two vectors of frequency and time and the number "1" in the formula means to add the components of the spectrogram for the first vector, which is the frequency_range, for each time given in the time_range. In other words, sum all the components (different values for different frequencies) of the spectrogram for each windowed data segment of the time_range, to produce a one dimensional function of time. The only difference between these two ideas is the number "2" instead of "1" which means add the components of the spectrogram for the second vector which is the time_range for each frequency given in the frequency_range. The equation below shows the mathematics of this method.
The results of using this method on the recordings shown in Figure 4 are demonstrated in Figure 7. We can see that channel 17 now has a peak between 250 and 300 Hz, red ellipse, which is not present in the other channels. for the previous five seconds segments, helps to eliminate the influence of artifacts on the threshold making peaks in the localized STPS above the threshold likely due to HFOs than artifacts. Once the NBHPBA is found in a windowed segment, we use that time as an index to analyze the tEEG time series for HFOs. In the next section, we show the results of using different windows and different percentage overlaps followed by spectrograms and STPS for all patient data.
The picture bellow shows the flowchart of how the algorithm works. Figure 8 The flowchart of how the algorithm works.
In the flowchart, we first calculate the spectrogram and STPS, then starting from the beginning frequency, we check the STPS to see if it goes above the threshold which is set to the mean plus one standard deviation of the STPS calculated for the entire data. If we have a peak at frequency f j , we evaluate the short time Fourier transform (STFT) squared magnitude of one windowed data segment centered at time t i . We set the threshold for this one segment to be the mean plus one standard deviation of the previous five seconds STPS which is shown here: And the mean at this stage is calculated by: Where N equals the number of frequency samples between f min and f max.
If it goes above this threshold, then we know the time t i and frequency f j where we have NBHPBAs and will go to the time series for this time and frequency and check it for the HFOs.

Advantage of using TCREs instead of Conventional Disc Electrodes
Video-EEGs and tEEGs were performed in all the patients. Simultaneously recorded EEG and tEEG and the corresponding spectrograms from representative patients are shown in Figures 9 and 11. For Figure 9, the patient was a 42-year-old woman with seizure onset at 9 years. Seizures were simple and complex partial. She had been diagnosed with right temporal lobe epilepsy and had undergone a right temporal lobectomy but seizures persisted. In Figure 9, conventional EEG data are on  The tEEG TCPM for the data shown in Figure 9 zoomed in between 98 and 110 seconds is shown in Figure 10. The horizontal dashed line is a threshold that is calculated as the mean plus one standard deviation of the TCPM.
If the TCPM went above this threshold it automatically showed where HFOs were present. This technique works very nicely in Figure 10 on the TCPM from Figure   9.  It is also important that the tEEG during the tonic seizure was less contaminated with muscle and movement artifacts than the EEG (by comparing panels E and F). Also we can see the higher power in EEG (compare panels A and C) from approximately 400 to 650 s when the patient was still anxious/disoriented and moving while recovering from the seizure. During that same period the movement-related artifact power was much lower in tEEG (Figure 11, C). These results show the advantage of using the TCREs instead of conventional disc electrodes. Visual inspection shows that tEEG provides improved signal to noise ratio, attenuation of muscle artifacts, and detection of HFOs over EEG.

Window testing
We tested three different types of windows and four different overlaps on three of the patients to see if using different windows alters the thresholding results.

Blackman Window
The Blackman Window characteristic is shown in Figure 12 below: Figure 12 Blackman Window characteristic This window was used with different percentages of overlap (75%, 50%, 25% and 0%) to produce the spectrograms for data we have.

Hamming Window
The Hamming Window characteristic is shown in Figure 13 below: Figure 13 Hamming Window characteristics This window was used with different percentages of overlap (75%, 50%, 25% and 0%) to produce the spectrograms for data we have.

Gaussian Window
The Gaussian Window characteristic is shown in Figure 14 below: Figure 14 Gaussian Window characteristic This window was used with different percentages of overlap (75%, 50%, 25% and 0%) to produce the spectrograms for data we have.

Results of Window Testing
The results of using the three different types of windows with four different overlap percentages are shown in the Figures 15, 16, 17 and 18.  Also changing the overlap percentage does not make any drastic differences that are visually apparent. However, no overlap with the Gaussian window, appears to have a slightly better visualization than the other windows and overlap percentages. Better visualization here means better contrast of the NBHPBAs on the spectrograms (shown by red ellipses in Figure 18). Therefore, the Gaussian window with no overlap was used for the rest of this research.
Following are the spectrograms and STPS for each one of our patients and the results of how the algorithm works to detect HFOs:

Patients with no epileptic activity
In this group of our patients, they have no epileptic activity nor seizures. It is expected not to detect any NBHPBAs in the results from the patients in this group.
We have the data for two patients in this group.

PATIENT#1
The data from this patient was recorded at 800 samples per second with 1-250 Hz hardware filters and gain of the pre-amplifier equal to 20. This patient had no epileptic activity, then the results should not have any NBHPBAs in the spectrogram and STPS.
The results are for a 30 minutes section of the recording.  As we expected, there is no NBHPBAs detectable in the spectrogram or STPS from the data of this patient. There are some peaks in the STPS of channel 4 that may be counted as NBHPBAs, but the fact is that these peaks are caused because of some problems in the electrodes and the recording for this channel that is reported.

PATIENT#2
The data from this patient was recorded at 400 samples per second with 1-200 Hz hardware filters and gain of the pre-amplifier equal to 50. This patient had no epileptic activity, then the results should not have any NBHPBAs in the spectrogram and STPS.
The results are for a 30 minute section of the recording.  As we expected, there is no NBHPBAs detectable in the spectrogram or STPS from the data of this patient.

Patients with seizure onset
In this group of our patients they had seizures. It is expected to detect NBHPBAs in the data from the patients in this group. We have the data for ten patients in this group and will show how the algorithm works to detect the HFOs in the results:

PATIENT#1
The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of the pre-amplifier equal to 6. The seizure starts at 13:07:23. The data were available for one hour prior to the seizure and were divided into two 30 minutes sections. The STPS related to the spectrogram shown in Figure 23 is shown in Figure 24. In this section of our data, the only channel that shows NBHPBAs is channel 17 (marked by red ellipse). In this channel, we can see NBHPBAs in 250-300 Hz band.    The results here are for the period of time from 12:05:00 to 12:35:00 which is about one hour before the seizure starts. Figure 27 is the spectrogram of all channels for the time corresponding to 12:05:00 to 12:35:00.

PATIENT#2
The data from this patient was recorded at 200 samples per second with 1-100 Hz hardware filters and gain of pre-amplifier equal to 6. The seizure starts at 13:15:42.
The data were available for the last 30 minutes before the seizure. Figure

PATIENT#3
The data from this patient was recorded at 200 samples per second with 1-100 Hz hardware filters and gain of pre-amplifier equal to 6. The seizure starts at 11:28:44.
The data were available for the last 23 minutes before the seizure. Figure 35 shows the spectrogram of all channels for the time section of 11:07:00 to 11:30:00. The seizure starts near the end of the spectrogram (at 1304s in the time scale).

PATIENT#4
The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 6. The seizure starts at 12:14:00.
The data were available for the last 12 minutes before the seizure. Figure 39 shows

PATIENT#6
The data from this patient was recorded at 1600 samples per second with 1-250 Hz hardware filters and gain of pre-amplifier equal to 6. The seizure starts at 09:56:02.
The data were available for the last 30 minutes before the seizure. Figure 163 shows the spectrogram of all channels for the time corresponding to 09:20:00 to 09:50:00.

PATIENT#7
The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. The seizure starts at 13:08:00. The data were available for the last 12 minutes before the seizure. Figure 63 shows the spectrogram of all channels for the time corresponding to 12:57:10 to

PATIENT#8
The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. The seizure starts at 13:51:00. The data were available for the last 12 minutes before the seizure. Figure 67 shows

PATIENT#9
The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. The seizure starts at 11:42:00. The data were available for the last 11 minutes before the seizure. Figure 71 shows      (192, 193, 194, 195 and 196s    The STPS of the data shown in Figure 75 is shown in Figure 76.

Patients with Epileptic Activity but no seizure
In this group of our patients, they have epileptic activity but no seizure onset. It is expected to detect NBHPBAs in the results from the patients in this group. We have the data for five patients in this group and here we can see how the algorithm works to detect the HFOs in the results: The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. There is no seizure in this data, but we have some epileptic activity. The data were available for a 30 minutes section. Figure 80 shows the spectrogram of all channels for the time corresponding to 09:30:00 to 10:00:00.

PATIENT#2
The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. There is no seizure in this data, but we have some epileptic activity. The data were available for a 30 minutes section. Figure 84 shows the spectrogram of all channels for the time corresponding to 13:00:00 to 13:30:00.     The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. There is no seizure in this data, but we have some epileptic activity. The data were available for a 30 minutes section. Figure 88 shows the spectrogram of all channels for the time corresponding to 14:00:00 to 14:30:00.

PATIENT#4
The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. There is no seizure in this data, but we have some epileptic activity. The data were available for a 30 minutes section. Figure 92 shows the spectrogram of all channels for the time corresponding to 09:30:00 to 10:00:00.     The data from this patient was recorded at 1600 samples per second with 1-500 Hz hardware filters and gain of pre-amplifier equal to 47. There is no seizure in this data, but we have some epileptic activity. The data were available for a 30 minutes section. Figure 96 shows the spectrogram of all channels for the time corresponding to 10:30:00 to 11:00:00     there is no restriction on using any specific window, among the three tested, or window overlap, of the four tested, for processing the data showing how robust the detection method is.
It was found that a comb filter was not appropriate to eliminate the 60-Hz and its harmonics since the sampling rate of the comb filter should be the same as the sampling rate of our data and also divisible by 60. Since our sampling rates are not divisible by 60, then we cannot use comb filters to eliminate 60 Hz and harmonics.
Instead, we can use different notch filters for each harmonics of 60 Hz in order to eliminate them and avoid very big spikes in the STPS. By using the window and notch filters mentioned above, we can make the spectrogram for all of our data and based on the spectrograms, plot the STPS for each one of them.
A closer look at the STPS and spectrograms at the same time, makes it clear that we can detect NBHPBAs as some spikes in the STPS which will pass the threshold which is set to the mean plus one standard deviation of the power for the time section we made the STPS. Setting the threshold as mentioned, works well for 14 out of 15 of the patient data that had NBHPBAs. For the other patient, if we make the STPS for a narrow frequency band and set the threshold to the mean plus one standard deviation of the power just for this specific section, we can visually see the NBHPBAs as some fluctuations in the STPS. This is likely due to the seizure starting very soon after applying the electrodes. Further, there were many motion artifacts and noise due to the EEG technologist was moving the electrodes to improve the skin-to-electrode impedance.
After detecting the NBHPBAs by the method mentioned above, we applied the algorithm to detect the HFOs in the tEEG time series for all of the patients having NBHPBAs. To accomplish this task, we made the STPS for each second of the recording time and set the threshold to the mean plus one standard deviation of a section containing the last previous five seconds of the data. The reason we calculated the threshold for five seconds instead of that one second we are looking at is to decrease the influence of artifacts or points which do not really have high power as NBHPBAs. This algorithm worked for all of the patients we tested to detect the HFOs in the tEEG time series.

CONCLUSION
It has been shown that EEG is frequently contaminated by artifacts originating from various sources such as scalp muscles, eye blinks, eye movements, or patient movement [37]. LeVan et al. [38] state what is intuitively obvious; artifacts obscuring the EEG at the time of seizure onset can greatly hinder the interpretation of the recorded seizures. During a tonic or tonic-clonic seizure, muscle activity is very prominent and is reflected in the EEG by random, high frequency signals [39]. Hallez et al. [40] showed that when EEGs were moderately contaminated with muscle artifacts blind source separation techniques based on canonical correlation provides signals that are more reliable for source estimation than raw EEG. They also found that in cases of severe muscle contamination of the EEG or when the muscle artifact had different spatial information than the spatial information of the epileptiform event, the blind source separation techniques based on canonical correlation did not work well. In general, a major reason why EEG has not reached its full potential in epilepsy diagnosis is due to artifact contamination. It have been found that the TCRE and the tEEG automatically attenuate myogenic activity and movement artifacts. In contrast to the typical examples of artifact contaminated conventional bipolar EEG, the tEEG is less contaminated by the muscle activity [41]. It should be noted that conventional approaches to remove muscle artifacts by digital signal processing (such as filtering) lead to significant loss of information since the gamma band activity and HFOs in general are within the bandwidth of the electromyogram (EMG). In other words, removing the EMG will inevitably remove high frequency components of the brain activity, which is not a desirable result.
In this study, we show, in a limited number of patients, that high-power HFO activity can be automatically detected at specific locations on the scalp surface in the tEEG records of patients with epilepsy suffering from seizure or patients having just epileptic activities but no seizures. This HFO activity was apparent prior to seizures.
Although there may have been HFO activity at various times in the tEEG during the recordings, the method explained in this study can detect them easily. Also the bandwidth of the HFO activity narrowed sharply and the power increased just prior to the seizure. We did not see the HFO activity in the conventional EEG, even when using bipolar montages which somewhat attenuates global artifacts.
In recent years high-frequency brain activity in the gamma-frequency band  Hz) and above has become the focus of a growing body of work in MEG/EEG research [42].
Most of these studies are based on algorithms working in the time domain to detect HFOs visually. There are some studies that first detect events of interest (EoI) in the time domain and then use wavelet-based time-frequency decomposition to validate detected events visually [43], [44]. Although there are some set of detectors that also detect EoIs in a first stage and then recognize high power oscillations in a second stage in the time-frequency domain, but they have some limitations [45]. One limitation of these studies is that their threshold of the detector is trained heuristically to optimize sensitivity in one patient and then keep the threshold constant for all the patients [46]. Based on our data, it is not a good idea to keep a constant threshold for all the patients. As we can notice, the magnitude of the STPS is different for each patient and applying a constant threshold may ignore some useful information about HFOs or detect some other low power activities as HFOs.
This study presents an algorithm to automatically detect the HFOs. We highlight the fact that the outcome from this algorithm is well related to the HFOs that constitute the training dataset, which is marked by experts. Furthermore, this algorithm can be designed as a detector which can be implemented for real-time detection either in software or embedded in hardware and installed in tEEG recording equipment for clinical use. Nonetheless, the detection of the HFOs are the first step of this research.

FUTURE WORKS
As a higher level of analysis, a mining algorithm can be used to find spatiotemporal patterns across multiple channels that assist the epileptologists to map epileptic networks. Such a contribution can aid localization of the epileptic area [47] as well as improving the study of ictogenesis. For instance, considering an implantable electrical stimulation device, the detection of HFOs can assist an epileptologist in where to place the intracranial electrodes for better likelihood of seizure control and relief. Naturally, this application raises the question on how much detection accuracy is needed to achieve an accurate epileptic network mapping, an avenue that certainly needs more research in future work.
Finally, HFOs can also track the dynamics of the brain, such that a tendency for a normal state or pre-seizure state [48] is obvious and in turn predict the state of the brain, as mentioned in Schiff et al. [49] where the authors found unique development dynamic properties for the start, development, and culmination of epileptic seizures.
Clearly the value of such work is determining reliable benchmarks for transitioning therapy and understanding of epileptic mechanisms from a retrospective to a prospective utility.