A Novel Algorithm for Online Spike Detection

. Recordings of extracellular spikes have been widely used in various fields ranging from basic neuroscientific research to clinical applications. However, in the extracellular recording system, how to accurately detect spikes from the recorded signal in real time is still a major challenging work. Although the existing algorithms for online spike detection have made great progress, there still remains much room for improvement in terms of accuracy. In this paper, we propose a new method for high accuracy and real time spike detection. Concretely, differential operator is firstly employed to accentuate spikes in the signal for its simplicity and strong capacity to detect significant changes. Then, by exploiting the structural features of spikes, the resolution parameter is introduced to improve the performance of differential operator. Finally, a simple and effective measure is utilized to further reduce the influence of background noise, which makes spike detection more accurate. The results of simulated and real data show that the proposed method is able to precisely detect spikes while maintaining low computational complexity.


Introduction
In the past decades, neural activity has been widely studied to provide a useful mean for understanding brain function.With the development of electrophysiology, neuroscientists have found that neurons transmit information to each other by firing spikes [1].Many questions in neuroscience have been answered by analyzing the spikes recorded under certain behavioral condition [2].Additionally, neural spike information also plays an important role in brain disorder detection and brain-computer interfacing (BCI) systems [3,4].
Nowadays extracellular neural recordings have become a common way to acquire the electrical activity of neurons [5].During the processing of the recorded signals, the detection of spikes is the first and crucial step, which promises to be able to extract necessary spike data from the recorded signal for subsequent analyses.In the past three decades, researchers have made great efforts and developed many spike detection methods.Considering the fact that the accuracy of spike detection will directly impact all subsequent analyses, most of the existing methods mainly focus on how to accurately detect spikes from the large amounts of background noise.Although these methods perform with high accuracy, they are often complex and require a lot of calculations.As a result, these detection methods are only suitable for offline implementation.
Although it is reasonable to use the sophisticated methods to analyze the data after acquisition, there is an increasingly demand to develop real-time spike detection methods in practical applications, such as brain disorder detection and BCI systems.Among the existing methods, amplitude thresholding (AT) [6,7] and nonlinear energy operator (NEO) [8,9] are still the simplest and most widely used techniques.AT only takes into account the amplitude of the signal, and a spike is said to be detected only when the signal amplitude exceeds a preset threshold.NEO is developed based on the energy of the signal and considers that the energy of the spike is greater than that of noise.Hence, the spikes can be detected by thresholding the instantaneous energy of the recorded signal.NEO often performs better than AT.Although AT and NEO are computationally simple and easy to implement in hardware, it has been proven that these two popular methods are sensitive to the noise.In other words, the accuracy of AT and NEO still does not fulfill the practical demands.It is desirable to develop a spike detection method which is with low complexity and high accuracy for creating a practical device.
In this paper, we propose a new simple spike detection method by directly analyzing the time-domain features of spikes.Among various analysis tools, we select the differential operator to accentuate the spikes in the recorded signal for its simplicity and the ability to detect significant changes.Unfortunately, we find that the peaks caused by the noise may also be amplified by the traditional differential operator.To prevent this, we introduce the resolution parameter into differential operator, which can significantly improve the difference between spikes and noise.In addition, the convolution operation is also utilized to further reduce the effect of noise.Experiments on both synthesized and real data show that our method is able to accurately detect spikes while maintaining low computational complexity.

Spike enhancement
Researches have discovered that the activity of a neuron appears as a rapid sharp rise (or spike) in the extracellular recording signals [10].Although large amounts of background noise exist in the recorded signal, the spikes from target neurons usually have greater amplitude fluctuation than the noise (see Fig. 1).Inspired by this fact, we try to discriminate spikes by analyzing the amplitude changes of the recorded signal.As an effective analysis tool, differential operator (DO) plays an important part in the fields of signal and image processing.With great success to detect significant changes, this technique has been widely used to enhance the contrast of target [11].Besides this, another attractive advantage of DO is that it is very simple in computation.Therefore, we apply DO in this paper to analyze the difference between spikes and noise.Suppose that (n)  x is the recorded signal to be processed, the differentiation of (n)  x can be formulated as As we know, when a spike occurs at the nth location, there is an instantaneous increment of signal amplitude at the corresponding location.Accordingly, a high peak is expected to occur in (n) D .Unfortunately, our observations discover that the traditional DO does not work well with the presence of high-level noise, and it can also amplify the spurious peaks caused by the noise.To present a clear description, an example is given to illustrate the drawback of DO.As shown in Fig. 2, some peaks caused by the noise are obviously enhanced than before.Moreover, the target spike B cannot be identified from noise.Inspired by the fact that spikes have greater amplitude fluctuation than the noise within the same time interval (the length of spike waveform), we can make up for this drawback by introducing the resolution parameter k into (1), that is For convenience, we call this operator k-DO.Next, we will explain how to determine the value of resolution parameter k.For the spike shown in Fig. 3, we can find the optimal k that maximizes the output of k-DO is near the peak of spike, which turns out to be the interval between the trough and peak (ITP).As the spikes from different neurons generally have different ITP, we can only roughly estimate the value of k according to the acquired spike data.That is, we first arbitrarily extract a slice of data from the recorded signal in advance, and select the smallest ITP of the spikes in the slice as the final k.Incorporated with the resolution parameter, the performance of DO is obviously improved than before.This fact can be verified from Fig. 4. It can be seen that when a spike occurs, k-DO will generate a high numerical value at the peak or trough of the target spike.Moreover, the outputs of spikes are obviously larger than that of noise.

Noise suppression
Due to the differences in the shape of spikes, the high numerical value caused by a spike may occur at the peak or trough of the spike.If the high numerical value occurs at the peak of a spike, it is positive (see point A in Fig. 4).Conversely, the high numerical value is negative when it occurs at the trough of a spike (see point B in Fig. 4).This fact is not conducive to the final determination.To prevent this, we take the absolute value of k (n) D as the final output, and call it k-ADO.
In order to further reduce the interference of background noise, the convolution operation is also introduced to filter the final output.That is, where W is the Hamming window, L is the length of window.Convolution operation is one of the most classical techniques in the field of signal processing, and is often used for signal smoothing and denoising.With the help of convolution operation, the spurious peaks caused by noise can be effectively restrained.
To investigate the effect of convolution operation, we apply it to an output signal and show the result in Fig. 5. From Fig. 5, we can see that although k-ADO can separate spikes from background noise, the noisy peaks still have a negative influence on the identification of spikes.Compared to the result of k-ADO, convolution operation can further restrain background noise, which makes the final determination more accurate.Therefore, it can be concluded that noise suppression plays an important role in the final determination.

Amplitude thresholding
An amplitude threshold should be set for determining whether the spike occurs in the recorded signal.Once the amplitude of output signal exceeds the threshold, a spike event is detected.In our method, the amplitude threshold is defined as where b is a constant generally taken 3~5.

Experimental results
In this section, we conduct experiments to verify the performance of the proposed spike detection method, and compare it with two well-known existing methods: AT [12], NEO [8] on both synthesized and real data.To be fair, the resolution parameter k is also introduced into the technique NEO (named k-NEO).In this work, we take accuracy and computational complexity as the criteria to evaluate the performance of each spike detection method.Usually, the computational complexity of each method is estimated by its running time (RT).To evaluate the accuracy of the method, both hit rate (HR) and precision (Pre) are introduced and defined as follows, where CDS is the number of correctly detected spike events, TS is the total number of true spike events recorded in the signal and DS is the number of spike events detected by the method.

Analysis from synthesized data
The synthesized data is constructed according to the method developed by [13], which models the recorded signal as a linear mixture of target spike trains and background noise.The dataset consists of several simulations with different noise levels.The number of spike events in each simulation varies between 3200 and 3500.The simulated data can be downloaded from http://www2.le.ac.uk/departments/engineering/research/ bioengineering/neuroengineering-lab/spike-sorting.
The performance comparisons on synthesized data are listed in Tables 1 and 2. From Table 1, it can be seen that the proposed method performs better compared with the other two methods, especially with the presence of high-level background noise.When the noise level increases to 0.40, the proposed method still maintains over 80% hit rate and 94% precision.

Application on Real Data
In this section, we test the proposed method on real recorded signals.The real signals are recorded from prefrontal cortex of mice when performing a working memory task [14].Different from the synthesized signals, the ground truth information (such as the locations of spikes) of real signals is unknown to us.In order to evaluate the performance of our method on real data, numerous spikes in each recorded signal are labeled as ground truth by two experienced EEGers.We apply three different methods to a slice of real recorded signal and show the outputs in Fig. 6.The original signal is shown in Fig. 6(a) and 7 spikes contained in it are labeled with sign "*".The outputs of AT, k-NEO and proposed method on the same signal are presented in Fig. 6(b)-(d), respectively.Note that the spikes detected by the method are denoted by the sign "o".It can be seen that the background noise is obviously suppressed meanwhile the spikes are highlighted with the proposed method.In addition, we further compare our method with other two ones on real extracellular recording signals and present the results in Tables 3 and 4. It can be seen that the proposed method performs with higher hit rate and precision compared with the other two methods.Moreover, the proposed method maintains the low computational complexity.

Conclusion
In this paper, a novel method based on improved differential operator is introduced which creates a high efficiency algorithm for real time spike detection.The proposed method mainly consists of two stages.In the first stage, with the help of resolution parameter, the differential operator is successfully used to enhance spike events in the recorded signal.In the second stage, the convolution operator is employed to further reduce the influence of background noise, which makes spike detection more accurate.Experimental results demonstrate that the proposed method achieves a better performance of spike detection while maintaining low computational complexity.

Fig. 2 .
Fig. 2. Application of differential operator to the signal shown in Fig. 1.Spikes A and B are labeled with sign "*".

Fig. 4 .
Fig. 4. Effect of resolution parameter on the performance of differential operator.

Fig. 5 .
Fig. 5. Effect of convolution operation on noise suppression.(a) Absolute value of the signal shown in Fig. 4. (b) Result of convolution operation.

Fig. 6 .
Fig. 6. Results for real extracellular recording signals.(a) Original real signal.(b)-(d) show the results of AT, k-NEO, and the proposed method, respectively.

Table 1 .
Detection performance of methods applied to synthesized dataset.

Table 2 .
Running times of methods applied to synthesized dataset.

Table 2
shows the running time required per simulation (in seconds).Seen from Table2, in each simulation, all methods run fast and the times spent by them are less than 0.05 s.It also should be noted that the proposed method spends comparable time compared with k-NEO.These findings indicate that the proposed method is simple as AT and k-NEO, and is suitable for online applications.

Table 3 .
Detection performance of methods applied to real signals.

Table 4 .
Running times of methods applied to real signals.