Abstract
SmaRT2P is an open-source MATLAB toolbox designed to optimize two-photon calcium imaging by replacing traditional raster scans with "smart" line trajectories that target specific neurons of interest. This end-to-end pipeline facilitates the design of optimal scan paths using genetic algorithms and provides robust methods for cleaning motion artifacts and neuropil noise. The resulting system enables higher temporal resolution and improved signal quality in large-scale neural recordings.
Introduction
Two-photon (2P) calcium imaging is a fundamental tool in modern neuroscience, allowing for the simultaneous monitoring of activity across thousands of neurons. However, standard raster scanning is inherently inefficient, as the laser spends significant time scanning empty space between neurons. This inefficiency leads to low Signal-to-Noise Ratios (SNR) and slow sampling rates, which can impede the detection of individual action potentials (spikes) in large populations.
"Smart Line Scanning" (SLS) addresses this by directing the laser along a custom path through selected regions of interest (ROIs). Despite its advantages, SLS is difficult to implement due to complex pathfinding requirements, specialized hardware interfaces, and the need for unique data processing strategies to handle tissue motion and neuropil contamination. SmaRT2P provides a user-friendly, modular, and open-source solution to these challenges.
Methods
SmaRT2P is a MATLAB-based environment organized into two primary functional blocks: trajectory design and data processing.
Trajectory Optimization
To determine the most efficient path across multiple neurons, the software treats scan path generation as a "Traveling Salesman Problem" (TSP). It employs a Genetic Algorithm to identify a near-optimal route in under 10 seconds, minimizing the "jump" time between cells.
Data Processing and Motion Correction
Because line scans do not produce standard 2D images, traditional motion correction algorithms are ineffective. SmaRT2P introduces two novel strategies:
- Reference Box: A small 2D area is scanned at the end of each line to estimate tissue displacement using the NoRMCorre algorithm.
- SNR-based Pixel Reassignment: A dynamic method that evaluates a sliding time window to re-select optimal pixels for each neuron based on current signal strength.
Neuropil Decontamination
The pipeline implements both local (surround-based) and global (PCA-based) methods to subtract background fluorescence, which can otherwise obscure true neural activity.
Validation Datasets
The software was validated using 2P calcium imaging data from Layer IV of the mouse barrel cortex (GCaMP6s indicator). Data were collected from both anesthetized and awake, running mice to evaluate robustness against motion. The authors have made this dataset publicly available for future benchmarking.
Key Insights and Results
A critical feature of SmaRT2P is the use of an adjustable "surround" buffer (2–3 pixels) around each neuron. This buffer makes SLS significantly more robust to brain movement in awake animals, preventing signal loss during tissue shifts.
Key results include:
- Efficiency: Rapid generation of complex trajectories for large neural populations.
- Signal Enhancement: SNR-based correction consistently improved signal quality across conditions.
- Noise Reduction: Combined background subtraction and neuropil decontamination significantly reduced artificial pairwise correlations.
- Awake Imaging: In awake animals, trajectories with larger surrounds drastically reduced data loss from motion artifacts.
Discussion and Future Work
While SmaRT2P offers a robust pipeline, it currently assumes rigid motion within the small scan area. Although likely accurate at high speeds, this assumption may require further validation across diverse brain regions. Additionally, SNR-based pixel reassignment depends on neural activity; silent neurons may yield less accurate pixel selection during inactive periods. Future developments may include adaptation for faster scanning technologies, such as acousto-optic deflectors (AODs).
Summary updated