Speckle-enabled in vivo demixing of neural activity in the mouse brain

Functional imaging of neuronal activity in awake animals, using a combination of fluorescent reporters of neuronal activity and various types of microscopy modalities, has become an indispensable tool in neuroscience. While various imaging modalities based on one-photon (1P) excitation and parallel (camera-based) acquisition have been successfully used for imaging more transparent samples, when imaging mammalian brain tissue, due to their scattering properties, two-photon (2P) microscopy systems are necessary. In 2P microscopy, the longer excitation wavelengths reduce the amount of scattering while the diffraction-limited 3D localization of excitation largely eliminates out-of-focus fluorescence. However, this comes at the cost of time-consuming serial scanning of the excitation spot and more complex and expensive instrumentation. Thus, functional 1P imaging modalities that can be used beyond the most transparent specimen are highly desirable. Here, we transform light scattering from an obstacle into a tool. We use speckles with their unique patterns and contrast, formed when fluorescence from individual neurons propagates through rodent cortical tissue, to encode neuronal activity. Spatiotemporal demixing of these patterns then enables functional recording of neuronal activity from a group of discriminable sources. For the first time, we provide an experimental, in vivo characterization of speckle generation, speckle imaging and speckle-assisted demixing of neuronal activity signals in the scattering mammalian brain tissue. We found that despite an initial fast speckle decorrelation, substantial correlation was maintained over minute-long timescales that contributed to our ability to demix temporal activity traces in the mouse brain in vivo. Informed by in vivo quantifications of speckle patterns from single and multiple neurons excited using 2P scanning excitation, we recorded and demixed activity from several sources excited using 1P oblique illumination. In our proof-of-principle experiments, we demonstrate in vivo speckle-assisted demixing of functional signals from groups of sources in a depth range of 220–320 µm in mouse cortex, limited by available speckle contrast. Our results serve as a basis for designing an in vivo functional speckle imaging modality and for maximizing the key resource in any such modality, the speckle contrast. We anticipate that our results will provide critical quantitative guidance to the community for designing techniques that overcome light scattering as a fundamental limitation in bioimaging.


1P imaging setup
For excitation, the continuous-wave beam from a Coherent Sapphire 488-30 solid state laser was used, cleaned up by spatial filtering using a 100-µm pinhole placed between an f = 50 mm and an f = 500 mm planoconvex lens in 2f configuration.Laser power was controlled by rotating a linear polarizer.The resulting collimated beam was focused into the back focal plane (BFP) of a Nikon CFI75 LWD 16× objective (NA 0.8, 3 mm WD) using a planoconvex lens of f = 750 mm.The objective was mounted in Scientifica Slicescope 2P microscope, with the 2P paths disabled during 1P imaging.The beam was reflected off a mirror mounted on a translational stage before the objective.By moving this stage, the desired offset (9.5 mm from the optical axis) of the beam in the objective BFP was set, resulting in an oblique beam in the sample.
For the demagnification optics used in both the 2P and 1P excitation approaches, a fixedfocal-length achromatic doublet lens in combination with a Nikon AZ-Plan Fluor 5× objective (0.5 NA, 15 mm WD) was used.The demagnification ratio was varied by choosing different focal lengths for the doublet lenses.For all 1P speckle imaging sessions, demagnification was set to 3.75× by using an f = 75 mm doublet lens along with the Nikon AZ-Plan Fluor 5× objective (5× nominal magnification is for a tube lens focal length of 100 mm).

Evaluation of speckle contrast
To evaluate speckle contrast in Figs.3-5, we carried out the following processing steps: 1. Manually crop recorded frames to a rectangle that is fully inside the area illuminated by speckle.2. Perform rigid motion correction using the NoRMCorre package (also part of the CaImAn package).3. Bin and average three frames.4. Pick brightest averaged frame in recording.5. Apply high-pass spatial filter to remove large structures (e.g., blood vessels) that would affect contrast calculation.The cut-on spatial frequency was chosen by manual inspection such that speckle grains are preserved, but structures as large as or larger than the width of a typical small blood vessel in the frame are removed.6. Apply 3 × 3 px median filter to reduce pixel-by-pixel noise.7. Divide filtered frame into 10 × 10 blocks.8.For each block, calculate block-wise speckle contrast as the ratio of standard deviation and mean of pixel values.This block-wise processing step is akin to typical contrast calculation strategies in Laser Speckle Contrast Imaging.It allows to inspect the effects of vignetting and large absorbing structures within the frame onto local contrast.9. Compute mean and standard deviation of block-wise contrast values.10.Ignore blocks with a contrast lower than one standard deviation below the mean, and compute average of the remaining block-wise contrasts.This is the contrast value plotted in Figs.3-5.

Demixing pipeline
After cropping the raw speckle movies (~10 min for 1P recordings), motion-correction was performed using the NoRMCorre algorithm that is part of the CaImAn package [1].After a three-frame block-wise averaging, the global fluorescence background was estimated by rank-1 NMF using the nnmf() function in MATLAB, and subtracted.This approach efficiently removed the stationary spatial component (background) present throughout the recording.To demix speckle footprints and their corresponding time traces, NMF was run several times with increasingly large rank parameters.After each NMF run, components were inspected and those resembling a speckle pattern spatially and neuronal activity in time were subtracted from the data.This procedure was repeated until no reasonable temporal calcium signal remained.The baseline of the resulting time traces was estimated using a moving percentile filter (fifth percentile) with a 25-s window size and subtracted from the traces.Due to sample motion and slow physiological processes, we observed that the shape of speckle footprints exhibited slow drifts in our in-vivo imaging experiments.This may cause NMF to assign shifted version of footprints to separate components.The mediate this over-segmentation, NMF was followed by merging components if their temporal correlation was above a high threshold.Time traces were denoised by fitting with a model of GECI transients implemented in the deconvolveCa() function contained in the CaImAn package.To compute the SNR of each trace, the noise level was estimated by taking the standard deviation of all frequency components above a certain frequency threshold.This threshold was estimated by finding the frequency at which the power spectral density of a strong and active example calcium activity trace had fallen off to a level of 1/ 2 compared to the power spectral density of the most prominent low frequency component.Finally, all traces were normalized by their individual SNR.

NMF performance under decorrelation of spatial components
The observed decorrelation of the speckle footprints (Section 3.4 of main text) violates the assumptions underlying the NMF model, which is based on the spatial components being constant.To evaluate the effect of this model mismatch, we generated time series of speckle components that decohere slowly in time.We then modulated each decohering component with a neuronal activity time series (which served as ground truth), as obtained in a typical standard two-photon microscopy recording.We then summed ten such decohering neuroactivitymodulated speckle component time series to generate the mixed data that would be observed on the camera.Finally, we ran 100 NMFs with different random initializations on the simulated camera data and compared the resulting temporal components with ground truth by finding the best-match pairs between NMF output and ground truth time series and computing their correlations.
The initial spatial components were generated by low-pass filtering Gaussian noise images to obtain random patterns with a grain size similar to the observed speckle grains.Decorrelation was simulated using a simple autoregressive model, in which at each time step, an independent, low-pass filtered noise image was added to the output of the previous time step.The relative weight of this admixture and the standard deviation of the noise images were tuned manually to obtain decorrelation dynamics that approximately matched the observed dynamics.For comparison, we also generated a camera movie that did not include decorrelation, and a movie for a scenario in which decorrelation was faster than measured (Supplemental Fig. 2a).Four example frames from a simulated camera movie are shown in Supplemental Fig. 2b: It can be observed that the locations and shapes of speckle grains shift and transform slowly in time, indicating slow decorrelation of the underlying speckle footprints.The resulting NMF performance is summarized in Supplemental Fig. 2c, and a representative NMF result is shown in Supplemental Fig. 2d.In the scenario without decorrelation, the correlations between NMF output traces and ground truth are generally best (0.74 ± 0.16, mean ± standard deviation), albeit not perfect: Due to the non-convex nature of NMF, the result of each run depends on the random initialization.For increasing decorrelation dynamics, the best-match correlations decrease gradually, to 0.68 ± 0.14 and 0.64 ± 0.13, for the as-measured and fast decorrelation scenarios, respectively.This result indicates that while NMF result quality decreases for decorrelating spatial components, it does not break down abruptly for the parameters studied but declines gradually.

Animal preparation
All surgical and experimental procedures were approved by the Institutional Animal Care and Use Committee of The Rockefeller University.Male and female adult C57BL/6J mice were supplied by Jackson Laboratory.All mice were >30 days of age at the time of the first procedure and were >45 days old during imaging experiments.Mice were allowed food and water as desired.In C57BL/6J mice, expression was achieved through injection of viral vectors AAV9-TRE3-2XsomaGCaMP7f (initial concentration of 6.37 × 10 13 GC/ml) and AAV2/9-Thy1-tTA (initial concentration of 2.24 × 10 13 GC/ml) with 1:10 titer ratio at ~1-2 weeks prior to 5 mm cranial window implantation.To minimize deep background fluorescence and achieve sparse labeling, the number of injection sites was limited to 5 injections arranged as the vertices of a cross centered on the window and oriented along A-P and L-R directions.In addition, viruses were diluted 10×-25×.Injections were performed at depths of 400 µm to 450 µm to minimize expressions in superficial regions.

Supplemental Figure 1 :
Additional representative examples for spatio-temporal demixing of 1P-excited speckle from multiple neurons.(a) Mouse 1, speckle imaging depth   = 350 μm, 600 s recording duration, 10 fps.(b) Mouse 2, speckle imaging depth   = 350 μm, 600 s recording duration, 12 fps.Both datasets: Images are demixed footprints (left to right and then down; scale bar for spatial components: 50 μm) and line plots are their corresponding time traces, both raw (gray line) and denoised (blue line).The 1P-excited speckle spatial components have different brightness levels, as indicated by the maximum brightness value shown above each color bar.

Supplemental Figure 2 :
Performance of NMF under three decorrelation scenarios.(a) For three simulated scenarios, correlation of the generated data with the first frame.Blue: no decorrelation.Red: decorrelation approximately as measured (Section 3.4 of main text).Yellow: Decorrelation faster than measured.(b) Simulated sum of 10 single-neuron speckle components at four different timepoints, for the scenario that approximately matches measured decorrelation dynamics (red trace in (a)).Black rectangle is guide to the eye: The speckle grains gradually transform as decorrelation progresses.(c) NMF performance for the three scenarios (color code as in (a)).Each data point is the correlation of an NMF temporal component with the bestmatching ground truth time trace, for 100 NMF runs and 10 components in each scenario.The distributions of the best-match correlations are also visualized as box-and-whiskers plots and violin plots in each scenario.Mean ± standard deviation of best-match correlations: 0.74 ± 0.16, 0.68 ± 0.14 and 0.64 ± 0.13 for no, as-measured and faster decorrelation scenarios, respectively.(d) Representative example of one NMF run in the as-measured scenario, showing the ten ground-truth time series (blue) and the best-match NMF temporal components (red), with their correlation (R) value given in the respective text insets.