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
. 2022 Apr;19(4):470-478.
doi: 10.1038/s41592-022-01422-5. Epub 2022 Mar 28.

Detecting and correcting false transients in calcium imaging

Affiliations

Detecting and correcting false transients in calcium imaging

Jeffrey L Gauthier et al. Nat Methods. 2022 Apr.

Abstract

Population recordings of calcium activity are a major source of insight into neural function. Large datasets require automated processing, but this can introduce errors that are difficult to detect. Here we show that popular time course-estimation algorithms often contain substantial misattribution errors affecting 10-20% of transients. Misattribution, in which fluorescence is ascribed to the wrong cell, arises when overlapping cells and processes are imperfectly defined or not identified. To diagnose misattribution, we develop metrics and visualization tools for evaluating large datasets. To correct time courses, we introduce a robust estimator that explicitly accounts for contaminating signals. In one hippocampal dataset, removing contamination reduced the number of place cells by 15%, and 19% of place fields shifted by over 10 cm. Our methods are compatible with other cell-finding techniques, empowering users to diagnose and correct a potentially widespread problem that could alter scientific conclusions.

PubMed Disclaimer

Conflict of interest statement

Competing interests

The authors declare no competing interests.

Figures

Extended Data Fig. 1 |
Extended Data Fig. 1 |. Example classified transient profiles for a single source from mouse CA1 found using CNMF.
Each panel is titled with the Pearson correlation between the source profile and transient profile.
Extended Data Fig. 2 |
Extended Data Fig. 2 |. user interface for manual classification of transients.
For detailed description, see software documentation in the GIT repository https://github.com/adamshch/SEUDO.
Extended Data Fig. 3 |
Extended Data Fig. 3 |. Comparison of manual annotation for two graders on the same 1,834 transients.
Confusion matrices showing the number of transients graded in different ways by each reviewer (left) and the total percentage of transients in each bin (right).
Extended Data Fig. 4 |
Extended Data Fig. 4 |. Algorithm to classify transients as true or false using the spatial Ljung-Box quartile test instead of the correlation metric.
A: Schematic for how the transient profile residual autocorrelation is computed. B: Two example transients, shown to illustrate difference in residual for true and false transients. C: Classification of four example transients using the LBQ test. D: results of the LBQ test on transients classified by human expert. Left: results of the test applied to true and false transients for various values of α. right: results of the test applied to all four transient types.
Extended Data Fig. 5 |
Extended Data Fig. 5 |. Effect of SEUDO parameters.
A: Activity estimated by SEUDO and least squares for one true transient (top row) and one false transient (bottom row) using several types of estimation (column labels). Images and traces show estimated amplitude of the source profile (green) and sum of fitted Gaussian kernels (magenta). B: Sum of activity ascribed to the source profile (green) and Gaussian kernels (magenta) for the true transient (left) and the false transient (right). Each subplot shows results for one set of parameters. roman numerals indicate parameter regimes shown in A.
Extended Data Fig. 6 |
Extended Data Fig. 6 |. Performance of SEUDO as σ2 was varied over three orders of magnitude, for the same sources and quantified in the same way as in Fig. 5c.
Each subplot shows performance for the value of σ2 indicated in the title and the shown values of λ (green points). Also plotted for comparison are the collection of points taken from all subplots (gray points).
Extended Data Fig. 7 |
Extended Data Fig. 7 |. Removing false transients can impact global summaries of activity.
Here, time courses were sorted into 5 clusters using K-means (best clustering over 50 random seeds). A-B: SEUDO time courses were more highly consolidated (that is, fewer clusters contained more of the neurons) as compared to the time-traces with contamination. C: A confusion matrix depicts that a small number of cluster relabelings accounted for much of the changes in SEUDO time courses.
Fig. 1 |
Fig. 1 |. False transients occur and can interfere with scientific conclusions.
a, Left, mean fluorescence image from a subset of an in vivo two-photon imaging movie showing mouse CA1 pyramidal cells genetically expressing the calcium indicator GCaMP3. right, spatial profiles of the 52 sources identified by CNMF in this movie, each in a different color. b, Time courses (top) of eight transients assigned to one source (top inset image) and their respective transient profiles (bottom). Classification as true or false was performed manually by a human expert. c, Occurrence of true activity in a set of 1,325 simultaneously recorded sources. Top, the fraction of transients that were classified as true (only for sources with at least one classified transient). Bottom, equivalent data for spikes that were inferred from classified transients as returned by CNMF (only for sources with at least 1,000 spikes inferred from classified transients). d, Peak amplitudes of true and false transients for the same sources as in c. e, Median peak amplitude of true and false transients for each source, only shown for sources with at least five true and five false transients. The purple ‘X’ indicates the mean over sources. f, Top and middle, two source profiles and their respective time courses during a brief period of the movie. Bottom, transient profile for source 2 (left) and the same image shown with increased contrast and overlaid outlines of source profiles (right). The arrowhead indicates part of source 2 fluorescence that was not captured by its profile. g, Top, six transient profiles (right) assigned to the same source (left). Outlines show profiles from this source and an adjacent source. Bottom, spatially averaged activity of this source while the mouse traversed a virtual linear track. Arrowheads indicate the transients shown above.
Fig. 2 |
Fig. 2 |. Quantitative metrics for evaluating transients.
a, Schematic of how the transient profile and transient profile residual are computed. b, Three transients (rows) for one source; the source profile is at the far left. Shown for each transient are the human classification (true, false or mixed), the transient profile with Gaussian blurring to highlight structure (radius 1 pixel), the correlation (corr.) metric value, the transient residual (shown with two color maps) and the contamination (contam.)-severity metric. AU, arbitrary units. c, Performance of automatic classification using the correlation metric. d, Top, example of a transient with mixed activity (movie frames are shown as three-frame averages). Bottom, example of an artifact profile arising from the fusion of two cell bodies. Left images show source profile with and without contour, and right images show two representative transient profiles with contour overlaid. e, Distribution of correlation values (top) and contamination severity (bottom) for transient categories defined by human classification. f, Center, FaLCon plot for 1,325 sources identified in one movie of CA1 (same dataset as shown in Fig. 1a) at a correlation threshold of 0.5. For axis definitions, see text and the Methods. Each point is one source; color shows human classification. Left and right, for each of four example sources, images show the source profile (single panel) and all transient profiles (grouped panels). Inset dot colors reveal human classification of each transient (gray indicates transients that could not be confidently classified).
Fig. 3 |
Fig. 3 |. Geometric intuition for the proposed solution.
a, Visualization of a simulated source profile in a two-pixel movie. Left, dashed line shows points corresponding to possible scalings of this profile. right, brightness versus pixel number for one scaling of this profile. b, A true transient represented as a point (left) and a plot of brightness (right). c, Equivalent plots for a false transient. d, Left, contour lines of the least-squares (LSQ) cost function. Middle and right, best fit of the source profile (gold point and gold outline) using least squares. e, Left, contour lines of a hypothetical robust cost function. Middle and right, best fit of the source profile (green point and green outline) using the robust cost function.
Fig. 4 |
Fig. 4 |. Explicit model of unexplained fluorescence.
a, Schematic of two models for calcium imaging data. In a typical model, source time course weights (gold) are estimated using only known profile shapes. In our model, time course weights (green) are estimated using a procedure that accounts for unexplained fluorescence (magenta). b, Probability distribution of the SEUDO residual computed via numerical integration (unexplained fluorescence plus noise) in the case of a two-pixel movie. Left and center, individual components. Right, full residual. Max, maximum. c, Gaussian kernel spatial profiles (top) and amplitude distribution (bottom). d, Calculated cost for the objective function defined by SEUDO. Left and center, individual terms. Right, full cost; the boundary between the 2 term and the LASSO term (f and g in equation (2)) is the lower cost. e, The full cost in d displays LASSO-like behavior for large positive residuals and least-squares-type behavior for small and negative residuals.
Fig. 5 |
Fig. 5 |. SEuDo performance on a full population of sources.
a, Comparison of 36 transient time courses estimated by least squares (gold) or SEUDO (green, λ=30, σ2=0.002). Within each category (human-classified true or false), transients are sorted by duration. b, Summary of SEUDO performance for five λ values when applied to the transients shown in a. c, Performance of SEUDO (green), a simple framewise correlation metric (gray) and regularized least-squares time course estimation (brown). SEUDO was performed using the same parameter sets as in b. The correlation metric was applied using 101 correlation thresholds ranging from −1 to 1 (Methods). The regularized least-squares method was CNMF. d, Detailed analysis of one transient with overlapping true and false activity. Shown movie frames are downsampled tenfold to highlight when different cells become active. Cyan and magenta traces are the mean pixel value in the respective rectangular regions shown at the left. The SEUDO time course was computed using the same parameter set as in a.
Fig. 6 |
Fig. 6 |. SEuDo can correct errors affecting scientific results.
a, Top and middle, time courses for two simultaneously recorded cells with mutual contamination as estimated by least squares and SEUDO. Bottom, scatterplot comparing time courses of the same two cells over all 41,756 frames, shown separately for each estimation technique. b, Top, spatially averaged activity for the source depicted in Fig. 1g, shown separately when the time course was estimated by least squares or SEUDO. Bottom, the difference between least squares and SEUDO. c, Histogram, changes in place cell location after applying SEUDO. Inset, number of cells characterized as place cells (P<0.05, test for significant spatial modulation, Methods) using time traces obtained by least squares or SEUDO.

Similar articles

Cited by

References

    1. Denk W, Strickler JH & Webb WW Two-photon laser scanning fluorescence microscopy. Science 248, 73–76 (1990). - PubMed
    1. Dombeck DA, Khabbaz AN, Collman F, Adelman TL & Tank DW Imaging large-scale neural activity with cellular resolution in awake, mobile mice. Neuron 56, 43–57 (2007). - PMC - PubMed
    1. Pachitariu M. et al. Suite2p: beyond 10,000 neurons with standard two-photon microscopy. Preprint at bioRxiv 10.1101/061507 (2016). - DOI
    1. Dana H. et al. Thy1-GCaMP6 transgenic mice for neuronal population imaging in vivo. PLoS ONE 9, e108697 (2014). - PMC - PubMed
    1. Madisen L. et al. Transgenic mice for intersectional targeting of neural sensors and effectors with high specificity and performance. Neuron 85, 942–958 (2015). - PMC - PubMed

Publication types