Introduction

Advances in microscopy technologies for biological imaging have significantly enhanced our understanding of physiological processes. Multiphoton microscopy (MPM) has emerged as a powerful tool, leveraging nonlinear excitation to enable in vivo imaging in living animal models for studying fundamental biology and disease mechanisms1,2,3. However, tissue heterogeneity induces aberrations and scattering that distort the excitation light wavefront, limiting both resolution and depth in noninvasive deep-tissue imaging. In recent years, adaptive optics (AO), originally developed in astronomy to correct atmospheric aberrations, has been successfully adapted to microscopy to correct tissue-induced aberrations and improve both imaging resolution and depth4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19.

AO methods can be classified into two approaches based on aberration measurement: indirect and direct wavefront sensing. Indirect methods use algorithmic optimization of correction wavefronts based on fluorescence signal metrics7,8,9,10,11,12, while direct methods employ dedicated wavefront sensors for aberration measurement and correction13,14,15,16. However, the limited speed of traditional AO methods restricts their application to anesthetized animals, despite evidence that anesthesia alters normal physiological states and cellular behavior20,21,22,23,24,25. While imaging awake animals would provide more accurate biological insights, their increased movement compared to anesthetized subjects generates significant motion artifacts26,27,28,29,30,31. These motion artifacts compromise AO measurement accuracy by disrupting the stable guidestar required for wavefront correction. Therefore, achieving precise wavefront correction for near noninvasive MPM in awake, behaving animals requires an AO method that combines both speed and accuracy.

We recently reported an AO technology called ALPHA-FSS for three-photon microscopy (3PM) that directly measures the aberrated electric-field point spread function (E-PSF) through raster scanning between a strong beam and a coherent weak beam, with aberration correction achieved through phase conjugation of the measured PSF17. This technology shares the same physical principle as F-SHARP18,19. ALPHA-FSS demonstrated successful probing and correction of both aberrations and scattering in vivo through highly turbid tissues, including the intact mouse skull. However, despite its advantages of high accuracy, high correction order, and relatively fast measurement speed, the several-second duration required for PSF measurement remains a limiting factor for applications in awake behaving animals due to motion artifacts. The PSF measurement duration is largely limited by the low repetition rate of the three-photon laser and the low efficiency of three-photon excitation (3PE). Due to its higher-order nonlinear excitation, 3PE generates significantly fewer fluorescence photons compared to two-photon excitation (2PE) at the same excitation intensity and pulse energy32,33. This necessitates a longer dwell time at each PSF sampling location during the raster scanning process on a three-photon microscope. Therefore, 2PE is more advantageous for rapid PSF measurement, though it offers less penetration capability in tissue18,34.

In this study, we developed an AO method called multiplexing digital focus sensing and shaping (MD-FSS), combined with two-photon microscopy (2PM), to achieve rapid AO measurement and correction for high-resolution brain imaging in awake mice. Technically, MD-FSS consists of two major innovations: multi-beam interference for fast focal field sensing and digital phase demodulation for parallel measurement of PSF’s complex amplitude. In brief, MD-FSS operates on a similar principle of aberration measurement as ALPHA-FSS17, but remarkably accelerates the PSF measurement speed by simultaneously interfering multiple modulated weak beams, each with small spatial and frequency offsets, with a strong beam. The system detects the phase and amplitude of the modulated interference signals at their corresponding modulation frequencies using multi-channel digital Fast Fourier Transform (FFT) detection. The detected down-sampled E-PSF from each weak scanning beam is then combined to reconstruct a full-sampled PSF without compromising accuracy, enabling rapid and precise wavefront correction through phase conjugation.

When applied to two-photon brain imaging in awake behaving mice, MD-FSS enables accurate measurement of the aberrated PSF that is less affected by motion artifacts owning to a significantly faster sensing process. Through thinned and optically cleared skull windows, methods for near noninvasive optical access to the mouse brain it achieve subcellular resolution at depth. We demonstrated MD-FSS-2PM performance through in vivo subcellular imaging of microglial and microvascular dynamics in the awake mouse brain, revealing distinct morphological and functional differences between awake and anesthetized states. Furthermore, we achieved high-resolution functional imaging of neurons in both somatosensory and visual cortices at depth, with calcium transients in apical and basal dendrites clearly visible after AO correction with MD-FSS. In addition, we captured neurovascular coupling through simultaneous imaging of neuronal activity and blood vessels in multiple cortical regions of the awake, behaving mouse following AO correction.

Results

Rapid Complex-valued E-PSF Sensing via MD-FSS

Briefly, MD-FSS reduces the measurement time for PSF by using beam multiplexing and multi-channel digital FFT demodulation. To measure the aberrated PSF in deep tissue, multiple weak beams with different modulation frequencies and spatial shifts are generated by an acousto-optic deflector (AOD) to interfere with a strong beam in the focal plane (Fig. 1a and Supplementary Fig. S1). The multiple weak beams are then raster-scanned relative to the strong beam simultaneously, and the 2P fluorescence intensity \(I\) at the scanning position \({x}\) is given by:

$$I\left(x,t\right)\propto \,\int O\left({x}^{{\prime} }\right){\left|{E}_{{stat}}\left({x}^{{\prime} }\right)+{\sum }_{i=1}^{N}{E}_{{scan}}^{i}\left(x-\,{x}^{{\prime} }\right){e \, }^{j{\omega }_{i}t}\right|}^{4}d{x}^{{\prime} }$$
(1)
$${E}_{f}^{i}\left(x\right)=\,{A}_{i}{e\,}^{j{\theta }_{i}}\propto \,\int \underbrace{O\left({x}^{{\prime} }\right){\left|{E}_{{stat}}\left({x}^{{\prime} }\right)\right|}^{2}{E}_{{stat}}^{*}\left({x}^{{\prime} }\right)}_{ \delta -{like\; function}}{E}_{{scan}}^{i}\left(x-\,{x}^{{\prime} }\right)d{x}^{{\prime} }$$
(2)
Fig. 1: MD-FSS enables rapid aberration measurement for AO correction through highly turbid medium.
figure 1

a Schematics of the MD-FSS system. The inset illustrates the measurement of aberrated PSF electric field by MD-FSS: Multiple phase-modulated weak focal points are spatially shifted by equal distances to simultaneously probe the electric field. \({E}_{{stat}}\), focal field of strong stationary beam positioned on the guide star; \({E}_{{scan}}\), focal field of the multiple weak scanning beams; \({E}_{{psf}}^{i}\), measured complex-valued PSF of \({i}_{{th}}\) multiplexed beam at down-sampled scanning scheme; \({f}_{n}\), modulation frequency of each weak scanning beam. b Comparison of the measured PSFs using SD-FSS and MD-FSS. Top: Diagram illustrating the focal field and scanning scheme of SD-FSS (left), accompanied by the amplitude (mid) and phase (right) of the full-sampled PSF measured by SD-FSS; Middle: Diagram illustrating the scanning scheme of one down-sampled scanning beam in MD-FSS (left), along with the amplitude (mid) and phase (right) of one down-sampled PSF; Bottom: Diagram illustrating the merging of multiple down-sampled PSFs from all scanning beams (left), along with the amplitude (mid) and phase (right) of the merged full-sampled PSF measured by MD-FSS; ds: down-sampled scanning, full: full-sampled scanning. c, d 2PF image of \(1\,\mu m\) fluorescence beads at a depth of \(400\,\mu m\) through a \(50\,\mu m\) thinned skull, shown without AO correction (left), with SD-FSS AO correction (middle) and with MD-FSS correction (right); Signal intensity with AO correction was enhanced by 50-fold. e Line profile and full width at half maximum (FWHM) measured along the dashed white line in (c) (left) and (d) (right). f Comparison of AO correction result between SD-FSS and MD-FSS on awake behaving Thy1-YFP mouse through a thinned-skull window; Images of neuron dendrites without AO correction (left), with SD-FSS AO correction (middle), and with MD-FSS AO correction (right). g Line profile along the dashed white line in (f). h Measured amplitude and phase of aberrated PSF using SD-FSS (top) and MD-FSS (bottom) in (f) on awake behaving mouse; (i) AO correction phase pattern calculated from PSF in (h), using SD-FSS (top) and MD-FSS (bottom). The results (fi) demonstrate that MD-FSS’s fast measurement speed enables the PSF sensing to be less affected by motion artifacts. Scale bars: \(1\,\mu m\) in (c, d); \(20\,\mu m\) in (f). Figures (a) brain and objective model created using BioRender (https://biorender.com/).

Here, \(O\left({x}^{{\prime} }\right)\) represents the real-valued object function, \({\omega }_{i}\) denotes the modulation frequency of each scanning beam, \(N\) is the total number of weak scanning beams, \({E}_{{stat}}\left({x}^{{\prime} }\right)\) is the complex-valued focal field of the strong stationary beam, and \({E}_{{scan}}^{i}\left({x}^{{\prime} }\right)\) is the complex-valued focal field of the \({i}_{{th}}\) weak scanning beam. By setting the intensity of each scanning beam to be much less than that of the stationary beam (typically,\({\left|{E}_{{stat}}\right|}^{2}/{\left|{E}_{{scan}}^{i}\right|}^{2}=10:1\)), the oscillating components of the 2P fluorescent intensity \(I\) with different modulation frequencies \(\{{\omega }_{i}\}\), can be demodulated using digital FFT detection (See “Methods”, Supplementary Fig. S2). The digital FFT method requires only recording of the modulated fluorescence signal and reference, allowing for the simultaneous output of amplitude and phase components \({A}_{i}\) and \({\theta }_{i}\) for focal field \({E}_{f}^{i}\left(x\right)\) of each weak scanning beam through digital calculation, significantly simplifying the process of multi-frequency demodulation.

The complete aberrated PSF can be reconstructed from the down-sampled PSF of each scanning beam (Fig. 1b), and the value of the restored complete PSF \({\widetilde{E}}_{f}\) at position \({x}_{k}\) can be calculated using the following formula:

$${\widetilde{E}}_{f}\left({x}_{k}\right) ={E}_{f}^{i}\left({x}_{m}\right),k=1,2,3,\ldots,{K;i} \\ ={{mod}}\left(k-1,N\right)+1{;m}={floor}\left[\frac{k-1}{N}\right]+1$$
(3)

Here, \(K\) represents the pixel number of the full-sampled PSF, \(N\) is the total number of weak scanning beams, \({\mathrm{mod}}\) denotes the modulo operator, and \({floor}\) represents rounding to the nearest integer less than the element. With the reconstructed full-sampled PSF, the correction wavefront is generated through phase conjugation by performing the 2D FFT17.

The principle of MD-FSS involves generating multiple weak scanning beams with different phase modulation frequencies and controllable spatial shifts in the focal plane. In this work, we developed a straightforward method to generate the desired multiple scanning beams using an AOD, which diffracts the input beam with applied radio frequency (RF) voltage that determines the frequency and angle of the diffracted beam (see “Methods” and Supplementary Fig. S3). By applying an RF signal with multiple frequencies to the AOD, the light is diffracted into several beams, each with unique frequencies and spatial positions, as determined by the multi-frequency RF signal. In matching the down-sampled scanning scheme, we chose the RF modulation frequencies, ensuring the spatial shift between adjacent scanning beams in the focal plane equals the line distance of the full-sampled scanning scheme. Since AOD is a highly dispersive component, the focus of the diffraction beam is elongated by the angular dispersion, compromising the quality of multi-beam interference. To compensate for the angular dispersion, a single prism-AOD configuration35 was previously used to match the dispersion by adjusting the incidence angle, while another method employing a second AOD36 provided a controllable dispersion value with minimal beam expansion and power loss, though it requires more complex control. For the dispersion compensation in this application, we developed a simpler dual prism configuration method that eliminates power loss and extra complexity, making it both effective and easy to adjust (see “Methods” and Supplementary Fig. S4). In this work, we multiplexed eight weak scanning beams to measure the aberrated PSF, accelerating the process by up to eight times and reducing the measuring time to approximately 0.1 s for one PSF.

With the measured down-sampled PSFs by each of the eight scanning beams, it is essential to calibrate the relative amplitude and phase offsets between adjacent beams for accurate reconstruction of a full-sampled PSF. We developed a calibration method for accurately measuring the relative amplitude and phase (see “Methods”), where the PSFs of each weak beam are measured simultaneously using fluorescence beads as the guidestar without down-sampling. The amplitude ratio lookup table (LUT) is calculated by dividing the mean amplitude of each PSF by that of the first beam’s PSF, while the phase offset LUT is determined by sequentially adjusting the phase map of each PSF and comparing it to the first beam’s phase map, recording the value that yields the best correlation as the correct phase offset for each scanning beam.

To assess the MD-FSS method for measuring the complex-valued E-PSF and correcting aberrations in a turbid medium, we performed an in-vitro experiment imaging stable fluorescent beads through a thinned skull extracted from an adult mouse. Using the fluorescent beads as a guidestar, we simultaneously measured the down-sampled PSF of each scanning beam and merged them, with calibrated relative amplitude and phase offsets, into a full-sampled PSF. For comparison, we used the full-sampled PSF measured with single-beam digital focus sensing and shaping (SD-FSS) as the reference PSF. SD-FSS employs a single scanning beam to interfere with a stationary beam, equivalent to our previously reported ALPHA-FSS17, providing optimal SNR for a stable guide star (Supplementary Fig. S5). We found that the merged PSF from MD-FSS maintained the same SNR as the reference PSF (Fig. 1b and Supplementary Figs. S6a, S7) at the same intensity of the strong beam. Next, we verified MD-FSS performance in correcting skull-induced aberrations compared to SD-FSS (Fig. 1c–e and Supplementary Fig. S6). Before AO correction, the PSF was severely distorted into numerous small side lobes due to the highly turbid skull. After AO correction using MD-FSS, the signal intensity increased by 50-fold, restoring the PSF to near diffraction-limited quality without side lobes. With remote focusing and the conjugation between the spatial light modulator (SLM) and the skull layer17, the correction area achieved a field of view (FOV) of approximately \(150\,\mu m\) in the lateral direction and \(300\,\mu m\) in the axial direction (Supplementary Fig. S6e, f). Quantitatively, MD-FSS matched SD-FSS in improvements to resolution and signal intensity, while requiring only one-eighth of the measurement time, significantly accelerating the AO measurement process.

With the in-vitro experiment showcasing MD-FSS’s performance on a stable fixed sample, we next evaluated its capabilities in measuring the aberrated PSF through the thinned skull in awake, behaving mice, where motion artifacts are significant. The thinned skull thickness was maintained above 30 µm to ensure mechanical stability of the cranial window while maintaining a noninvasive approach to brain imaging. We prepared the brain imaging window by securely gluing a metallic headplate to the skull using dental cement and fixing it to a holder with metal screws. Despite careful preparation to prevent looseness, the mouse’s movements caused frequent rapid shifts within the imaging FOV, consistent with previous findings26,27,28,29,30 (Supplementary Video S1, 2). MD-FSS’s fast AO measurement speed enabled accurate measurement of the complex-valued aberrated PSF in awake behaving mice, with the derived correction wavefront significantly enhancing both fluorescence intensity and imaging resolution. In contrast, SD-FSS’s longer measurement time led to motion-deteriorated PSF, resulting in a correction wavefront that failed to enhance signal intensity and even introduced additional aberrations degrading imaging quality (Fig. 1f–i, Supplementary Fig. S8 and Supplementary Video S1, 2). The results revealed that SD-FSS’s PSF measurement errors in awake, behaving mice primarily arose from off-target motion of the guide star relative to the strong stationary focus, causing fluorescence loss during raster scanning interference signal detection. Under anesthesia, the cessation of motion allowed both MD-FSS and SD-FSS to accurately measure the aberrated PSF, remarkably improving signal intensity and imaging resolution (Supplementary Fig. S8), proving that MD-FSS is essential for in vivo brain imaging of awake mice. In the following section, we present MD-FSS applications for high-resolution imaging of cell morphology and function in the awake, behaving mouse brain, achieved in a near noninvasive manner.

It should be pointed out that although the principle of MD-FSS is theoretically applicable to three-photon microscopy, its practical use for rapid AO measurement is limited by the low repetition rate, low nonlinear absorption coefficient, and significantly higher water absorption of the 3P laser32,33. We experimentally verified that due to the weak fluorescence intensity of 3PE, it inherently requires a longer dwell time to achieve the same quality of measured PSF as 2PE for AO correction17,34. In this study, we focus on implementing MD-FSS-2PM and show its effectiveness for rapid measurement of aberrated E-PSF, as well as for correcting both aberrations and scattering in vitro and in vivo in deep tissue imaging.

MD-FSS Enables near noninvasive microglial imaging in awake behaving mice

Having demonstrated the unique capabilities of MD-FSS for rapid and accurate aberration measurement through theoretical analysis and experiments, we investigated its performance in vivo for structural and functional imaging of microglia in awake, behaving Cx3Cr1-GFP mice through thinned skull (Fig. 2, Supplementary Figs. S912). Microglia, the major immune cells in the central nervous system (CNS), are highly dynamic and sensitive to their surrounding physiological environment37,38. While mice were freely moving on a treadmill, we measured the aberrated PSF in deep tissue using MD-FSS and applied corresponding corrections (Fig. 2b–e). The results show that before AO correction, aberrations severely blurred the fine structures of microglia, revealing only an indistinct soma, but after correction, microglial processes became clearly visible with significantly enhanced signal intensity (Fig. 2b–d and Supplementary Figs. S911). To investigate microglial morphology and physiological dynamics in their natural state, we performed time-lapse imaging with AO correction in awake, behaving mice, then anesthetized the mice and repeated the imaging with AO correction (Fig. 2g–k and Supplementary Fig. S9). The high-resolution images enabled detailed analysis of microglial morphological characteristics in both states. We found that under anesthesia, microglia became more ramified, with processes expanding upon isoflurane administration and reaching larger areas compared to the awake state (Fig. 2i–k, Supplementary Fig. S9e, f and Supplementary Video S3). These distinct differences in microglial morphology and behavior between awake and anesthetized states20,21 demonstrate that anesthesia, commonly used in in vivo imaging, can substantially alter cellular properties of microglia.

Fig. 2: In vivo high-resolution imaging of microglia morphology and dynamics in brain of awake behaving mouse.
figure 2

a Schematics of MD-FSS-2PM in the brain cortex of awake behaving Cx3Cr1-GFP transgenic mouse. b MIP images of GFP-labeled microglia within a volume at a depth of \(335-395\,\mu m\) below pia, shown without (left) and with (right) MD-FSS AO correction. c Zoom-in views of regions in (b) marked by an orange dashed box. d Intensity profiles along the blue dashed lines (left) and pink dashed lines (right) in (b) without and with AO correction. e Correction phase pattern calculated from the PSF measured by MD-FSS. f Timeline of MD-FSS-2PM imaging from awake to anesthetized states. g MIP images of GFP-labeled microglia in the same volume as (b) from an awake behaving mouse (left) and after 54 min of isoflurane anesthesia (right). h Extracted morphological dynamics of microglia in the awake state (left) and anesthetized state (right) within the region indicated by the orange dashed rectangle in (g); Red: reference microglial structure 54 min before (left) and at 0 min before (right) isoflurane administration; green: microglia morphology at 0 min before (left) and 54 min after (right) isoflurane administration. i Statistical analysis of the microglia ramification index in the awake and anesthetized states (Data were represented as mean ± SD, Two-sided Paired t test, \(\alpha=0.05\), N = 5 different microglia traced in awake (Awake) and isoflurane-anesthetized state (Iso) from 3 mice, **p < 0.01, p = 0.0084). j Statistical analysis of process area changes before and after isoflurane administration (Data were represented as mean ± SD, N = 3 microglia from 3 mice); Blue region: duration of isoflurane administration. k Sholl analysis of microglial morphology in awake behaving mouse and anesthetized mouse (Data were represented as mean ± SD, N = 4 microglia from 3 mice). Awake: awake state; Iso: anesthetized by isoflurane. Scale bars: \(20\,\mu m\) in (b and g); \(10\,\mu m\) in (c and h). Figures (a, f) created using BioRender (https://biorender.com/).

To further investigate microglial dynamics in the awake state, we performed time-lapse imaging following lipopolysaccharide (LPS) injection, which induces global inflammation in the mouse brain39,40,41,42. The enhanced resolution from AO correction allowed a clear distinction of microglial processes and soma, enabling tracking of their dynamic properties after LPS injection. As shown in Supplementary Fig. S11 and Supplementary Video S4, microglia exhibited activated morphology with significantly reduced process length following LPS injection, consistent with previous observations40,41. Through dual-color imaging of microglia and blood vessels, we observed microglial migration toward blood vessels in the awake state after LPS injection (Supplementary Fig. S12a–f), aligning with previous studies on LPS effects on the blood-brain barrier (BBB)40. The high resolution in blood vessel imaging after AO correction enabled precise vessel diameter measurements (Supplementary Fig. S12g–i), revealing post-LPS increases consistent with previous findings42.

Lastly, we performed MD-FSS-2PM imaging through an optical clearing window. Optical clearing is another near noninvasive method for transcranial imaging that chemically increases mouse skull transparency to provide optical access to the brain43. Despite increased skull transparency, aberrations from the thick optical clearing skull still severely distort the excitation wavefront, leading to blurred imaging of fine structures in deep tissue. To verify MD-FSS performance with a different optical window, we applied MD-FSS-2PM imaging through an optical clearing window to correct aberrations and restore subcellular resolution in awake, behaving Cx3Cr1-GFP mice. As shown in Supplementary Fig. S13, microglial processes were clearly visualized after AO correction at different depths, demonstrating that MD-FSS works effectively with both thinned-skull and optical clearing windows. For subsequent studies, we focused on using the thinned-skull window.

High-resolution calcium imaging of neuronal activity in awake behaving mouse

Neuronal activity substantially depends on physiological state and is disrupted by anesthesia23,24,25, highlighting the need to investigate neurons in awake animals. Calcium imaging, which reflects neuronal activity transients, is a common method for studying neuronal function44. We tested MD-FSS-2PM for high-resolution calcium imaging of GCaMP6s-expressing neurons in layers 2/3 and 4 of the somatosensory and visual cortices through thinned skull in awake behaving mice (Fig. 3). In the somatosensory cortex during whisker stimulation, images before AO correction showed blurred soma contours and indistinguishable fine apical dendrites (Fig. 3b). The extracted calcium transients displayed poor signal intensity and low SBR (Fig. 3e). After MD-FSS AO correction (Fig. 3d), neuronal soma borders and lateral dendrites became clearly resolved, with greatly restored apical dendrite details (Fig. 3b and Supplementary Video S5, 6). Calcium transients during whisker stimulation showed significantly improved signal intensity and strong synchronization with stimulation after AO correction (Fig. 3e). Line profiles across identical apical dendrites before and after AO correction revealed substantial resolution enhancement (Fig. 3c). While calcium transients from dendrites could be extracted from AO-corrected images as somas, measurement of these important signals in uncorrected images was impossible due to poor resolution.

Fig. 3: Calcium imaging of neuron somas and dendrites in somatosensory and visual cortices of awake behaving mice.
figure 3

a Schematic of MD-FSS-2PM imaging in somatosensory cortex during whisker stimulation in awake behaving CaMKII-GCaMP6s transgenic mice. b Standard deviation (STD) projection images of GCaMP6s-labeled neurons recorded over 120 s at \(280\,\mu m\) (top) and \(365\,\mu m\) (bottom) below pia, without (left) and with (right) AO correction. c Intensity profiles along orange dashed lines in (b) at \(280\,\mu m\) (top) and \(365\,\mu m\) (bottom). d PSF amplitude (top) and AO correction phase pattern (bottom) in (b). e Calcium transients from neuronal dendrites marked by white arrowheads 1 (left), 2 (middle) and 3 (right) in (b). Blue bars: whisker stimulation periods. f Schematic of MD-FSS-2PM imaging in visual cortex during visual stimulation in awake behaving CaMKII-GCaMP6s transgenic mice. g STD projection images of GCaMP6s-labeled neurons recorded over 160 s at \(230\,\mu m\) below pia, without (left) and with (right) AO correction. h Calcium transients at preferred grating orientation from dendrites and soma marked by arrowheads 1 (left) and 2 (right), without and with AO correction. Blue bars: visual stimulation periods. i Orientation polar maps of dendrites and soma marked by arrowheads 1 (top) and 2 (bottom) after AO correction. j Calcium transients from dendrites and soma marked by arrowheads 1 (left) and 2 (right) during visual stimulation at different orientations with AO correction. Gray curves: raw calcium transients from multiple trials (N = 10) of random orientations; red curves: averaged calcium transients; gray dashed lines: visual stimulation timestamps; black arrowheads: stimulation orientations. k Orientation tuning curves with Gaussian fits from regions marked by arrowheads 1 (left) and 2 (right) in (g) after AO correction. Scale bars: \(20\,\mu m\) in (b, g). Figures (a, f) created using BioRender (https://biorender.com/).

Using the inertia-free remote focusing module for depth adjustment and the extensive axial correction range of conjugate AO17,45, we achieved quasi-simultaneous multi-plane neuronal imaging by rapidly switching the electrically tunable lens (ETL) defocus with synchronized deformable mirror correction patterns (Supplementary Fig. S14, 15 and Supplementary Video S7, 8). Multi-plane imaging enabled investigation of correlated neuronal activity along the axial direction46,47,48,49. As shown in Supplementary Fig. S14 and S15, without AO correction, fine structures were invisible across all three imaging layers. After AO correction, apical dendrites and their corresponding soma became clearly distinguishable with high resolution and SBR. Analysis of calcium transients revealed synchronized activity between apical dendrites and soma during whisker stimulation (Supplementary Fig. S15e–g).

Next, we performed high-resolution imaging of neuronal dendrites and somas in the visual cortex during visual stimulation in awake mice. A liquid-crystal display (LCD) screen positioned 15 cm from the mouse’s eye displayed moving gratings at various angles, synchronized with image acquisition (see “Methods”). The improved imaging contrast and resolution after AO correction enabled precise localization of fine apical dendrites and somas, and extraction of calcium transients during visual stimulation (Fig. 3g, h and Supplementary Video S9). Analysis of neuronal responses to moving gratings identified direction-selective neurons and their dendrites (Fig. 3i–k), highlighting specialized neuronal functions50,51.

Imaging of microvascular hemodynamics and neurovascular coupling (NVC)

The microvascular system, a crucial component of brain cortex, supplies oxygen and nutrients to neurons while removing waste, playing an essential role in brain function and health52,53,54. Microvascular hemodynamics closely relate to the brain physiological state and are strongly influenced by anesthesia55,56. To study microvascular hemodynamics in the natural conditions of the brain, we imaged capillaries in awake mice using MD-FSS-2PM. After AO correction, fine capillary structures were well resolved (Fig. 4a, b), with line profiles demonstrating greatly improved resolution (Fig. 4c). The enhanced image quality enabled red blood cell (RBC) velocity measurements in brain capillaries of awake behaving mice using line-scan imaging, with velocity calculated from line scan kymographs using Radon transform algorithm57. We repeated these measurements after isoflurane anesthesia. Statistical analysis showed increased RBC velocity in the same capillaries during anesthesia (Fig. 4d, e), confirming isoflurane’s influence on cerebrovascular hemodynamics55.

Fig. 4: MD-FSS-2PM imaging of microvascular hemodynamics and neurovascular coupling in awake behaving mice.
figure 4

a MIP image of Texas Red-labeled blood vessels in the volume at depth of \(270-310\,\mu m\) (top) and \(320-360\,\mu m\) (bottom) below pia without (left) and with (right) AO correction on awake behaving mouse. b Kymographs of line scan images along the blue dashed lines in the second row of (a), shown without (left) and with (right) AO correction. c Intensity profiles along the white dashed lines in the second row of (a) without and with AO correction. d Kymographs of line scan images of microvasculature on awake behaving mouse (left) and isoflurane-anesthetized mouse (right) along the blue dashed lines in the first row of (a) after AO correction. e Statistical analysis of red blood cell (RBC) velocity on awake behaving mouse and isoflurane-anesthetized mouse. (Data were represented as mean ± SD, Two-sided Paired t test, \(\alpha=0.05\), N = 17 different capillaries traced in awake (Awake) and isoflurane-anesthetized state (Iso) from 3 mice, ****p < 0.0001, p = 0.000001242). f Two-color merged images of STD projection images of GCaMP6s-labeled neurons over a 120 s recording and one frame images of Texas Red-labeled blood vessels during whisker stimulation at a depth of \(300\,\mu m\) below pia, shown without (left) and with (right) MD-FSS AO correction. g Left: Calcium transients extracted from the dendrites indicated by the white arrowhead in (f). Right: Diameter changes of penetrating arteriole (PA) marked by orange arrowhead in (f); blue stripe: whisker stimulation ON time. h Averaged traces of calcium transients of dendrites and PA diameter changes over 12 trials of whisker stimulation without (top) and with (bottom) AO correction; Blue stripe: whisker stimulation ON time. i Two-color merged images of STD projection images of GCaMP6s-labeled neurons over a 160 s recording and one frame images of Texas Red-labeled blood vessels during visual stimulation at a depth of \(250\,\mu m\) below pia without (top) and with (bottom) MD-FSS AO correction. j Measured PSF amplitude (top) and AO correction phase pattern (bottom) in (i). k Top: Calcium transients in response to visual stimulation at different orientations of dendrites marked by white arrowhead in (i) after AO correction; Bottom: Changes in PA diameter in response to visual stimulation at different orientations marked by orange arrowhead after AO correction; Gray curve: raw traces from multiple trials (N = 10) of random visual stimulation orientations; Red curve: averaged trace stimulated by different orientations; Gray dashed lines: timestamps of visual stimulation; Black arrowhead: orientation of visual stimulation. l Top: Orientation polar map of neuron dendrites indicated by white arrowhead in (i); Bottom: Orientation polar map of PA diameter marked by orange arrowhead in (i). Awake: awake state; Iso: anesthetized by isoflurane. Scale bars: \(20\,\mu m\) in (a, f and i); \(10\,\mu m\) in (b) and (d).

Neurovascular coupling (NVC), the modulation of cerebral blood flow (CBF) in response to regional neuronal activity, involves coordinated interactions between neurons and local vascular circulation crucial for supporting brain function58,59,60. To visualize neurovascular responses to stimulation in deep cortical regions, we performed multi-color imaging of neuronal activity and vascular dilation in the somatosensory cortex of awake mice. After AO correction, fine neuronal dendrites and penetrating arteriole (PA) outlines became clearly distinguishable (Fig. 4f and Supplementary Video S10), enabling accurate and sensitive monitoring of neuronal activity and local vascular dynamics. Both dendritic calcium transients and PA dilation traces showed significant enhancement with AO correction (Fig. 4g, h). The averaged traces during whisker stimulation revealed close coupling between dendritic neuronal activity and PA diameter (Fig. 4h). Due to poor imaging resolution, pre-AO correction traces showed significantly reduced sensitivity to stimulation in both neuronal activity and PA diameter changes compared to post-AO correction (Fig. 4h), demonstrating the necessity of MD-FSS AO correction for accurate NVC measurements. Furthermore, we conducted simultaneous multi-color imaging of neurons and blood vessels in the visual cortex during visual stimulation. AO correction greatly enhanced imaging resolution and intensity for both neurons and blood vessels (Fig. 4i, j and Supplementary Video S11). Analysis of synchronized dendritic calcium activity and PA diameter responses to directional visual stimulation revealed a strong correlation between PA diameter and dendritic calcium responses (Fig. 4k). While the neuronal response was strongly direction-selective, PA dilation showed no significant directional selectivity in response to visual stimulation (Fig. 4l), suggesting that individual PAs may support multiple neurons with different directional preferences.

Discussion

In this study, we demonstrated that near noninvasive and high-resolution imaging in the awake, behaving mouse brain is critical for neuroscience research, as it avoids both brain inflammation and the confounding effects of anesthesia on cellular behavior and biological mechanisms. The major challenges that must be resolved are the aberrations and scattering from highly scattering media like the skull that severely distort excitation light, necessitating wavefront correction to restore image quality. Adaptive optics correction in awake mice presents an additional challenge, requiring rapid measurement to overcome motion artifacts from guidestars moving with brain tissue. We developed MD-FSS, a fast adaptive optics method for high-speed measurement of the aberrated complex-valued PSF, that effectively measures and corrects aberrations. This method enables high-resolution deep-tissue imaging through both thinned-skull and optical clearing windows in the awake mouse brain.

MD-FSS enables rapid and precise PSF measurements for correcting aberrations and scattering in awake mouse brains, achieving a 0.1 s measurement time while maintaining the same SNR and signal enhancement as single beam methods under stable conditions. Unlike single-beam approaches that fail due to motion artifacts (Fig. 1f and Supplementary Fig. S8), MD-FSS ensures accurate full-sampled PSF reconstruction through stable amplitude and phase calibration of multiplexed weak scanning beams. The enhanced correction enables visualization of previously unresolvable features: microglial processes, red blood cells in finest microvessels, and calcium transients in neuronal dendrites, allowing simultaneous observation of microglia dynamics, microvascular circulation, neuronal activities in soma and dendrites, and neurovascular coupling in awake mice - critical measurements previously impossible without rapid aberration correction. While our current eight-beam implementation achieves 0.1 s PSF measurements, the method can scale to more beams for faster acquisition, requiring only proportional increases in RF frequency channels and sampling rates. We have observed that AODs have been used to generate a large number of beams, ~100, with different modulation frequencies to produce constructive interference in multi-beam speckles61. These collimated beams interact with the scattering medium to extract the necessary phase information for constructive coherence. This application strongly supports the potential to further accelerate the speed of PSF sensing, as our method is based on similar principles of multi-beam generation. To fully realize this potential, however, careful consideration must be given to the control of the driving signal, the total power of all weak beams and strong beams delivered to biological tissue, and the overall system transmission.

Methods

Configuration of MD-FSS-2PM system

A detailed schematic diagram of the MD-FSS-2PM system is presented in Supplementary Fig. S1. The excitation light source is a femtosecond laser with a bandwidth-limited pulse duration of 150 fs and a repetition rate of 80 MHz (Coherent, Axon 920). The internal dispersion compensation unit of the laser is adjusted to counteract system dispersion, compressing the pulse duration to 150 fs after the objective. The excitation laser is then directed through a pair of 4 f relay lenses to expand the beam size, matching the aperture of an AOD (AA Optics, DTXS-400-920). The expanded beam is next directed to pass through the AOD. A high-power multi-frequency RF driver (MPDS8c, AA Opto-electronic) transmits an RF signal with multiple frequency components to the AOD, generating multiple 1st order diffraction beams with different frequency offsets and angular separations. The 0th beam and the 1st order diffraction beams were utilized as the strong stationary beam and the weak scanning beams, respectively. The 0th beam is then passed through a pair of 4 f relay lenses (L1: \(f\) = 300 mm, L2: \(f\) = 300 mm), and an optical delay line DL is inserted into the arm of the 0th beam after the 4 f relay lenses to adjust the time delay between 0th beam and 1st beam for efficient interference. The scanning beams are directed through dual prisms PRM1 and PRM2 at a Brewster angle of incidence for compensation of angular dispersion. A pair of 4 f relay lenses (L3: \(f\) = 300 mm, L4: \(f\) = 300 mm) is placed after the dual prisms for expanding the beam to match the aperture size of an x-y galvo scanning mirror GM1xy, keeping the aperture plane of the AOD conjugated to the scanning mirror plane. The stationary beam and the scanning beams are then combined using a polarized beam splitter (PBS) and expanded by a pair of 4 f relay lenses (L5: \(f\) = 40 mm, L6: \(f\) = 150 mm) to slightly overfill the aperture of the deformable mirror (DM97-15, Alpao), which is used to correct system aberrations based on a sensorless AO method11. A rotatable half-wave plate and a PBS are placed before the DM to control the intensity ratio and ensure that the polarization of the stationary beam matches that of the scanning beams for efficient interference. The DM is conjugated to a 3 mm x-galvanometric scan mirror GM2x using a pair of 4 f relay lenses (L7: \(f\) = 200 mm, L8: \(f\) = 40 mm), which resizes the beam to fit the scanner’s aperture. The x and y scanners (GM2x, GM2y) are mutually conjugated by a pair of 4 f relay lenses (L9, L10: \(f\) = 50 mm), each consisting of two achromatic doublets (\(f\) = 100 mm) in a Plössl configuration. The y-scanning mirror is conjugated to an electrically tunable lens (ETL) via the scan lens L11 (\(f\) = 36 mm) and the tube lens L12 (\(f\) = 200 mm). Subsequently, the ETL is conjugated to the back aperture of a high numerical aperture (NA) objective (XLPLN25XWMP2, Olympus) using a pair of achromatic doublets (L13: \(f\) = 222 mm and L14: \(f\) = 150 mm). A phase-only spatial light modulator (SLM) is positioned approximately 80 mm after L13 and is conjugated to the skull plane through a 4 f optical system consisting of L14 and the objective lens. The beam diameter entering the back aperture of the objective is approximately 10 mm, resulting in an excitation numerical aperture (NA) of ~0.7. The objective is mounted on a motorized actuator to enable translation along the optical axis. The emitted fluorescence is collected by the same objective and directed to the photo-detection unit via dichroic mirror DCM1 (FF705-Di01-25 × 36, Semrock). A dichroic mirror DCM2 (F556-SDi01-25 × 36, FF495-Di03-25 × 36, Semrock) is placed after DCM1 to separate fluorescence with different colors for dual-color imaging. A suitable band-pass filter, along with a short-pass filter, is placed before the photomultiplier tube (PMT; H5783, H7422, Hamamatsu) module to selectively detect the SHG/Texas Red and GFP/YFP/GCaMP6s signals. The current signal from the PMT is converted to a voltage signal using a transimpedance current amplifier (DHCPA-100, Femto; SR570, Stanford Research). For 2 P imaging, only the stationary beam is directed to the sample while the scanning beams are blocked. Galvanometric scanning mirrors GM2x and GM2y are employed for lateral scanning. ETL is used to adjust the imaging depth. The excited fluorescence signal is digitized at a sampling rate of 2 MHz using a high-speed data acquisition card (PXIe-6363, NI Instrument). The microscope control software is custom-written in C#.

Multi-beam generation and multi-frequency phase modulation

The core principle of MD-FSS is based on generating multiple scanning beams, with each beam undergoing linear phase modulation at a distinct frequency to ensure that adjacent beams are spatially separated with the line distance of the full-sampled PSF. An AOD can serve as a beam deflector, diffracting the input beam to the 1st order angle of diffraction. An RF signal with components of multiple frequencies can be applied to the AOD, simultaneously generating multiple first-order diffraction beams, each corresponding to a specific RF frequency61. The multi-frequency RF signal \({V}_{{RF}}\) for \(N\) beam generation can be represented as:

$${V}_{{RF}}={\sum }_{i=1}^{N}{V}_{i}\cos \left(2\pi {f}_{i}t\right)$$
(4)

Where \({f}_{i}\) is the \({i}_{{th}}\) beam modulation frequency in the RF signal, \({V}_{i}\) is the amplitude of frequency components \({f}_{i}\). With the applied RF signal, the diffraction angle \({\theta }_{i}\) for each scanning beam can be expressed as:

$${\theta }_{i}=\,\frac{\lambda {f}_{i}}{{v}_{a}}$$
(5)

Here, \(\lambda \) represents the beam wavelength, and \({v}_{a}\) denotes the acoustic velocity in the acousto-optic crystal. Thus, the diffraction angle of each scanning beam is determined by its respective modulation frequency \({f}_{i}\). Since the spatial distance between the foci of adjacent scanning beams must match the line distance of the full-sampled PSF, the frequency distance should be calculated based on the sampling distance in the focal field. The relationship between the diffraction angle and the sampling distance \(\Delta x\) can be expressed as:

$$\Delta {\theta }_{i}=M\Delta x$$
(6)

Where \(M\) represents the scaling factor between the AOD and the focal field, as determined by the magnification of the designed system. Linear phase modulation is automatically achieved by applying \({V}_{{RF}}\), as the AOD functions as a frequency shifter, adding or reducing the optical frequency of the 1st order diffracted beam by \({\omega }_{i}=2\pi {f}_{i}\). Therefore, the phase modulation of each diffracted beam can be expressed as:

$$\Delta {\phi }_{i}=\,2\pi {f}_{i}t$$
(7)

The wave function of each scanning beam can be expressed as:

$${E}_{{scan}}\left(t\right)=\,{A}_{i}{e \, }^{j\Delta {\phi }_{i}}{e \, }^{j{\omega }_{c}t}$$
(8)

Where \({A}_{i}\) is the amplitude of each scanning beam and \({\omega }_{c}\) is the optical frequency of the input beam. In this manner, each scanning beam is phase-modulated at a different frequency \({f}_{i}\), and is equally shifted in space at the focal field. In the present study, we generated 8 weak beams in the 1st diffraction order simultaneously, mainly limited by the number of channels of our commercial AOD RF driver. There are other factors that limits the number of beams to be generated: the restricted RF bandwidth of the AOD, which affects the number of diffracted first-order beams; the deviation from Brewster’s incidence angle for angular dispersion compensation as the number of weak beams increases, resulting in reduced PSF measurement accuracy; the decrease in maximum system transmission with an increasing number of beams; and the maximum safe power threshold for biological tissue, which restricts the total number of weak beams to prevent potential tissue damage.

Multi-frequency phase and amplitude detection based on digital FFT

The detailed flowchart for the digital FFT demodulation process is illustrated in Supplementary Fig. S2. By leveraging the periodic properties of the two-photon femtosecond pulse train, the interference signal between the strong beam and the phase-modulated weak beams can be considered as being sampled at the repetition frequency of the femtosecond laser17, which can be expressed as:

$$I\left(x,\,t\right)={\sum }_{-\infty }^{+\infty }\delta \left(t-\frac{k}{{f}_{{rep}}}\right)\cdot \left[\int {\left|{E}_{{stat}}\left({x}^{{\prime} }\right)+{\sum }_{i=1}^{N}{E}_{{scan}}^{i}\left(x-{x}^{{\prime} }\right){e \, }^{j2\pi {f}_{i}t}\right|}^{4}d{x}^{{\prime} }\right]$$
(9)

Where \({f}_{{rep}}\) is the repetition frequency of the femtosecond pulse train, \({f}_{i}\) is the modulation frequency of the \({i}_{{th}}\) scanning beam and \(N\) denotes the number of multiplexed scanning beams. Using a high-order expansion approximation, the modulated fluorescence intensity of each scanning beam in the frequency domain can be represented as the convolution of a periodic frequency comb with the corresponding modulation frequency peak after taking the Fourier transform. Therefore, the available demodulation frequencies for the \({i}_{{th}}\) scanning beam can be expressed as:

$${f}_{{demo}}^{i}=\,{f}_{{modu}}^{i}-k{f}_{{rep}},\,k=0,1,2,3...$$
(10)

The exact modulation frequency \({f}_{{modu}}^{i}\) of each beam is included among the available demodulation frequencies with \(k=0\). Given that \({f}_{{modu}}^{i}\) is the RF frequency applied to the AOD and is approximately 80 MHz as specified by the center frequency of AOD, a minimum sampling frequency of 160 MHz is necessary to adequately capture this high-frequency signal. This requirement increases the demands on the sampling device and the size of the acquired data. A more practical approach is to demodulate using the wrapped signal within the available frequencies17. By setting the modulation frequency equal to the sum of the repetition frequency and a small offset frequency \(\Delta {f}^{i}\), we have:

$${f}_{{modu}}^{i}=\,{f}_{{rep}}+\Delta {f}^{i}$$
(11)

Thus, the demodulation frequency can be calculated as follows:

$${f}_{{demo}}^{i}=\,{f}_{{modu}}^{i}-\,{f}_{{rep}}=\,\Delta {f}^{i}$$
(12)

In this study, we selected the frequency offset list \(\{\Delta {f}^{i}\}\) starting with a value of \(476{kHz}\) and a frequency interval of \(51{kHz}\) to ensure equal spatial shift of \(0.25\,\mu m\) (Supplementary Fig. S3). In this manner, the modulation frequency starts at \({f}_{{modu}}^{i}=80.864{MHz}\) with an increase step of \(51{kHz}\), given the laser repetition frequency \({f}_{{rep}}=\,80.388{MHz}\).

The modulated fluorescence signal is then sampled using a high-speed data acquisition card (PXIe-5170R, NI Instrument) and recorded on a computer for analysis. By applying Fast Fourier transform to the recorded fluorescence signal, the frequency spectrum at modulated frequencies \({\omega }_{i}\) can be represented as:

$${\widetilde{I}}_{{sig}}\left(x,{\omega }_{i}\right)=\,{{{\mathcal{F}}}\left\{{I}_{{sig}}\left(x,t\right)\right\}}_{{\omega }_{i}}\propto {A}_{{sig}}\left(x,{\omega }_{i}\right){e \, }^{j{\varphi }_{{sig}}\left(x,{\omega }_{i}\right)}$$
(13)

The mix of the RF modulation signals and the laser synchronization signal is recorded simultaneously as the reference for digital FFT demodulation. By applying Fast Fourier transform to the reference signal, the amplitude and phase at each demodulation frequency \({\omega }_{i}\) can be extracted as:

$${\widetilde{V}}_{{ref}}\left(x,{\omega }_{i}\right)=\,{{{\mathcal{F}}}\left\{{V}_{{ref}}\left(x,t\right)\right\}}_{{\omega }_{i}}\propto {A}_{{ref}}\left(x,{\omega }_{i}\right){e \, }^{j{\varphi }_{{ref}}\left(x,{\omega }_{i}\right)}$$
(14)

The complex electric field of the \({i}_{{th}}\) scanning beam can then be computed as:

$${E}_{{PSF}}^{i}\left(x\right)\propto \, {A}_{{sig}}\left(x,{\omega }_{i}\right){e \, }^{j[{\varphi }_{{sig}}\left(x,{\omega }_{i}\right)-{\varphi }_{{ref}}(x,{\omega }_{i})]}$$
(15)

Since the recorded signal and reference contain information of all the scanning beams, the complex-valued PSF of each scanning beam can be calculated directly in the frequency domain.

AOD Dispersion compensation

The AOD crystal introduces significant dispersion in both the stationary and scanning beams, which must be compensated for optimal performance in multi-beam interference. The temporal dispersion is counteracted by the build-in dispersion compensation unit of the laser. Since the diffraction angle of the 1st order beam is linearly dependent on the wavelength and inversely proportional to the acoustic speed in the crystal, only the scanning beam experiences angular dispersion from the AOD. To compensate for the angular dispersion of the scanning beams, dual prisms are positioned after the AOD at the Brewster angle of incidence, with beam size magnification of 1 and maximum transmission (Supplementary Fig. S4). The distance between the dual prisms and the AOD is minimized to prevent the introduction of additional temporal dispersion in the scanning beam. Each prism compensates for a portion of the total angular dispersion, ensuring that the final residual angular dispersion is minimized.

Frequency calibration of RF driving signal on AOD

A calibration lookup table (LUT) is necessary to determine the exact frequency distance that corresponds to a specific spatial distance, and the calibration method is illustrated in Supplementary Fig. S3. Initially, a list of RF frequencies \(\{f\}\) near the most efficient working frequency \({f}_{c}\) of the AOD is selected and applied to the AOD in sequence. The scanning beam is then utilized to image a singular fluorescent bead at each applied frequency using GM1xy, with the stationary beam blocked. For each applied frequency in the frequency list \(\{f\}\), a fluorescence image is recorded. Finally, the center of mass of the fluorescent bead in each recorded image is calculated and fitted with a linear function \(y={af}+b\), given that \(f\) is the modulation frequency corresponding to each image. The spatial scan distance per RF driving frequency is determined by the coefficient \(a\). In this work, we have \(a=-4.903\,\mu m/{MHz}\), resulting in a modulation frequency distance of \(51{kHz}\) between adjacent scanning beams with \(0.25\,\mu m\) spatial offset in the focal plane.

Phase and amplitude calibration between multiplexed scanning beams

The relative phase and amplitude between the multiplexed scanning beams must be precisely calibrated for accurate reconstruction of a full-sampled PSF. First, the PSF of each scanning beam is acquired simultaneously without down-sampling when a multi-frequency RF signal is applied. To determine the relative phase, the PSF of one scanning beam is selected as the reference PSF, and a list of phase offsets \(\{\Delta {\varphi }_{i}\}\) is sequentially added to the phase map of other PSFs, represented as:

$${\widetilde{\varphi }}_{i}\left(x\right)=\,{\varphi }_{i}\left(x\right)+\Delta {\varphi }_{i}$$
(16)

Where \({\varphi }_{i}\) is the measured PSF phase map of the \({i}_{{th}}\) scanning beam, and \(\Delta {\varphi }_{i}\) is the phase offset added to the raw phase map. The correct phase offset \(\Delta {\varphi }_{i}\) is determined by maximizing the correlation between the raw phase map \({\varphi }_{i}\) and the adjusted phase map \({\widetilde{\varphi }}_{i}\). The calibration of amplitude is calculated by dividing the mean amplitude of the reference PSF to that of each scanning beam PSF, expressed as:

$${\eta }_{i}=\,\frac{\overline{{A}_{{ref}}\left(x\right)}}{\overline{{A}_{i}\left(x\right)}}$$
(17)

Using the amplitude ratio \({\eta }_{i}\), the adjusted amplitude of each PSF is then calculated as:

$${\widetilde{A}}_{i}\left(x\right)=\,{\eta }_{i} * {A}_{i}\left(x\right)$$
(18)

With the calibrated LUT of amplitude and phase, the complex-valued electric field of each scanning beam can be expressed as:

$${\widetilde{E}}_{{PSF}}^{i}\left(x\right)=\,{\widetilde{A}}_{i}\left(x\right){e \, }^{j{\widetilde{\varphi }}_{i}\left(x\right)}$$
(19)

Scanning scheme and configuration of PSF sensing

The complex-valued PSF is measured by raster scanning multiplexed weak beams against a strong, stationary beam. To determine the optimal position for parking the strong beam, the brightest point of a guide star, such as a cell body or thick neuronal dendrite, is selected. Once the strong beam is positioned at this location, simultaneous scanning of the multiple weak beams is performed for rapid measurement of the PSF. During the scanning process, multiple weak beams are simultaneously scanned in both the x and y directions within a small designated region (e.g., 12 µm × 12 µm), with the strong beam positioned near the center. In the x-direction, all weak beams are scanned together across the full range, with a one-pixel separation between adjacent lines, producing multiple x-lines sampled at a predetermined number of pixels (e.g., 48 x-pixels) and a specified pixel dwell time (e.g., 0.4 ms). Since the weak beam foci are arranged in the y-direction and scanned simultaneously, a single x-scan generates multiple x-lines at different y-positions, so scanning in the y-direction only requires a down-sampled set of pixels, specifically, Nbeam-fold fewer pixels than in the x-direction (e.g., 48/8 = 6 pixels for 8 beams). This strategy enables the acquisition of information equivalent to a fully sampled PSF (e.g., 48 × 48 pixels) using a down-sampled scan (e.g., 48 × 6 pixels).

The measurement time for each PSF sensing is calculated as the pixel dwell time multiplied by the total number of pixels (or spatial modes), divided by the number of multiplexed beams. In the default configuration of this study, we measured a fully sampled PSF at 48 × 48 pixels within a 12 µm × 12 µm region, using a pixel dwelling time of 0.4 ms. This setup results in a measurement time of 0.1 s for each PSF. Typically, 2–5 iterations of correction are needed for the entire correction cycle to converge, depending on the specific structures chosen as the guide star. Considering the variations in the characteristics of guide stars and aberrations among individual mice and across different imaging sites, we adjusted the excitation power to maintain a consistent signal-to-noise ratio (defined as the ratio between the fluorescence intensity of the guide star and the PMT dark current) across experiments, targeting over 10 dB. This approach enabled us to achieve accurate PSF sensing in various experimental conditions. It is worth noting that the rapid PSF measurement method was developed to accommodate the motion of the guide star in the cortex of awake mice. Given that the skull, which is a primary source of aberration, is securely fixed to a head holder, its motion artifacts are negligible. Therefore, the iterative correction is not likely to be influenced by the movements of awake mice.

For larger areas allowing for a higher spatial frequency of wavefront to measure, such as 16 µm × 16 µm, we can employ a scaled sampling of 64 × 64 pixels, although this will result in longer measurement times. Alternatively, we can maintain the 48 × 48 pixel sampling for the 16 µm × 16 µm region by adjusting the frequency distance between the weak beams and utilizing a calibrated LUT for relative phase to ensure optimal performance.

Remote focusing and system aberration correction

To preserve the conjugation relationship between the SLM and the skull in deep tissue imaging, ETL is employed to adjust the position of the focal plane. A DM is utilized to correct the system aberration caused by misalignment and defocus of the ETL. In brief, the beam is initially focused on a Rhodamine 6 G solution, and a series of remote focusing depths within the ETL range are adjusted sequentially. At each remote focusing depth, the fluorescent signal is used to measure system aberration according to a sensorless AO algorithm11. Once the aberration coefficient at each depth is determined, a LUT is created and used to generate the correction wavefront for different imaging depths. The wavefront between the LUT sampling points is calculated using linear interpolation of the wavefronts in the two nearest points62. At large positive remote focusing, the SLM partially blocks the beam, leading to a slight enlargement of the PSF due to the reduced effective NA17.

Calibration of SLM conjugate position

The determination of the conjugation position of the SLM follows the previous method17. Briefly, a thin fluorescence layer is initially imaged using two-photon imaging, and the position of the objective is recorded as \({z}_{1}\). Next, a camera is positioned in front of the SLM, and its position is adjusted to obtain a clear image of the SLM surface. The objective position is then finely adjusted using a motorized actuator until the image of the thin fluorescent layer is clearly visible on the camera, at which point the objective’s position is recorded as \({z}_{2}\). The conjugate position of the SLM relative to the focal plane is then calculated as follows:

$$\Delta z=\,{z}_{1}-{z}_{2}$$
(20)

In our system, the SLM is conjugated to the plane with \(\Delta z=430\,\mu m\). For each in vivo experiment, the focal plane is initially adjusted to the center of the mouse skull layer using the skull’s SHG signal as a guide, then it is moved downward by a distance of \(\Delta z\). Once the focus is adjusted to the target plane, the objective’s position is fixed, and remote focusing is employed to change the imaging depth.

Normalization of Ca + signal fluctuation in rapid PSF sensing

Fluctuations in the Ca2 + fluorescence signal can result in inaccurate PSF sensing, particularly when the measurement speed is slow. The measurement time per PSF using MD-FSS is approximately 0.1 s, which is significantly faster than the fluctuation dynamics of GCaMP6s, exhibiting a rise time and half-decay time on the order of several hundred milliseconds63. Consequently, the impact of fluorescence fluctuations is considerably reduced. To further minimize this influence, we implemented digital filtering on the raw data, effectively isolating the low-frequency component of the fluorescence signal at each pixel. This low-frequency signal serves as a representation of the overall fluorescence intensity fluctuations and is utilized to normalize the PSF magnitude on a pixel-by-pixel basis, as described in the previous method17.

In vivo imaging

For morphology imaging on an awake, behaving mouse, the mouse was initially placed on a treadmill, allowing it to run freely while its head was fixed to a rotational stage. The angle of the rotational stage was coarsely adjusted to flatten the skull based on a bright field image on a commercial camera and then finely tuned using the SHG image. After positioning the skull perpendicular to the excitation path, the conjugate plane was adjusted to align with the middle of the skull layer by modifying the axial position of the objective. Next, MD-FSS was utilized to measure the aberrated PSF using guidestars of microglia, neurons, and other sources, and the correction wavefront was calculated for application on the SLM. One measured correction wavefront is placed at the beam center on the SLM for the entire corrected FOV without stitching in the experiment. Finally, 2PF images with significantly enhanced resolution and signal intensity were obtained with the correction pattern applied on the SLM. Detailed imaging parameters are listed in Supplementary Table S1.

Animal preparation

All the animal experiments were conducted on adult mice (≥ 2 months old) of either sex. Three transgenic mouse lines—Thy1-YFP (Tg(Thy1-YFP)HJrs/J)64, Cx3Cr1-GFP (B6.129P2(Cg)-Cx3cr1tm1Litt/J)65, CaMKIIa-GCaMP6s. CaMKIIa-GCaMP6s mice were generated by crossing CaMKIIa-Cre (B6.Cg-Tg(Camk2a-cre)T29-1Stl/J) mice with tetO-GCaMP6s (B6.Cg-Igs7tm162.1(tetO-GCaMP6s,CAG-tTA2)Hze/J) mice. The environment was maintained at a temperature of 22–25 °C with 40–60% humidity, and a standard 12 h light-dark cycle was followed. All animal procedures were conducted in accordance with the Guidelines of the Animal Care Facility of the Hong Kong University of Science and Technology (HKUST) and were approved by the Animal Ethics Committee at HKUST. The approved animal protocol number is AEP-2022-0142.

Drug administration method

Global systematic inflammation was induced by the administration of LPS. Briefly, a single intraperitoneal injection of LPS (5 mg/kg) was repeated daily for three days prior to awake two-photon imaging. 100 \(\mu L\) Texas Red (2 mg/100 \(\mu L\), Dextran, 70,000 MW, Thermo Fisher) was used for fluorescence labeling of blood vessels via retro-orbital injection. To induce anesthesia during imaging, isoflurane was administrated with dose of 1%. Before the thinned skull window and optical clearing window preparation, mice were anesthetized by intraperitoneal injection of xylazine (8.75 mg/kg) and ketamine (87.5 mg/kg).

Thinned skull window preparation

The skull thinning procedure was slightly modified from a previous protocol66. After anesthesia with xylazine and ketamine, the dorsal surface of the head was shaved, and the exposed skin was then cleaned and disinfected with 75% ethanol. An incision on the midline was made starting between the eyes to just caudal of the ears, and a lateral incision was made to the boundary of the temporal muscle and skull. A drop of phosphate buffered saline (PBS) is applied on the exposed skull so that the periosteum above the skull can be lifted easily by forceps and removed by a curved surgical scissor. After the skull surface is dried up, tissue glue (3 M Vetbond, Tissue Adhesive) is applied to the cut boundary of the skin. A thin layer of C&B Metabond is then applied over the exposed skull. A customized headplate was then held firmly on the skull by applying a mixture of dental cement and cyanoacrylate glue. The mouse was mounted on an angle adjuster (MAG-2, NARISHIGE, Japan), and a 0.5 mm carbon steel burr attached to a high-speed drill was used to thin a small circular region (diameter, 2-3 mm). Drill center is located using a stereotaxic apparatus (MingWangKeJi Ltd, Zhongshan, China) at 3.5 mm lateral and 1 mm posterior to the bregma for the somatosensory cortex, 2.5 mm lateral and 4 mm posterior to the bregma for the visual cortex. After the majority of the middle spongy bone was removed, a microsurgical blade (no. 6961, Surgistar) was used to manually thin the skull to approximately 30–40 µm in thickness, which can be accurately measured using the SHG signal of the skull bone.

Optical clearing intact skull window preparation

The procedure for optical clearing of the intact skull followed the established protocol43. The optical clearing solutions consist of S1 and S2. S1 is a saturated supernatant solution of 75% ethanol and urea at room temperature, while S2 is a high-concentration sodium dodecylbenzenesulfonate (SDBS) solution. To prepare S1, 75% ethanol (Sinopharm, China) was mixed with urea (Sinopharm, China). The mixture should be stirred continuously, then allowed to stand so that the supernatant can be collected for use. The volume-to-mass ratio of ethanol to urea is approximately 10:3. For S2, a 0.7 M NaOH solution is mixed with dodecylbenzenesulfonic acid (DDBSA, Aladdin, China) at a volume-to-mass ratio of 24:5, resulting in a pH of 7.2–8.0. The clearing maintenance reagent comprises of primer gel (Superior mixing clear gel, RyujiandMay, China), joint gel (K-303, Kafuter, China), and sealing gel (plated crystal antifouling sealing gel, Rainey, China). The LED light source (365 nm) was used to make the gel fully solidify.

Whisker stimulation method

The whisker stimulation method was slightly modified from the previous protocol58. In brief, a jet pipe was positioned near the mouse’s whisker and controlled by an electric gas valve. The air pressure was precisely adjusted to provide whisker stimulation with appropriate strength. The waveform of whisker stimulation adhered to the previous protocol58, featuring a pulse train with a duration of 3 seconds, a temporal frequency of 4 Hz, a pulse width of 100 ms, and an air pressure of 0.1 MPa. A custom-written MATLAB software was used to synchronize the image acquisition and whisker stimulation.

Visual stimulation method

The visual stimulation method was slightly modified from the previous protocol67. In brief, an LCD screen was positioned at 30–45 degree relative to the mouse’s center line, 15 cm in front of the left eye. The LCD screen was covered with blackout material and filtered by a short-pass filter to prevent light contamination. A custom-written MATLAB program was used to generate moving gratings for directional visual stimulation, which was synchronized with imaging. The moving grating was generated with a spatial frequency of \(0.05{cc}/^\circ \) and a temporal frequency of 2 Hz.

Image analysis

The images were processed using MATLAB or ImageJ. To eliminate inter-frame motion artifacts, the images were registered using the TurboReg or StackReg plugin in ImageJ, as well as the NoRMCorre algorithm68 in MATLAB. Some images were processed using the Smooth function in ImageJ, which replaces each pixel’s value with that of its 3 × 3 neighboring pixels, or with the Gaussian Blur function, applying a sigma of 0.15–0.2 µm. The image pairs with AO Off and AO On correction were acquired and processed using the same parameters and displayed with consistent contrast. The microglia morphology and dynamics were analyzed following previous work21. Regarding the calculation of the ramification index, process area changes, and Sholl analysis, the raw image was first normalized to a consistent saturation level and then smoothed using a Gaussian filter. The processed image was then binarized using the same threshold level. The ramification index (RI) was defined as the ratio of the perimeter to the area, normalized by the corresponding ratio for a circle with the same area, and was calculated from the binarized images. The area of bright pixels in the resulting mask was calculated for each image as the process area. Sholl analysis was conducted on the binary mask using the ImageJ plugin, Sholl Analysis 3.6.12. The calculation of calcium transients in neurons and the analysis of orientation selectivity of somas and dendrites were based on previous work50,63,69.

Statistical analysis

Statistical analysis and data visualization were performed using GraphPad Prism 10 software. The data are presented as mean ± SD, and \(\alpha=0.05\) for all analyses. Data were analyzed using a two-sided paired t test. No statistical methods were used to determine the sample size.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.