Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2019 Aug 19;9(1):12087.
doi: 10.1038/s41598-019-48456-y.

A normalized template matching method for improving spike detection in extracellular voltage recordings

Affiliations

A normalized template matching method for improving spike detection in extracellular voltage recordings

Keven J Laboy-Juárez et al. Sci Rep. .

Erratum in

Abstract

Spike sorting is the process of detecting and clustering action potential waveforms of putative single neurons from extracellular voltage recordings. Typically, spike detection uses a fixed voltage threshold and shadow period, but this approach often misses spikes during high firing rate epochs or noisy conditions. We developed a simple, data-driven spike detection method using a scaled form of template matching, based on the sliding cosine similarity between the extracellular voltage signal and mean spike waveforms of candidate single units. Performance was tested in whisker somatosensory cortex (S1) of anesthetized mice in vivo. The method consistently detected whisker-evoked spikes that were missed by the standard fixed threshold. Detection was improved most for spikes evoked by strong stimuli (40-70% increase), improved less for weaker stimuli, and unchanged for spontaneous spiking. This represents improved detection during spatiotemporally dense spiking, and yielded sharper sensory tuning estimates. We also benchmarked performance using computationally generated voltage data. Template matching detected ~85-90% of spikes compared to ~70% for the standard fixed threshold method, and was more tolerant to high firing rates and simulated recording noise. Thus, a simple template matching approach substantially improves detection of single-unit spiking for cortical physiology.

PubMed Disclaimer

Conflict of interest statement

The authors declare no competing interests.

Figures

Figure 1
Figure 1
Normalized template matching algorithm for spike detection (a) Step-by-step description of normalized-template-matching (NTM). The standard method is an initial round of spike sorting with the usual fixed voltage threshold detection method. NTM is the second round of spike sorting where NTM is used for spike detection. (b) Graphical schematic of the standard method. Top, segment of extracellular voltage signal. Green line is the fixed threshold (usually 3 standard deviations below the mean) and dots denote threshold crossing events. Bottom, mean spike waveform of 2 example isolatable single-units. ISI distributions (in 0.5 ms bins) and spike amplitude and firing rate as a function of time are also shown. (c) Graphical schematic of NTM. Top, calculation of detection threshold for each template based on the spikes detected in the standard method. Si,t is the cosine similarity between the template and a spike. Target cluster are spikes that were assigned to the single-unit of interest. Bottom shows the calculation of the scaled cross-correlation Si(t) for each template. Dots denote events that were classified as spikes.
Figure 2
Figure 2
NTM detects more spikes than the standard fixed-voltage threshold method. (a) Example in which some spikes from a single unit were missed by the voltage threshold trigger but detected by NTM. Top left, distribution of spike waveforms belonging to the example single-unit. Bottom, segment of voltage signal from the 4 electrodes where the example single-unit was detected. Gray and blue regions indicate spike events from the example single unit that were detected only with NTM and with both spike detection methods respectively. Top right show individual spike waveforms. Triangle is a voltage threshold crossing event that suppressed spike detection. (b) Raster plot for an example single-unit using the standard and NTM spike detection methods. Black dash line is the onset of a whisker deflection. (c) Peri-stimulus-time-histograms (PSTHs) for the same example unit as (b) for NTM and standard spike detection. Bin size was 10 ms. The standard PSTH was shifted in time for clarity. (d) Venn diagram showing the mean percentage of spikes only detected with NTM, standard voltage threshold or both. Percentage of spikes that were detected by both methods but assigned to different units (misclassified) after clustering is shown in magenta. (e) Total number of spikes detected for each single unit with NTM vs. standard voltage threshold. Misclassified spikes were not included. (f) Mean Mahalonobis distance for each single-unit with NTM and the standard voltage threshold.
Figure 3
Figure 3
Mean spike waveform shape is conserved after NTM. (a) Mean spike waveforms of two example single-units with NTM and standard spike detection. (b) Schematic of the calculation of spike amplitude (current sink), positive peak (current source) and spike width (time difference between current sink and source). (c) Comparison across units for three spike waveform features.
Figure 4
Figure 4
NTM improvements in spike detection are stimulus specific. (a) Top, comparison of measured columnar-whisker (CW)-stimulus evoked firing rates with NTM vs. the fixed voltage threshold method across all single-units. Bottom, same but for sham stimulation (i.e. spontaneous firing rates). (b) Average CW-stimulus peri-stimulus-time-histograms (PSTHs) across layer 2/3 and layer 4 single-units with NTM and the voltage threshold trigger. (c) Mean percent gain in measured CW- and surround-whisker (SW)-stimulus evoked firing rates with NTM relative to the standard voltage trigger. (d) CW and SW responses ranked by response strength for both NTM and the standard voltage threshold trigger. (bd) All error bars are standard errors of the mean.
Figure 5
Figure 5
Performance of NTM on simulated voltage trace data. (a) An example segment of the surrogate voltage trace data. Regions in same color denote spikes from the same model neuron. Triangles represent whisker deflection onset time. (b) Tuning curve, PSTH, and ISI distribution computed across all spikes (including both multi- and single-unit spikes) in measured and simulated voltage data. Inset: Mean and standard deviation of tuning, PSTH, and ISI distribution correlation coefficients between model and in vivo single-units (n = 60). (c) A plot showing the effects of different voltage amplitude thresholds (expressed as number of standard deviations) on NTM, TM, and Standard spike detection methods. (d) Same plots as (c) but NTM, TM, and Standard methods were performed on surrogate data with quintupled noise and quintupled FR. Gray line represents plots from (c) for comparison.

Similar articles

Cited by

References

    1. Buzsáki G. Large-scale recording of neuronal ensembles. Nature Neuroscience. 2004;7:446–451. doi: 10.1038/nn1233. - DOI - PubMed
    1. Csicsvari J, et al. Massively Parallel Recording of Unit and Local Field Potentials With Silicon-Based Electrodes. J. Neurophysiol. 2006;90:1314–1323. doi: 10.1152/jn.00116.2003. - DOI - PubMed
    1. Lewicki, M. S. A review of methods for spike sorting: The detection and classification of neural action potentials. Netw. Comput. Neural Syst. 9 (1998). - PubMed
    1. Rey HG, Pedreira C, Quian Quiroga R. Past, present and future of spike sorting techniques. Brain Research Bulletin. 2015;119:106–117. doi: 10.1016/j.brainresbull.2015.04.007. - DOI - PMC - PubMed
    1. Lefebvre B, Yger P, Marre O. Recent progress in multi-electrode spike sorting methods. Journal of Physiology Paris. 2016;110:327–335. doi: 10.1016/j.jphysparis.2017.02.005. - DOI - PMC - PubMed

Publication types