bioRxivNeurosciencePreprint
Fast, scalable, and statistically robust cell extraction from large-scale neural calcium imaging datasets
Fatih DinçiD, Hakan InaniD, Oscar HernandeziD, Claudia SchmuckermairiD, Omer HazoniD, Tugce Tasci, Biafra AhanonuiD, Yanping ZhangiD, Jérôme A. LecoqiD, Simon HazizaiD, Mark J. WagneriD, Murat A. ErdogduiD, Mark J. SchnitzeriD
Abstract
State-of-the-art Ca2+ imaging studies that monitor large-scale neural dynamics can produce video datasets that tally up to [~]100 TB in size ([~]10 days transfer over 1 Gbit/s ethernet). Processing such data volumes requires automated, general-purpose and fast computational methods for cell identification that are robust to a wide variety of noise sources. We present EXTRACT, an algorithm that is based on robust estimation theory and uses graphical processing units (GPUs) to extract neural dynamics from a typical Ca2+ video in computing times up to [~]10-times faster than imaging durations. We extensively validated EXTRACT on simulated and experimental data and processed 199 public datasets ([~]12 TB) from the Allen Institute in a day. Showcasing its superiority over past cell extraction methods at removing noise contaminants, neural activity traces from EXTRACT allow more accurate decoding of animal behavior. Overall, EXTRACT is a powerful computational tool matched to the present challenges of neural Ca2+ imaging studies in behaving animals.
- organism: mouse
- assay: imaging
- research focus: software / tool
- research focus: benchmarking
- research focus: cell type annotation
- approach: statistical model
- approach: matrix factorization
- approach: simulation
In-depth summary
Claude Opus 5.5 · xhigh effort · 8 Nov 2026 · from the full text of version 3 (17 Aug 2024) · CC BY 4.0
EXTRACT, a GPU-based cell extraction method using one-sided Huber robust regression, processed 199 Allen Brain Observatory sessions (~12 TB) in a day and gave cleaner traces than CAIMAN or CNMF-E.
Calcium imaging now yields TB-scale videos contaminated by neuropil, out-of-focus and overlapping cells, yet earlier cell extraction methods typically assume Gaussian noise, lean on modality-specific pre- or post-processing, and were not validated at that scale. EXTRACT instead fits a one-sided Huber loss whose outlier threshold adapts in space and time, without modelling the contaminants, and runs on GPUs with a custom solver.
Key results
ShownRun on GPUs, EXTRACT processed typical recordings in about a tenth of their duration. It handled movies far larger than CAIMAN could load, and runtime grew linearly with the number of cells.
Allen movies (~64 min): runtime 0.11 ± 0.03 (s.d.) of acquisition time on one GPU, 199 sessions in 23.1 hrs, ~3.4 min + 8 min per thousand cells (0.64 s per cell per GPU per hour). Mesoscope video (800 GB, 200,000 frames): CAIMAN hit a memory error above 30,000 frames (120 GB, 256 GB RAM) while EXTRACT processed it all; on multiple GPUs EXTRACT was nearly an order of magnitude faster than CAIMAN. · A native implementation on (multiple) GPUs…; Fast, comprehensive cell extraction from the…; An efficient implementation for fast cell…; Figure legends
ShownHyperparameters were tuned on one session and then applied to all 199 Allen Brain Observatory two-photon sessions. EXTRACT recovered nearly every cell found by the Allen software development kit (SDK), detected several times more, and gave higher trace quality than the SDK or an L2-loss variant.
In a typical movie, EXTRACT recovered >97% of SDK cells and found 3-4 times more cells (and some dendrites); precision was 96% by visual curation. Its mean trace quality metric was statistically higher than the Allen SDK, the L2 solver and non-negative least squares on EXTRACT filters (two-sided Wilcoxon signed-rank tests across 199 movies). · Fast, comprehensive cell extraction from the…; Figure legends
SuggestedOn simulated one- and two-photon movies with ground truth, EXTRACT beat CAIMAN on cell finding and trace accuracy in every scenario, most clearly at high cell density. An L2-loss version of the same pipeline did worse, which points to the robust loss as the source of the gain.
Grid search of >1000 hyperparameter sets per method on a simulated 600-cell two-photon movie: EXTRACT reached 100% true-positive detection at 97% precision vs 70% precision for CAIMAN, and was nearly insensitive to settings. The same pipeline with κ = 100 (an L2 loss) found cells less accurately at all 3 simulated densities. ~4 TB of simulations, 33 experiments. · Performance evaluations using large-scale…; Figure legends; Tables
SuggestedIn one-photon recordings from ventral CA1 during an elevated plus maze, EXTRACT traces identified more cells coding open vs closed arms than CNMF-E did, and they supported more accurate decoding of the mouse's location.
More arm-coding cells, also among cells found by both methods (Wilcoxon p < 0.05); trace quality metric higher (p < 10^-5, n = 665 matched cells; p = 0.03, n = 6); support vector machine decoding of 5 maze bins more accurate with EXTRACT for every mouse (p < 0.05; 6 imaging sessions from 3 mice, 100 train/test splits). · EXTRACT improves identification of…; Figure legends
SuggestedIn one-photon recordings of striatal direct/indirect-pathway spiny projection neurons (dSPNs, iSPNs), PCA/ICA traces missed visible transients and PCA/ICA and CNMF-E showed neighbour crosstalk. EXTRACT traces scored higher on trace quality, and their clustered activity tracked locomotor speed more closely.
Trace quality metric higher for EXTRACT on nearly all cells matched across EXTRACT, PCA/ICA, CNMF-E (MATLAB) and CAIMAN. The Spearman correlation between the spatial coordination metric and locomotor speed was significantly higher with EXTRACT traces (two-sided Wilcoxon signed-rank; 9 mice for dSPNs, 11 for iSPNs). · Spatiotemporally clustered Ca2+ activity in…; Figure legends
Methods, data and reproducibility
Movies are modelled as spatial profiles times traces plus Gaussian noise with a non-negative contaminant fraction, fit by alternating one-sided Huber regressions. κ is fixed by default in cell finding, refinement and spatial-profile fits, and adaptive per cell and frame in the final trace regression. The MATLAB pipeline uses a custom GPU solver based on the alternating direction method of multipliers.
- Simulated one- and two-photon calcium imaging videos varying cell density, neuropil contamination, correlated spiking, SNR and motion · n = 33 computational experiments, ~4 TB
- Allen Brain Observatory in vivo two-photon calcium imaging sessions (GCaMP6, visual cortical areas) · mouse · n = 199 sessions (~12 TB)
- Two-photon mesoscope video of neocortical pyramidal neurons expressing jGCaMP8s (2 mm x 2 mm field of view, 30 Hz) · mouse · n = 1 video, 200,000 frames, ~800 GB
- Head-mounted one-photon microscope recordings of dSPNs and iSPNs (GCaMP6m) in dorsomedial striatum of freely behaving mice, previously acquired · mouse · n = 9 mice (dSPNs), 11 mice (iSPNs)
- Previously published dual-color multi-plane two-photon recordings of dSPNs and iSPNs in head-fixed mice on a wheel · mouse
- One-photon microendoscope recordings of ventral CA1 pyramidal neurons (CaMKII-GCaMP6s) on an elevated plus maze · mouse · n = 6 imaging sessions from 3 mice; 665 matched cells
- Two-photon mesoscope recordings of Purkinje cell dendritic trees (PCP2-Cre x Ai148, GCaMP6f) · mouse · n = 2 mice (507 and 646 Purkinje cells)
- Two-photon recordings of layer 1 apical dendrites of layer 2/3 and layer 5 pyramidal neurons · mouse · n = 2 mice (860 and 905 dendritic segments)
- Methods & tools
- EXTRACT, CAIMAN, CNMF-E (MATLAB), CNMF, PCA/ICA (principal then independent component analysis), SEUDO, Allen SDK, MATLAB, MATLAB lsqlin, Intel Math Kernel Library, support vector machine classifiers
- Reagents & environment
- MATLAB (R2017b for Figs. 6 and 7, R2019a otherwise); no packages needed beyond MATLAB; the same code runs on CPUs or MATLAB-compatible GPUs; matrix algebra via Intel Math Kernel Library.
- Assay conditions & compute
- Two NVIDIA RTX 3090 GPUs + 18-core Intel i9-10980XE (Fig. 4A-D); Stanford Sherlock cluster with 4-8 V100S GPUs; two RTX 3080 Ti (Fig. 4F,G and Fig. 5); single GTX 1080 (Figs. 6, 7); 199 Allen movies took 23.1 hrs; CAIMAN memory limit seen on a 256 GB RAM desktop.
- Reproducibility gaps
- Code is said to be in an open GitHub repository, but no URL is printed in the text. Experimental data are available from the corresponding authors on request. Simulation parameters and per-experiment details are deferred to Supplementary Note 4 and Table S1.
Limitations (6)
- At very low optical signal-to-noise ratio (SNR), the estimator behaves much like least squares and gives little improvement in trace estimation over L2 methods. · stated by the authors
- Worst-case optimality is proven only for univariate estimation. The regularity conditions needed to extend it to the multivariate regressions EXTRACT uses may not hold for neural recordings, so that case rests on computational experiments. · stated by the authors
- Residual brain motion is tolerated only up to rigid jumps of ~6.5 µm (about half a cell width). Larger jumps lowered crosstalk mitigation and caused true signals to be rejected as outliers, so the authors recommend image registration first. · stated by the authors
- With near-perfectly synchronized firing, cells are separated only if the recording is long enough for each cell to fire alone at least once. Cell-finding recall and amplitude accuracy dropped as synchrony rose, though less so in longer movies. · stated by the authors
- The simulations, ground-truth metrics and real-data trace quality metric were all designed by the authors. The deep-learning cell extraction methods the text criticises were not benchmarked. · noted in this summary
- The order-of-magnitude speed advantage on Allen-scale movies is inferred from CAIMAN runtimes reported in another paper, not from a head-to-head run. The ventral CA1 results rest on 6 sessions from 3 mice, though the main text says n=6 mice. · noted in this summary
Read this if you extract cells and traces from large one- or two-photon calcium imaging datasets and want a fast GPU-based MATLAB alternative to CAIMAN/CNMF-E that handles neuropil and overlapping-cell contamination better.
- Citations
- 51
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
- Automatic sorting system for large calcium imaging data
Takashi Takekawa, Hirotaka Asai, … Tomoki Fukai·bioRxiv·Nov 9, 2017
- HOTARU: Automatic sorting system for large scale calcium imaging data
Takashi Takekawa, Masanori Nomoto, … Tomoki Fukai·bioRxiv·Apr 5, 2022
- OnACID: Online Analysis of Calcium Imaging Data in Real Time
Andrea Giovannucci, Johannes Friedrich, … Eftychios A. Pnevmatikakis·bioRxiv·Oct 2, 2017
- Extracting large-scale neural activity with Suite2p
Carsen Stringer, Chris S Ki, … Marius Pachitariu·bioRxiv·Feb 6, 2026
- Rapid deep widefield neuron finder driven by virtual calcium imaging data
- 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