Three-dimensional spike localization and improved motion correction for Neuropixels recordings

Neuropixels ( NP ) probes are dense linear multi-electrode arrays that have rapidly become essential tools for studying the electrophysiology of large neural populations . Unfortunately , a number of challenges remain in analyzing the large datasets output by these probes . Here we introduce several new methods for extracting useful spiking information from NP probes . First , we use a simple point neuron model , together with a neural-network denoiser , to efficiently map single spikes detected on the probe into three-dimensional localizations . Previous methods localized individual spikes in two dimensions only ; we show that the new localization approach is significantly more robust and provides an improved feature set for clustering spikes according to neural identity ( “ spike sorting '' ) . Next , we denoise the resulting three-dimensional point-cloud representation of the data , and show that the resulting 3D images can be accurately registered over time , leading to improved tracking of time-varying neural activity over the probe , and in turn , crisper estimates of neural clusters over time . Open source code is available at https : //github . com/int-brain-lab/spikes_localization_registration.git . 1 Introduction . Neuropixels ( NP ) probes are dense linear multi-electrode arrays that enable the simultaneous observation of hundreds of neurons across multiple brain areas . Since their introduction in [ 13 ] ( see also [ 27 ] ) , they have rapidly become an essential neurotechnology , deployed in hundreds of labs around the world . A number of challenges remain in analyzing the large datasets output by these probes . The basic goal is “ spike sorting '' — i.e. , to detect action potentials ( “ spikes '' ) and assign these spikes to individual neurons . Despite significant effort in the field [ 4 , 12 , 21 , 27 ] , current spike sorters for NP data have trouble tracking temporally non-stationary data and accurately sorting small spikes [ 28 ] . One major advantage of NP probes is their spatial density : the high spatial resolution of electrodes on the probe implies that each extracellular spike will typically be detected at multiple sites , providing an opportunity to “ triangulate '' the location of each spike . If effective , this spike localization can be helpful for multiple downstream tasks : spike locations serve as useful low-dimensional summarizations of the high-dimensional spatiotemporal spiking signals , which can in turn be visualized and used as features for clustering and tracking as the probe undergoes small motion relative to the brain . Several spike sorting algorithms localize spikes using a simple center of mass ( CoM ) method . More precisely , for each waveform , they select a set of channels , and compute the weighted average of the selected channels ’ positions , where the weights are given by an estimate of the amplitude of the spike on each channel . This fast , cheap method gives informative location estimates for spikes in multi-electrode array ( MEA ) recordings where long dendritic or axonal signals are not prevalent [ 23 , 20 , 10 ] ( cf . the primate retina [ 17 ] , where long axonal signals make localization approaches less useful ) . However , by definition , the CoM approach localizes spikes inside the convex hull of the electrodes , which is especially problematic for Neuropixels recordings , due to the long and thin shape of the electrodes . Hurwitz et al . [ 11 ] propose an improved localization method that provides location 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . estimates that can lie outside of the probe , but the estimates are still ( like the CoM method ) restricted to the two-dimensional plane spanned by the electrode locations . In addition , several approaches have been developed for localizing templates ( averages over many spikes , post spike-sorting ) in three dimensions , using biophysical models of varying sophistication [ 26 , 25 , 8 , 5 ] . Finally , triangulation approaches based on point-source [ 6 , 15 ] or dipole models [ 19 ] have been proposed for smaller-scale tetrode recordings , in which spikes are only detected on four electrodes , limiting the resolution of the resulting localization in the case of small , noisy spiking units . In this paper , we build on this previous work , making four key contributions : 1 . We introduce a denoise-then-triangulate approach , based on a simple point neuron model , that localizes single spikes in three dimensions . 2 . This improved three-dimensional localization in turn enables better spatial clustering of distinct neural units characterized by unique action potential waveform shapes . 3 . Our localization further enables better motion estimation in recordings with drift . 4 . Our approach is robust to different probe geometries . We demonstrate its utility and performance in both Neuropixels 1.0 and 2.0 probes . 2 Methods . 2.1 Point neuron model . A neuron ’ s spike is the result of a quick change in its membrane potential due to the shift of its charged particles from one side of the membrane to the other . This movement of charge creates an electric field outside of the neuron [ 14 ] , and Neuropixels electrodes record the potential of this field , at multiple locations along the probe ( Fig . 1A ) . We use a simple point-source model for these voltage differences at distance r from the cell : V ' α√ b2 + r2 ' α r , where α represents the cell ’ s overall signal magnitude , and the parameter b is fixed independently of the cell . This point-source model has been previously applied in tetrode recordings [ 6 , 15 ] , and could be replaced with more detailed models ( dipole , ball-and-stick , etc ) if desired . 2.2 Spike denoising and collision suppression . The triangulation approach described below relies only on the amplitude of the spike on each electrode . In practice we measure this amplitude using the peak-to-peak ( PTP ) value ( maximum minus minimum voltage over a short temporal interval ) . In the presence of noise , the PTP is biased upwards ( since noise will increase the maximum and decrease the minimum signal ) , and this bias depends on the underlying signal strength ( the PTP of small spikes is more biased than large spikes ) . Furthermore , collisions from near-synchronous spike events are prevalent in dense multi-electrode data [ 17 ] , and even small collisions can lead to inaccurate location estimates if not accounted for properly . Therefore , it is critical to incorporate a denoising / collision-suppression step prior to triangulation . We use the neural net denoiser implemented in YASS [ 17 ] ( retrained on NP data ) , which takes advantage of the waveform ’ s spatiotemporal signature , to suppress both noise and collisions ( Note that simple image denoising methods such as [ 16 , 7 , 3 ] do not serve to suppress collisions , and are therefore less effective here. ) . Fig . 1B shows three examples of waveforms ( in blue ) and their denoised version ( in red ) . The neural net denoiser removes noise and collided spikes , allowing us to successfully estimate each spike ’ s PTP amplitude ; see the Appendix for further details . 2.3 Spike localization . Given the denoised PTP amplitudes obtained above , we can proceed with localizing the origin of each waveform with respect to the multiple electrodes on the NP probe . We will denote { x , y , z } the coordinates of the point neuron , and { xc , zc } the planar coordinates of each NP electrode , with yc set to zero by convention . Here we exploit the fact that each spike is detectable on multiple channels simultaneously : i.e. , we have multiple observations of the form ptpc ' α√b2+r2c = α√ ( x−xc ) 2+ ( z−zc ) 2+y2+b2 , and our goal is to infer x , y , z , and α . Thus , for each spike and selected set of channels C around the “ main '' channel for each spike ( i.e. , the channel with the largest PTP amplitude ) , we want to optimize : ∑ c∈C ( ptpc − α√ ( x− xc ) 2 + ( z − zc ) 2 + y2 ) 2 . See Appendix for full optimization details . ( One important note here : due to the planar NP electrode geometry , the sign of y is not recoverable , i.e. , we can ’ t infer whether a spike is in front of or behind the probe , even if we can infer the orthogonal distance from the probe plane . ) Fig . 1 ( C ) shows examples of inferred { x , z } locations of detected spikes in both NP1.0 and 2.0 probes ( which have different electrode layouts ) , colored by max PTP . Panel ( D ) shows an example of 3-d { x , y , z } localization for the NP2.0 data . 2.4 Point cloud to image denoising . The estimated localizations are a point cloud in continuous space ( Fig . 2A ) . To enable the use of image registration techniques , we convert the point cloud representation to an image representation by generating spatial histograms where pixel location and intensity capture the spatial coordinates of spikes and their mean amplitudes ( Fig . 2B ) , following [ 27 ] . Note that this image representation is sparse and resembles a speckled Poisson image [ 18 ] , due to the limited number of spikes that are captured in each spatial position . In order to compute more accurate motion estimates , it is crucial to appropriately denoise this image representation . We adopt a Poisson denoising technique [ 18 ] , with three steps . First , we apply the Anscombe root transformation [ 1 ] to the histogram . Second , we use a Gaussian denoiser ( e.g . Block-matching and 3D filtering [ 7 ] , or non-local means [ 3 ] ) on the transformed histogram image . Third , the denoised signal is obtained by applying an inverse transformation to the denoised transformed histogram . Fig . 2C demonstrates the output for one second of time-binned data : Poisson denoising yields a more continuous pixelwise representation of the spatial histograms , which satisfies the pixel-wise continuity assumptions of image registration algorithms [ 9 ] and enables a more robust estimate of displacement . 2.5 Motion inference and registration . Given a set of dense Poisson denoised localization images for each second of recording , we estimate relative motion between frames by treating the set of images as a time-series video and use image registration techniques . Several techniques have been recently introduced to infer motion in Neuropixels recordings . The method proposed in [ 27 ] follows a non-rigid template based approach , where an average image of localizations is used as an anchor to register individual localization images using a phase-correlation based displacement estimator [ 9 ] . In contrast , the method in [ 29 ] follows a decentralized non-rigid approach , treating each localization image as its own template performing decentralized pair-wise motion estimates . This method has been shown to be more robust than the template based approach and we utilize it here to infer displacement both within the NP plane ( z , x ) and orthogonal to this plane ( y ) for the localization images . For other methods that yield only planar localizations , we just estimate vertical ( z ) and horizontal displacement ( y ) . The motion estimates for un-denoised and Poisson denoised localization image sets are shown in Fig . 5D . Once we estimate motion estimates for each time frame , we then correct for motion by volumetrically ( or planarly ) translating each image by the negative of the local non-rigid displacement that is estimated for that frame at that location on the probe , bringing all frames into alignment . Example average images before and after alignment can be seen in Fig . 5H .

Summary: In “Three-dimensional spike localization and improved motion correction for Neuropixels recordings”, the authors describe a pipeline for denoising and localizing spikes from dense extracellular recordings of neurons. Specifically, recordings are denoised using a previously published neural network based technique, then 3D locations are inferred using a straightforward point-source model. Finally, spikes are localized using Poisson image denoising.