eLifeNeurosciencePeer-reviewed journal article
CaImAn: An open source tool for scalable Calcium Imaging data Analysis
Andrea GiovannucciiD, Johannes H. FriedrichiD, Pat GunniD, Jérémie KalfoniD, Brandon BrowniD, Sue Ann KoayiD, Jiannis TaxidisiD, Farzaneh NajafiiD, Jeffrey L. GauthieriD, Pengcheng ZhouiD, Baljit S. KhakhiD, David W. TankiD, Dmitri B. ChklovskiiiD, Eftychios A. PnevmatikakisiD
Abstract
Advances in fluorescence microscopy enable monitoring larger brain areas in-vivo with finer time resolution. The resulting data rates require reproducible analysis pipelines that are reliable, fully automated, and scalable to datasets generated over the course of months. Here we present CaImAn, an open-source library for calcium imaging data analysis. CaImAn provides automatic and scalable methods to address problems common to pre-processing, including motion correction, neural activity identification, and registration across different sessions of data collection. It does this while requiring minimal user intervention, with good performance on computers ranging from laptops to high-performance computing clusters. CaImAn is suitable for two-photon and one-photon imaging, and also enables real-time analysis on streaming data. To benchmark the performance of CaImAn we collected a corpus of ground truth annotations from multiple labelers on nine mouse two-photon datasets. We demonstrate that CaImAn achieves near-human performance in detecting locations of active neurons.
- organism: mouse
- organism: zebrafish
- assay: imaging
- research focus: software / tool
- research focus: benchmarking
- research focus: database / resource
- research focus: cell type annotation
- approach: matrix factorization
- approach: deep learning
- approach: benchmark study
- approach: statistical model
In-depth summary
Claude Opus 5.5 · xhigh effort · 8 Nov 2026 · from the full text of version 1 (5 Jun 2018) · CC BY 4.0
CaImAn, an open-source library, automates motion correction, source extraction, deconvolution and cross-session registration for calcium imaging, detecting neurons near human level (F1 0.75 batch, 0.76 online).
Two-photon microscopes now produce over 50GB/Hour (more than 1TB/Hour with custom systems), so matrix factorization over full datasets quickly becomes intractable and manual ROI selection is laborious and poorly reproducible. CaImAn extends CNMF with memory-mapped MapReduce patch processing, automated quality tests and CNN classifiers, an improved online OnACID mode, and a multi-labeler consensus annotation corpus for benchmarking.
Key results
ShownBoth CaImAn modes detect neurons at close to human level but usually fall below individual annotators. The annotators themselves disagree substantially when each is scored against a multi-labeler consensus.
Labeler F1 vs consensus 0.69-0.94 (mean 0.83±0.07); CaImAn batch 0.68-0.79 (mean 0.75±0.04) and CaImAn online 0.68-0.82 (mean 0.76±0.04) on 9 mouse two-photon datasets, using one shared parameter set apart from per-dataset neuron and patch sizes and a few thresholds; batch tends to do better on shorter recordings and online on longer ones. · Manual annotations show a high degree of…; CaImAn batch and CaImAn online detect neurons…
ShownDetection errors concentrate in low-SNR neurons. CaImAn batch favors precision over recall, while the online mode is balanced between the two.
Batch mean precision 0.83±0.09 vs recall 0.69±0.08; online precision 0.77±0.05, recall 0.76±0.07. Batch F1 rises on average from 0.73 with all neurons to 0.92 when only traces with SNR ≥ 9 are scored; upper and lower bounds were tight for all but one dataset, and most false positives and negatives sit at low SNR. · Neurons with higher SNR transients are detected…; Performance quantification as a function of SNR; Footnotes; Figure legends
ShownExtracted fluorescence traces closely match traces derived from the consensus masks, and batch processing reproduces them more faithfully than streaming does.
Mean correlation coefficient with ground-truth traces above 0.9 for both modes on all 9 datasets; batch exceeded online on all but one dataset; pooled histogram peaked in the 0.99-1 bin. Online mode misses activity before a neuron is detected, which is set to zero. · CaImAn reproduces the ground truth traces with…
ShownProcessing time scales roughly linearly with data size on hardware from laptops to clusters, and the streaming mode handled a 30-minute whole-brain zebrafish recording in 21 minutes, which the authors describe as real-time processing.
Batch timings exclude motion correction. An hour-long two-photon dataset ran within 3 hours on a laptop (8 CPUs, 16GB RAM) despite exceeding RAM; a 112-CPU HPC beat acquisition time (~105GB/hour assumed). Zebrafish: 380GB, 45 planes processed in parallel on 9 nodes, 66108 neurons in 21 minutes (3 for batch initialization, 18 streaming). · Online analysis of a whole brain zebrafish…; Computational performance of CaImAn
SuggestedCaImAn's CNMF-E port reproduces a reference one-photon implementation, and RegisterMulti tracks neurons consistently across six imaging days.
Mouse dorsal striatum 1p (6000 frames): F1 0.89 against the Zhou et al. (2018) MATLAB code, 573 neurons found by both, 106 found only by Zhou et al. and 31 only by CaImAn, median trace correlation 0.86. Six-day mouse cortex: 686 distinct components, 162 in all 6 sessions; the backward pass also yielded 686. · Analyzing 1p microendoscopic data using CaImAn; CaImAn successfully tracks neurons across…
Methods, data and reproducibility
Python pipeline chaining NoRMCorre motion correction, CNMF/CNMF-E source extraction on memory-mapped overlapping patches (MapReduce), OASIS deconvolution, SNR/footprint tests plus 4-layer CNN screening, an OnACID-derived streaming mode, and Jaccard/Hungarian cross-session registration; scored by precision/recall against consensus manual labels.
- Nine in vivo two-photon datasets from hippocampus, visual and parietal cortex (several GCaMP variants, multiple labs) with consensus manual annotations of active neurons · mouse · n = 9 datasets, each labeled by 3 or 4 annotators
- Whole-brain larval zebrafish light-sheet recording, Tg(elavl3:H2B-GCaMP6f)jf7, 380GB, imaged at 1Hz for 30 minutes (Kawashima et al. 2016) · zebrafish (Danio rerio) · n = 45 planes, 1885 frames
- One-photon microendoscopic recording of GCaMP6f neurons in dorsal striatum of a freely moving mouse in an open field (Zhou et al. 2018) · mouse · n = 6000 frames at 30 frames per second
- In vivo cortex imaging across six daily sessions used to test multi-day component registration · mouse · n = 6 sessions; 453, 393, 375, 378, 376, 373 components
- Methods & tools
- CaImAn (Python; MATLAB port CaImAn-MATLAB), CNMF (constrained non-negative matrix factorization), CNMF-E (one-photon background model), OnACID online source extraction, NoRMCorre non-rigid motion correction, OASIS sparse non-negative deconvolution, 4-layer CNN component classifiers (Keras used for data augmentation), RegisterPair / RegisterMulti with Hungarian algorithm, ImageJ Cell Magic Wand (manual annotation), OpenCV, scikit-learn, scikit-image, SLURM (HPC scheduling), CellReg (discussed alternative for multi-day registration)
- Software & environment
- Python 2 and Python 3 compatible (future development Python 3 only); builds on OpenCV, scikit-learn and scikit-image; Keras used for CNN training data augmentation; compatible with SLURM; most routines also available in MATLAB.
- Assay conditions & compute
- Batch benchmarks on a MacBook Pro laptop (8 CPUs, 16GB RAM), a CentOS workstation (24 CPUs, 128GB RAM) and a CentOS HPC cluster (112 CPUs, 4 nodes of 28); zebrafish run on 9 nodes (24 CPUs, 128-256 GB RAM each) in 21 minutes.
- Reproducibility gaps
- The text says the consensus manual annotations will be released but gives no download link or accession; no repository is stated for the benchmark movies, the zebrafish recording or the one-photon data.
Limitations (6)
- CaImAn's detection is below the human annotators on most datasets. The authors attribute this to using one parameter set for all data and to CNMF picking up non-somatic transients, which the CNN classifier removes only partly. · stated by the authors
- The consensus set is drawn only from components that at least one labeler had already selected, so individual labeler scores may be biased upward relative to CaImAn's. · stated by the authors
- One-photon CNMF-E processing scales less well. Its background term is as large as the dataset and is held in memory twice, so it runs slower and needs more RAM than two-photon processing; splitting into patches trades speed for memory. · stated by the authors
- Online mode sets a neuron's activity to zero before it is detected, which lowers trace fidelity. It also depends on a good batch initialization and was only simulated, not connected to closed-loop optical hardware. Zebrafish results had no ground truth and were checked visually. · stated by the authors
- The batch CNN was trained on 3 of the 9 benchmark datasets and the online CNN on the first five; component-selection parameters were tuned on the first three. The reported F1 averages pool these with held-out datasets, though Table 1 marks the training sets in italics. · noted in this summary
- The trace ground truth is itself CNMF output seeded with the consensus masks. Correlations above 0.9 therefore measure agreement within one model family, not accuracy against independent spiking or electrophysiological recordings. · noted in this summary
Read this if you process two-photon, one-photon or light-sheet calcium imaging at scale and want an automated CNMF-based pipeline with benchmarked near-human neuron detection and cross-day tracking.
- Citations
- 965
- FWCI
- 40.64
- Field percentile
- top 1%
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- OnACID: Online Analysis of Calcium Imaging Data in Real Time
Andrea Giovannucci, Johannes Friedrich, … Eftychios A. Pnevmatikakis·bioRxiv·Oct 2, 2017
- Online analysis of microendoscopic 1-photon calcium imaging data streams
Johannes H. Friedrich, Andrea Giovannucci, Eftychios A. Pnevmatikakis·PLoS Computational BiologyPeer-reviewed·Jan 28, 2021
- DeepCINAC: a deep-learning-based Python toolbox for inferring calcium imaging neuronal activity based on movie visualization
Julien Denis, Robin F. Dard, … Michel A. Picardo·eNeuroPeer-reviewed·Jul 1, 2020
- EZcalcium: Open Source Toolbox for Analysis of Calcium Imaging Data
Daniel A. Cantu, Bo Wang, … Carlos Portera‐Cailliau·Frontiers in Neural CircuitsPeer-reviewed·May 15, 2020
- NeuronID: An automatic toolkit for identifying neurons in two-photon calcium imaging data
Jikan Peng, Tian Xu·PLoS ONEPeer-reviewed·Mar 9, 2026
- Minian: An open-source miniscope analysis pipeline
Zhe Dong, William Mau, … Denise J. Cai·eLifePeer-reviewed·Jun 1, 2022