Figures and data

Overview of the Miniscope Processing Suite (MPS): a no-code, end-to-end pipeline for calcium imaging analysis.
(A) Logo drawn by Ari Peden-Asarch. (B) Processing pipeline flowchart illustrating the modular architecture of MPS. (C) Interactive data explorer for visualization and quality control of extracted neural signals. Left panel displays spatial footprints of identified neurons color-coded by activity level, with pixel coordinate axes and heatmap scale showing fluorescence intensity. Right panel shows temporal activity traces for selected neurons over 5000 frames.

MPS algorithmic innovations and empirical performance across 28 recording sessions.
Sessions averaged 95,467 frames (86,713–102,874) at 10 Hz, corresponding to 2.4–2.9 hours of recording. Hardware: Intel® Xeon® w7-3455, 8 workers with 2 threads each, Dask memory capped at 200 GB.

Variables Produced by Each Step of the Miniscope Processing Suite (MPS).

Video preprocessing demonstrates effective background subtraction, motion correction, and quality control.
(A) Raw miniscope frame showing diffuse background fluorescence and vignetting that obscures individual cells. (B) Same frame after background subtraction and denoising, revealing individual neuronal somata with improved contrast. (C) Motion-corrected frame showing stable spatial alignment of cellular structures. (D) Concatenated view across multiple frames illustrating line-splitting artifacts (horizontal discontinuities) that are automatically detected and removed. (E) Per-frame motion estimates in X (blue) and Y (yellow) dimensions across the full recording, with erroneous frames highlighted in red bars indicating frames flagged for excessive motion or artifacts (n=518 frames, 0.59% of total of this session). (F) Distribution of cell-to-surround contrast showing improvement after preprocessing (median increase of 0.033×), with individual data points shown as rug plot. (G) Distribution of residual shift after motion correction (median = 3.081 pixels, IQR 2.074–4.001 pixels). (H) Long-term drift quantified as displacement over time (median = 0.571 pixels/hour), demonstrating stability of motion correction across extended recordings. (I) Distribution of erroneous frames as percentage of total recording across all sessions (median = 0.37%), showing automated quality control effectively identifies and removes artifacts without substantial data loss.

Automated field-of-view cropping improves computational efficiency by reducing pixel load.
(A) Pre-crop miniscope frame showing full field of view with vignetting and peripheral regions lacking cellular activity. (B) Post-crop frame demonstrating automated detection and retention of active cellular regions while removing uninformative periphery. (C) Singular value spectrum from NNDSVD decomposition showing rapid decay after initial components, with elbow point indicating optimal dimensionality for downstream processing. Green points indicate selected components capturing majority of signal variance. (D) First three spatial components from NNDSVD decomposition, revealing distinct cellular structures and spatial patterns that serve as initialization for CNMF. Components are ordered by variance explained, with Component 1 capturing the most prominent spatial features and subsequent components revealing progressively finer structures. (E) Fluorescence stability over 3-hour recording period demonstrates minimal photobleaching with mean signal decay of 17.4% with 5s gaps between 60s recordings.

Watershed segmentation and component initialization with spatial merging and validation.
(A) Spatial distribution of detected components for Component 1 of an example session showing raw fluorescence image (left), watershed-segmented components with color-coded masks (middle), and merged overlay (right). (B) Scatter plots showing component centroids for all NNDSVD components before (left, high density) and after (right, reduced density) spatial merging. (C) Quantification of component counts across the initialization pipeline, showing reduction from pre-watershed (left) to post-spatial merge (right). Bar plot compares before versus after merging across all sessions with individual data points overlaid. (D) Representative temporal traces from five example components (Comp 2 through Comp 9) showing calcium activity patterns over 2000 frames. Left panel displays raw temporal traces with distinct activity patterns across components; right panel shows activity trace for merged components, demonstrating successful consolidation of correlated signals. (E) Comparison of component counts post-spatial merge (left median = 155.3 ± 53.8) versus post-temporal merge (right, median = 115.3 ± 38.7), demonstrating temporal correlation-based merging further reduces redundant components. (F) Distribution of noise level across all sessions, showing strong peak near real signal and an additional peak towards zero, indicating noise remaining that MPS caught. (G) Distribution of noise estimates caught across all final initialized components after validation, showing median noise level of approximately 0.52.

Temporal activity update through autoregressive deconvolution with quality control filtering.
(A) Distribution of YrA values (residual after projecting spatial components onto the movie) centered near zero, indicating successful demixing and background subtraction. (B) Heatmaps of temporal activity for all components for a single session before (left) and after (right) the temporal update. Each row is one component. Color intensity represents normalized calcium activity across frames. (C) Representative example traces showing the initialzied trace (left, 5 examples) and trace after the temporal update (right, 5 examples labeled). (D) Distribution of estimated decay time constants across all components, showing median decay of 1.0 frames (mean = 1.6 frames, range 0.4-20.3 frames). (E) Component retention across temporal filtering, comparing counts before (left, median = 114.8 ± 7.6) versus after (right, median = 104.7 ± 6.7) quality control, representing 8.8% rejection rate. Signal-to-noise ratio improved by mean of 55.6 ± 0.8 dB across retained components.

Spatial footprint refinement through localized nonnegative regression with neighbor-aware updates.
(A) Spatial distribution of components before (left) and after (right) spatial refinement. Each colored region represents refined spatial footprint after dilation-bounded regression and neighbor subtraction. Post-refinement components show improved spatial localization and reduced overlap. (B) Component count reduction across sessions from pre-spatial update (median = 104.7 ± 6.7) to post-spatial update (median = 51.6 ± 4.1), representing 50.8% reduction through merging of spatial duplicates and removal of implausible footprints. (C) Distribution of nearest-neighbor distances between refined component centroids, showing shift toward larger separations with peak around 100-150 pixels and histogram counts up to 400 components.

Final temporal refinement with updated spatial footprints produces high-quality curated neural components.
(A) Distribution of YrA values (residual after projecting refined spatial components onto the movie) centered near zero, indicating successful demixing and background subtraction with improved spatial footprints compared to first temporal pass. (B) Heatmaps of temporal activity for all components for a single session before (left) and after (right) the final temporal update. Each row is one component. Color intensity represents normalized calcium activity across frames. (C) Representative example traces showing post-first-pass temporal update traces (left, 5 examples) and denoised calcium traces after the second temporal refinement (right, 5 examples). (D) Distribution of estimated decay time constants across all final components, showing median decay of 1.0 frames (mean = 1.6 frames, range 0.4-20.3 frames), consistent with first temporal pass. (E) Component retention across final temporal filtering, comparing counts before (left, yellow/gold bar, median = 117.1 ± 7.7) versus after (right, teal bar, median = 52.6 ± 4.2) quality control, representing 55.1% rejection rate.