Guide/Data processing considerations
Format: Troubleshooting
Audience: Intermediate
| Last reviewed | 2026-06-01 |
| Reviewer | User:Marcel |
| Next review due | 2027-06-01 |
| Review interval | 12 months |
Review history
- 2026-06-01 — User:Marcel — Passed
What makes 1p miniscope data difficult to analyze
A 2p microscope optically sections the tissue, so most fluorescence comes from a thin focal plane. A 1p miniscope does not. It uses wide-field epifluorescence through a GRIN lens or cranial window:
- Light is collected from a larger axial volume (depth of field) since it lacks optical sectioning of 2p: out-of-focus neurons above and below the focal plane contribute fluorescence to every pixel, and cells can overlap.
- The background is large, structured, and time-varying. It is not a flat DC offset; it fluctuates with the activity of all those out-of-focus cells and with vasculature/hemodynamics.
- SNR per cell is generally lower than in 2p, and crosstalk between nearby cells is a real and constant concern.
Almost every design choice in 1p analysis pipelines is driven by these facts. The main issues are background modeling and demixing.
demixing = separating the overlapping signals of nearby or stacked cells so each neuron gets its own clean trace
The standard analysis pipeline
Pipelines differ in the details but converge on the same sequence of steps. The main open-source options today are CaImAn (CNMF-E), MIN1PIPE, Minian, and, more recently, extensions like OnACID-E (online), SCOUT (longitudinal), and MPS (long-duration GUI-based). The most important fact to know is that essentially they share the CNMF backbone but differ in preprocessing, background model, initialization, and how much hand-holding they give you.
The standard 1p miniscope analysis pipeline. Preprocessing: downsample, crop to FOV, spatial high-pass for alignment. Motion correction: run on the filtered copy, apply shifts to raw. Source extraction (CNMF-E): seed pixels via correlation × PNR, ring background model for out-of-focus signal, iterative spatial/temporal updates, internal merging of overlapping components. Trace post-processing: AR(1)/AR(2) denoising, OASIS deconvolution to event rate. QC: SNR, footprint shape, trace realism, overlap × correlation to flag duplicates, manual or classifier-based rejection. Outputs: spatial footprints (A, used for cross-session matching) and the denoised trace (C, scaled ΔF not ΔF/F, plus inferred event rate S).
Step 1 — Preprocessing: downsampling, denoising, cropping
Raw videos are large (tens of GBs). Most pipelines:
- Spatially and temporally downsample. This trades some resolution for tractable runtimes and tends to help SNR by averaging shot noise.
- Apply a spatial high-pass filter or rolling-ball background subtraction as a first cleanup pass, especially before motion correction.
- Crop the FOV to the GRIN aperture or to the usable neural tissue.
The amount of work needed here scales with recording quality. Clean, stable recordings may need only light preprocessing, while noisy or drift-prone sessions benefit substantially from aggressive denoising and filtering.
Several preprocessing steps are specifically there to prepare the data for motion correction. Spatial high-pass filtering removes the strong, low-frequency background that would otherwise dominate the cross-correlation between frames and pull alignment toward background structure rather than cells. Downsampling reduces the impact of per-pixel noise on shift estimation, and cropping prevents the dark borders or vignetting at the GRIN edge from biasing the template.
Step 2 — Motion correction
The de facto standard is NoRMCorre (Pnevmatikakis & Giovannucci, 2017), used in CaImAn, MIN1PIPE, Minian, and most third-party packages. It does template-matching against a continuously updated template, in either rigid or piecewise-rigid mode. For 1p data, NoRMCorre is typically run on a spatially high-pass filtered copy of the data, because the strong background otherwise dominates the cross-correlation and gives wrong shifts.
- Rigid is usually sufficient for head-fixed/stable preparations and shorter sessions, but also works for freely-moving if the baseplate fixation is well done.
- Piecewise-rigid (non-rigid) is needed when there are non-uniform deformations — common in freely-moving rodents.
Most pipelines report estimated shifts per frame in pixels, usually as rigid (x, y) translations or as a piecewise-rigid shift field. If you know the image sensor on your Miniscope, you can calculate pixels into µm by knowing the pixel size of the image sensor.
- Shifts of a few pixels (≤ ~5 µm) are routine in freely-moving recordings and are well within what rigid or non-rigid alignment can handle without distortion.
- Shifts of ~15+ µm start to exceed a cell diameter. This means a cell's image moves onto pixels that previously belonged to a different neuron (or background), so without good motion correction, traces extracted at fixed pixel locations become mixtures of multiple cells.
Step 3 — Source extraction (the heart of the pipeline)
Two major families historically:
- PCA/ICA (Mukamel et al., 2009): the original method. Largely deprecated but still seen in older papers.
- CNMF-E (Zhou et al., 2018) and its descendants: the current standard, discussed in detail below.
Step 4 — Trace post-processing and deconvolution
Once spatial footprints and raw temporal traces are extracted, pipelines typically deconvolve each trace:
- An autoregressive calcium model describes the shape of a transient
- usually AR(1) for a single decay or AR(2) to also capture the rise of the signal
- An algorithm such as OASIS (Friedrich et al., 2017) fits that model to the noisy trace. This single step yields both a denoised calcium estimate and a non-negative inferred "spiking"/event signal.
Step 5 — Quality control
Historically more of a human inspection. But nowadays transforming to a mix of automated metrics and human inspection. Many pipelines now ship classifiers (e.g. the AutoML-based curation tool by Tran et al. 2020, or built-in CNN classifiers in CaImAn). See Section 6.
Step 6 — Cross-session registration (longitudinal experiments)
If you image the same animal across days, you need to match cells across sessions. The standard tool is CellReg (Sheintuch et al., 2017), which uses spatial footprint similarity plus a probabilistic model. SCOUT offers an alternative that integrates registration with extraction.
CNMF-E and why it shows up everywhere
CNMF-E is the de facto standard of 1p miniscope analysis. Even pipelines that aren't "CNMF-E" usually borrow most of their machinery. The original CNMF (Constrained Non-negative Matrix Factorization, Pnevmatikakis et al., 2016) was designed for 2p data and modeled the video as:
- Y ≈ A · C + B + noise
where A is the spatial footprints, C is the temporal traces, and B is the background. In 2p CNMF, B is approximated as low-rank (assumed simple enough to capture with just a few spatial patterns), fine for 2p, terrible for 1p because the 1p background is much richer.
CNMF-E (CNMF for microEndoscopic data; Zhou et al. (2018)) replaced the simple low-rank background with a local "ring" model. The idea: the background at a pixel is well-approximated by a linear combination of the values in a ring of pixels at a chosen radius around it (large enough that the ring lies outside any single cell, but small enough that local fluctuations are still captured). This effectively models the strong, spatially-varying, time-varying background from out-of-focus neurons that dominates 1p data.

Why pipelines all look similar: Minian, MIN1PIPE, MPS, OnACID-E, and SCOUT all build on this same core machinery. They differ in:
- Initialization of components (MIN1PIPE uses NNDSVD + morphological seeds; MPS adds watershed segmentation with merging/validation; CNMF-E uses local correlation peaks).
- How much of the algorithm is online vs offline (OnACID-E streams frames; the others are batch).
- GUI vs scripting (Minian and MPS are friendly to non-coders; raw CaImAn requires Python/Matlab).
- Long-duration handling (MPS adds Dask out-of-core execution and parallelized updates).
- How they handle the speed/accuracy trade-off — e.g. MIN1PIPE was reported to be faster and produce tighter, more localized footprints, but with possibly more missed cells; CNMF-E detects more components but with a higher false-positive rate and more split/unmerged ROIs.
C_raw is not ΔF/F. The author (Zhou) explicitly advises against using ΔF/F for microendoscopic data because there's no meaningful baseline F₀ — the "baseline" is dominated by background fluorescence that you already subtracted. C_raw is best thought of as a denoised, scaled version of ΔF, and analyses should be done in those units or in normalized (z-scored / SNR-normalized) units.Many people wrongly show this output of CNMF-E as ΔF/F. The problem becomes serious when you try to compare absolute amplitudes across cells, across studies, or across recording sessions, or when you assume the values mean something physiologically calibrated (like "this cell's fluorescence increased by 30% of its baseline"). They don't.
CNMF-E tuning: best practices
Most pipelines don't expose a first and second CNMF-E pass as two literal passes. CaImAn's CNMF-E runs initialization, spatial/temporal updates, and merging as internal sub-steps of a single call; MIN1PIPE does seed cleansing as part of one extraction; Minian splits the substeps into individually-tunable notebook cells. What matters is the conceptual distinction: some parameters control what gets detected, others control what gets kept. Think of them as two groups, even when the pipeline runs them together, because they should be tuned with different mindsets.
Pass 1 — Be permissive on the initial spatial detection
The first spatial update / initialization is where candidate components are seeded. The cost of missing a real cell here is high (you can't recover it later); the cost of including some false positives is low (you'll prune them in pass 2). So lean permissive but don't overseed a lot:
- Correlation and PNR thresholds for seed/peak detection. Lower them until you see clear false positives appearing. That's roughly where the true cells stop being included. Then back off slightly.
- Minimum cell size and shape constraints. Don't be too restrictive — a partially-occluded or oddly-shaped real cell still has a real trace.
- Maximum number of components. Set it well above your expected cell count if the pipeline asks.
Rough estimates of cell density (highly dependent on indicator expression and animal preparation):
| Brain region | Expected density / notes |
|---|---|
| Hippocampal CA1 / dentate gyrus | Dense, well-separated cells. Expect 100–500 cells per session. |
| Cortex (L2/3) | Lower cell density visible, more background structure from out-of-focus L1/L4; may need larger ring radius and stricter footprint compactness. |
| Subcortical (striatum, hypothalamus, BLA) | Variable density, often very strong background from sparsely-labeled neuropil; ring radius and background rank matter most here. |
Pass 2 — Be strict on refinement, merging, and acceptance
Once you have a permissive set of candidates, tighten the filters:
- Raise SNR thresholds for accepted components.
- Tighten footprint shape constraints — require compact, roughly circular, cell-sized spatial profiles.
- Aggressive merging of components that are spatially overlapping and temporally correlated above some joint threshold (e.g. >70% overlap and r > 0.8). This is where split-cell artifacts get fixed.
- Reject components with traces that look like background fluctuations (no clear transients, abnormally slow dynamics) or that track motion.
What you can and cannot infer from 1p calcium data
This is where many projects go off the rails.
What you can reasonably claim
- Whether a neuron was active during a behavioral epoch. Calcium transients reliably reflect bursts of spiking activity. If you see a transient, the cell almost certainly fired.
- Rate-level differences across conditions. Comparing mean activity, transient counts, or AUC (area-under-the-curve) between conditions is generally robust.
- Population-level structure: ensembles, cell assemblies, tuning to behavioral variables, manifold/state-space analyses, decoding. These all work well because they pool across cells and time and are not very sensitive to single-spike resolution.
- Cell identity tracking across days (less accurate but with proper registration reasonable).
What you cannot claim — or should claim only with major caveats
- Single spike times. GCaMP6f has a rise time of ~50–100 ms and decay of ~150–500 ms; GCaMP6s is much slower. A single calcium transient typically reflects multiple spikes within a window. Even with modern deconvolution (OASIS, MLSpike, CASCADE), you should think of the output as an estimate of instantaneous firing rate, not a spike train.
- Precise temporal relationships at the millisecond scale. Spike timing analyses common in Ephys (cross-correlograms at ms lags, phase locking to LFP oscillations, spike-triggered averages with tight windows) are not appropriate. The temporal resolution is bounded by the indicator kinetics, and the frame rate (typically 10–30 Hz), and the effective resolution is closer to ~100 ms at best.
- Absolute firing rates. ΔF/F or C_raw is not a calibrated measure of spike count.
- Linear scaling with spike count. The relationship between spikes and fluorescence is nonlinear: at low rates the indicator can be subthreshold (an isolated spike may not be detectable for some indicators), and at high rates it saturates. This nonlinearity is well-documented for GCaMP6 and is mitigated by GCaMP8. There's also a recently-described history-dependent / use-dependent nonlinearity: the apparent gain depends on prior activity. Spike inference tools like CASCADE have been retrained for GCaMP8 partly to address this, but you should not assume linear scaling regardless of the indicator.
- Decreases in activity. The non-negativity assumption baked into most pipelines (CNMF-E, OASIS, etc.) means negative deflections in the underlying signal are systematically pushed to zero. If a population is genuinely suppressed below baseline, standard pipelines will under-report it.
- Subthreshold activity, dendritic events. Somatic GCaMP doesn't reliably report these.
The cleanest framing: 1p miniscope data gives you single-cell-resolution, slow-timescale, rate-like estimates of activity in a defined cell population, in a freely-moving animal. That is an enormous capability that 2p and ephys cannot match, but it is not a substitute for either.
Quality assessment
SNR matters, but it is not sufficient. A serious QC pass should check:
Spatial footprint quality
Footprints should be compact and roughly cell-sized. Diffuse, ring-shaped, or fragmented footprints usually indicate (a) a real cell that's been split into multiple components, (b) leftover background that wasn't demixed, or (c) a vessel or artifact. Compare the footprint diameter to your expected cell size given the indicator, lens magnification, and brain region.
Temporal trace quality
- Transients should have a realistic shape: fast rise, slower exponential-ish decay, with the decay constant matching the indicator (e.g. ~500 ms for GCaMP6f, ~1.5 s for GCaMP6s).
- Unrealistic negative excursions are a sign that something is wrong (most pipelines enforce non-negativity, so dipping well below zero suggests bad background subtraction).
- The trace should not perfectly track motion — if peaks line up with motion artifacts, you have a motion problem.
Duplicate / split cells
When two extracted ROIs sit on top of each other and have highly correlated traces, they are probably the same cell split into two components. Most pipelines have merge steps for exactly this, but they aren't perfect. However (and this is the trap) two nearby but distinct cells can also have highly correlated traces if they receive common input or are part of the same ensemble. So correlation alone does not mean "same cell."
A more reliable joint criterion:
- Spatial overlap + high temporal correlation → likely the same cell. Common thresholds in the literature are >50–70% footprint overlap combined with correlation >0.7–0.9, but tune to your dataset.
- No spatial overlap + high correlation → probably real co-activity (or shared noise — check whether it's also high during quiet periods).
- High overlap + low correlation → suspicious. Could be two cells genuinely at different depths sharing pixels, or a real cell plus a contaminating background component.
The overlapping-cells-at-different-depths problem
Because 1p collects from a depth of field higher than in 2P, two anatomically distinct cells can project onto overlapping pixels — one in focus, the other slightly above or below. The one that's out of focus has a larger, blurrier footprint and a lower, more diffuse signal, and its trace will leak into the in-focus cell's trace via crosstalk. CNMF-E's demixing helps but doesn't solve this completely. Signs:
- A "cell" with an unusually large or fuzzy footprint relative to its neighbors.
- A trace that's a damped, low-amplitude version of a clearer neighbor.
- After merging by overlap criteria, you still see correlated pairs.
There's no fully automated fix. Inspect, decide whether to drop ambiguous components, and be transparent about your inclusion criteria in the paper.
A practical QC checklist
- Compute SNR or peak-to-noise ratio for every trace; set a defensible threshold.
- Visualize all spatial footprints overlaid on the mean/max projection. Flag any that don't look cell-like. The same can be done by overlaying footprints on the filtered video to observe if they cover actual cell activity.
- Compute pairwise temporal correlation and pairwise spatial overlap for all components. Plot one against the other. The interesting cells are scattered; suspicious pairs cluster at the high-overlap, high-correlation corner.
- Manually inspect a random subset (≥10%) of components — traces and footprints together.
- Inspect at least one full session video with footprints overlaid in playback. Most artifacts only become obvious in motion.
- If running longitudinally, check that the cells you "tracked" across sessions actually have similar footprints in their respective sessions, not just the registration tool's confidence score.
Deconvolution of raw fluorescence activity
Because of that uncertainty, the practical question is less "what is the true spike train" and more "how do I choose deconvolution parameters sensibly and document that choice." We provide CaLab, a suite of browser-based calcium imaging analysis tools from the Aharoni lab. The tools run entirely in the browser — no installation, no server, and no data upload — which makes them easy to use and easy to share with collaborators.
CaTune — guided manual parameter exploration
CaTune is the flagship app and comes with a full guide for adjusting the deconvolution parameters yourself. You load your fluorescence traces and interactively adjust the deconvolution parameters — rise time, decay time, and sparsity — with sliders while watching the solver update in real time, so you can develop intuition for what each parameter does and settle on values you can justify. Under the hood the deconvolution engine is a FISTA solver written in Rust and compiled to WebAssembly, running in parallel for multi-cell processing. Tuned parameters can be exported as JSON for use in downstream analysis pipelines, and a companion calab Python package runs the same algorithm so you can round-trip parameters between the browser tool and your scripts. This is the recommended starting point when you want to understand — and be able to defend — your deconvolution choices.
CaDecon — unsupervised, automatic deconvolution
CaDecon is a separate, browser-based tool in the same suite that attempts to do the deconvolution step unsupervised and automatically, without the manual tuning. It is the option to reach for when you want a hands-off default rather than per-dataset hand-tuning.
Practical recommendations
- Pick one pipeline and learn its parameters deeply rather than hopping. The main parameters that matter across all of them: cell diameter, background ring radius (for CNMF-E variants), correlation/PNR thresholds for initialization, and the deconvolution model order.
- Always validate by eye. No metric replaces playing the video with footprints overlaid.
- Decide your analysis units up front. ΔF/F is misleading for 1p; prefer C_raw, z-scored traces, or deconvolved event rates depending on the question.
- Match your claims to the data's resolution. If your hypothesis depends on millisecond-scale timing, 1p miniscope data cannot answer it. Pair with ephys or use a different preparation.
- Pre-register your inclusion criteria for ROIs (SNR threshold, footprint size range, max correlation with neighbors for retention). This protects against post-hoc cell selection biasing your results.
Key references
- Zhou et al. (2018), eLife — original CNMF-E paper.
- Pnevmatikakis et al. (2016), Neuron — original CNMF.
- Pnevmatikakis & Giovannucci (2017), J. Neurosci. Methods — NoRMCorre.
- Mukamel et al. (2009), Neuron — PCA/ICA (historical).
- Lu et al. (2018), Cell Reports — MIN1PIPE.
- Dong et al. (2022), eLife — Minian.
- Giovannucci et al. (2019), eLife — CaImAn.
- Friedrich et al. (2017), PLOS Comp. Biol. — OASIS deconvolution.
- Sheintuch et al. (2017), Cell Reports — CellReg.
- Giovannucci et al. (2021), PLOS Comp. Biol. — OnACID-E.
- Rupprecht et al. (2021), Nature Neuroscience — CASCADE deep-learning spike inference.
- Tran et al. (2020), Frontiers in Neural Circuits — AutoML curation of CNMF-E ROIs.