Direct wavefront sensing for high-resolution in vivo imaging in scattering tissue

Adaptive optics by direct imaging of the wavefront distortions of a laser-induced guide star has long been used in astronomy, and more recently in microscopy to compensate for aberrations in transparent specimens. Here we extend this approach to tissues that strongly scatter visible light by exploiting the reduced scattering of near-infrared guide stars. The method enables in vivo two-photon morphological and functional imaging down to 700 μm inside the mouse brain.

O ptical microscopy, the primary approach used to obtain subcellular information noninvasively inside living specimens, is limited in depth and resolution by scattering and aberration in tissue such as the mammalian brain. For example, for in vivo two-photon excitation (TPE) fluorescence microscopy, the intensity of the focus formed by the ballistic component of the excitation light decreases exponentially with imaging depth 1 . Aberrations further prevent the surviving ballistic photons from forming a diffraction-limited focus, degrading signal, imaging contrast and resolution 2 . Longer wavelength excitation alleviates the scattering problem 3 but the aberrations remain. To restore optimal imaging performance at depth, adaptive optical (AO) correction of aberrations in scattering tissue is essential [4][5][6][7][8] .
Recently, we demonstrated a simple, fast and photon-efficient method of aberration correction that recovers diffraction-limited performance in optically transparent samples such as the zebrafish embryo 9 . A direct-wavefront-sensing approach, it uses a Shack-Hartman (SH) sensor to measure the wavefront distortion of a fluorescent guide star (GS) 10 created inside the specimen by TPE 11 . In the SH sensor, a lenslet array creates an array of images of the GS on a camera from different beamlets emerging from the back aperture of a microscope objective. Deviations in the positions of these images from the ideal array reflect aberrations experienced by the fluorescence light and are used to measure the wavefront. This information is then used by a wavefront modulating element to compensate for the aberrations in either TPE or single-photon confocal imaging modes.
For this method to work, a clear image of the GS is needed in each element of the sensor. However, light scattering in samples such as the mammalian brain not only reduces the ballistic fluorescence rays that form the GS images but also generates a diffuse background, which eventually overwhelms the ballistic component and makes it impossible to measure the aberration accurately. Scattering, however, is strongly dependent on the wavelength of the light and is much reduced at longer wavelengths. Here we demonstrate that, by employing a nearinfrared (NIR) GS, direct wavefront sensing can be extended down to 700-mm depth in the mouse cortex in vivo.

Results
Direct wavefront sensing for morphological imaging at depth. Reduced scattering at longer wavelength allows direct wavefront sensing at increasingly greater depths in the scattering mouse brain in vivo, as demonstrated by GSs with emission peaks of 530 (YFP), 580 (tdTomato) and 810 nm (indocyanine green, ICG; Supplementary Figs 1 and 2; Methods). In one example, we injected ICG in the mouse cortex and used TPE to generate a NIR GS for aberration-corrected in vivo morphological imaging of layer 5 pyramidal neurons sparsely labelled with YFP (Methods). For in vivo mouse brain imaging, cranial window introduces aberrations that can be corrected either by AO ( Supplementary  Fig. 3) or by adjusting the correction ring on the objective ( Supplementary Fig. 4). We used the correction ring of a 1.1 numerical aperture (NA) water-immersion objective to precorrect cranial-window-induced aberrations ( Supplementary  Fig. 4), which ensured that the subsequent AO correction predominantly reflected the aberration of the brain tissue itself. With a single wavefront measurement 600 mm below pia, dendritic spines could be clearly resolved over a large field of view (120 Â 120 mm; Fig. 1a). Without the additional signal (up to 6 Â ) afforded by AO, most of these spines were invisible (Fig. 1b). Resolution enhancement by AO was also obvious: the full width at half maximum of a dendritic spine neck 550 mm below pia was reduced from B660 nm before AO to B430 nm after AO ( Supplementary Fig. 5). The corrective wavefront contained of large elements of coma, astigmatism and spherical aberration caused by the refractive index mismatch between brain tissue and water, as well as high-order modes resulting from the heterogeneity of the brain ( Fig. 1c; Supplementary Fig. 6). This heterogeneity is also evident in the SH image, where individual GS images have complex intensity and shape variations (Fig. 1c). Our direct-wavefront-sensing approach can be applied to improve structural imaging at 700 mm (Supplementary Movie 1) or even 760 mm (Supplementary Movie 2) below pia, despite the presence of substantial brain motion at these depths. Even deeper corrections are limited by the cranial window size (Supplementary Fig. 7). Even though a single correction can improve image quality over a field of hundreds of microns in the mouse cortex 5,12 , the best performance is still obtained when the aberration is measured at the imaging location. To demonstrate, we measured aberrations at the surface of the mouse cortex as well as three locations at 400-mm depth that were laterally separated by 200-400 mm (Fig. 2). Although the three wavefronts measured at 400-mm depth were similar, in all three cases the highest signal and greatest contrast recovery occurred when the locally measured correction was employed. Therefore, to have diffraction-limited images over a large field of view (for example, 1 Â 1 mm 2 ), frequent AO corrections are likely needed. Our method is well suited for this eventuality, thanks to its high correction speed (milliseconds to seconds; Supplementary Table 1).
Direct wavefront sensing for functional imaging at depth. Widely used in medical diagnostics 13 , injection of ICG allows this direct wavefront-sensing approach to be applied to a wide variety of tissues in vivo. In the mouse brain, it can improve not only morphological imaging but also the sensitivity when measuring neural activity at 500-mm depth in cells expressing the calcium indicator GCaMP6s 14,15 (Thy1-GCaMP6s GP4.3 mouse; Supplementary Movie 3). One caveat, however, is that we observed heightened spontaneous activity of GCaMP6s in cortical regions injected with ICG. To eliminate this, we replaced ICG with the NIR protein iRFP NIR fluorescence protein iRFP713 16  ARTICLE vector in a subset of neurons in the primary visual cortex of the Thy1-GCaMP6s GP4.3 mice. With this marker, we were able to use a TPE-generated NIR GS to obtain corrective wavefronts down to 500 mm below pia, which then led to markedly improved sensitivity to evoked calcium responses in the visual cortex. Indeed, after AO correction, calcium transients could be detected in many more neurites at depths of 400 ( Fig . Several factors contribute to these drastic improvements: calcium indicators usually have a heterogeneous labelling density in the brain. The more strongly labelled somata or neurites constitute the structures of interest, which are surrounded by the axons and dendrites of other more weakly labelled neurons. Calcium transients from these weakly labelled neuropil, or the 'neuropil contaminations' 17 , represent the average response of many neurons and are not selective to the orientation of our visual stimuli. For a fine neurite, calcium transients within the laser focus are composed of signals from both the neurite and its surrounding neuropil. In a focus enlarged and dimmed by aberration, the calcium transient of the neurite may be overwhelmed by that of the neuropil. AO correction, however, both reduces the focal volume and increases the focal intensity, which enhances the neurite signal a lot more than the neuropil background. As a result, the orientation selectivity of many neurites is only detectable after AO correction raises the neurite calcium transients above that of the neuropil background 5 . This suggests that, to have an accurate characterization of neuronal responses at synaptic resolution, correction of brain-induced aberrations is essential.
Direct wavefront sensing for confocal imaging in mouse brain.
Although two-photon imaging is necessary to image fluorescence multiple scattering lengths deep within tissue, single-photon modalities such as confocal microscopy have intrinsically higher spatial resolution and can be applied in the superficial layers of the brain, where scattering is still low. Even here, however, AO can play an important role, as the multiple protective layers over the brain (for example, dura mater, arachnoid and pia mater) as well as slight tilt of the cranial window can impose substantial aberrations on both the excitation and emission light. Instead of painstakingly and invasively removing some of these protective layers 18 , our method can provide a quick AO correction using fluorescence from the same structures that are the target of the imaging. For example, we were able to use TPE to generate a descanned GS from membrane-specific EYFP expressed in apical dendrites in layer I of the mouse cortex (Thy1-ChR2-EYFP-transgenic mice). After AO correction, the dendritic branches and spines were clearly resolved as hollow, thanks to the membrane marker (Fig. 4a). With a different transgenic line (Thy1-YFPH) expressing cytosolic YFP in a subset of neurons, dark voids were occasionally observed in apical dendrites, possibly caused by mitochondria displacing the cytosolic YFP ( Fig. 4b; Supplementary Movie 7). Thus, even in these superficial layers, AO can substantially improve imaging quality in vivo.

Discussion
Even though wavefront measurement can be achieved with a stationary GS, in our experiments, the NIR GS was scanned over a small area (o60 Â 60 mm 2 ; Supplementary Tables 1-4), which reduces photobleaching and gives rise to a higher quality spot pattern on the wavefront sensor 9 . In principle, as long as the area used for wavefront measurement is smaller than the isoplanatic patch of the tissue, scanning the GS does not compromise AO performance. In practice, the optimal scanning field of view used for wavefront measurement depends on properties of the fluorophore (for example, its photophysical and photochemical properties as well as labelling density), the tissue and the nature of the experiment, thus, should be determined heuristically.
With an NIR GS, our approach is not only less sensitive to scattering but also to absorption by haemoglobin ( Supplementary  Fig. 8), which otherwise poses a major challenge for a visible (VIS) GS. With typical expression levels of common fluorescent labels and sensors, the method obtains a correction in the range of o100 ms to several seconds, and is insensitive to sample movement or variations in fluorescence intensity (for example, photobleaching, calcium or voltage transients). Immediately applicable to medical imaging preparations where NIR dyes are routinely introduced for contrast, this method will benefit further with the continued improvement of red and NIR fluorescent proteins as morphological and functional probes [19][20][21] .

Methods
Scanning AO microscope with direct wavefront sensing. The system (Supplementary Fig. 9) has three working modes: AO correction, TPE imaging and confocal imaging. In the AO correction and TPE imaging modes ( Supplementary  Fig. 9a), NIR excitation from a pulsed laser (Coherent, Chameleon Ultra II or Spectra-Physics, InSight DeepSee) is expanded and collimated by a pair of lens (F 1 ¼ 50 mm and F 2 ¼ 500 mm). It is coupled into the system by a dichroic mirror D3 (Semrock, FF670-SDi01-25x36) placed between these two lenses. The collimated NIR beam slightly overfills the aperture of the deformable mirror (DM, Alpao, DM 97-15) and is reflected with shaped wavefront. The DM is conjugated to two scanning galvo mirrors Galvo X and Y (Cambridge Technology, 6215H) and the back pupil of the objective (Nikon, CFI Apo LWD 25XW, 1.1 NA and 2 mm working distance (WD)) sequentially using three pairs of achromatic relay lenses operating in the 2F 1 þ 2F 2 configuration (focal lengths: F 1 ¼ 300 mm and F 2 ¼ 100 mm between DM and Galvo Y; F 1 ¼ 85 mm and F 2 ¼ 85 mm between Galvo Y and X; and F 1 ¼ 100 mm and F 2 ¼ 400 mm between Galvo X and the objective rear pupil). The objective focuses the TPE beam into the sample and collects the excited fluorescence. For TPE imaging, the fluorescence is reflected by a dichroic mirror D1 (Semrock, FF665-Di02-25x36) placed immediately after the objective and focused by a lens (focal length: f ¼ 75 mm) onto a photomultiplier tube PMT1 (Hamamatsu, H7422-40). In the AO correction mode, the fluorescence from the TPE GS is descanned by Galvos X and Y and separated from the excitation light by dichroic mirror D2 (Semrock, FF875-Di01-25x36), before being relayed by a pair of lenses (F 1 ¼ 100 mm and F 1 ¼ 150 mm) to a lenslet array (Edmund Optics, 64-483) conjugate with the objective rear pupil. This array serves as the first part of the SH sensor. The SH camera (Andor iXon3 897 EMCCD) is placed at the focal plane of the lenslet array to record an array of images of the GS. In two-photon imaging mode, the AO system is operated in an open-loop manner where the DM only controls the wavefront of the excitation light but is not in the light path of the GS fluorescence. In the confocal imaging mode ( Supplementary  Fig. 9b), the VIS excitation is introduced into system by a dichroic mirror D4 (Semrock, Di01-R488/561-25x36) and follows the same light path as NIR excitation in the AO and TPE mode. The dichroic mirrors D1 and D2 are changed to D1 0 and D2 0 (Semrock, FF409-Di03-25x36) to allow VIS light transmission. The emitted fluorescence follows the reverse path of the excitation, passes through the dichroic mirror D4 and is collected by photomultiplier tube PMT2. A 30-mm diameter pinhole (Thorlabs, P30S) located at the focus of the fluorescence is placed in front of the PMT2 for confocal imaging. Various band-pass optical filters F1, F2 and F3 are placed in front of PMT1, the SH sensor and PMT2 according to the wavelengths of the working fluorophore.
Calibration of the DM. The DM is calibrated separately before being integrated into the system. The actuator influence functions of the DM are measured using a home-built Michelson interferometer. Each influence function is expanded into Zernike polynomials. On the basis of the measured influence functions, the actuators' voltage settings for the first 55 Zernike modes can be obtained using a generalized matrix inversion method. In this way, the shape of the DM can be controlled deterministically through linear combinations of these modes.
Calibration of the SH sensor. The SH sensor is calibrated with the DM in the system to minimize errors caused by misalignment. During the calibration, the objective is removed and a flat mirror is placed at the back pupil plane of the objective, which is conjugated to both the DM and SH sensor. An attenuated NIR beam is launched into the optical system and reflected by the DM with its wavefront shaped. Then, it is back reflected by the inserted mirror and directed to the SH sensor, where the wavefront changes introduced by the DM can be detected by the SH sensor. In total, 55 SH measurements are taken while applying the first 55 Zernike modes to the DM. Spot shifts determined in the 55 SH measurements form the basis with which SH measurements from in vivo samples can be decomposed. Due to the descanning and averaging over a volume, aberrations measured in these samples are mostly composed of low-order Zernike modes. Therefore, the modal phase reconstruction strategy is adopted to make wavefront sensing more robust against noise and missing spots in the SH measurements.
System characterization. The principles of system aberration correction, wavefront sensing, image acquisition, control electronics and control software are the same as those used in our earlier work 9 except that the two spatial light modulators working for VIS and NIR beams separately are now replaced by a single DM, which not only simplifies the system but also works over a wider wavelength range. All experiments started after compensation for system aberration, therefore, all of the wavefronts presented here represent the corrections for sample-induced aberrations.  Fig. 1). The emission peaks of these fluorophores are around 530, 580 and 810 nm, respectively. We measured the signal-to-background ratio (SBR) of individual GS images from the recorded SH sensor images ( Supplementary Fig. 2a,b). Within a given SH image, SBR varies due to the inhomogeneity of the tissue, and generally decreases for light rays that are at higher NA and thus experience larger scattering loss. By analysing all spots in each SH image, we find that tdTomato outperforms YFP at all depths because of its smaller extinction coefficient (Supplementary Fig. 2c). Even though it has a longer emission wavelength, ICG only outperforms tdTomato beyond a depth of 400 mm. At shallower depths, the SBR of ICG is reduced by out-of-focus background fluorescence due to direct linear excitation of the ICG by the 1,020 nm wavelength of the TPE laser. Nevertheless, ICG provides greater uniformity in the SBR at all depths for all GS spots across the sensor ( Supplementary Fig. 2b), which is essential for reliable wavefront measurement. Even though the SBR is unaffected by the GS brightness B, a brighter GS can compensate for the decrease of SBR at depth ( Supplementary Fig. 2d), since the signal from the ballistic component increases linearly with B, whereas the noise from the background increases only as ffiffiffi B p . Eventually, however, the brightness required for meaningful AO correction will become impractical to reach due to limitations imposed by sample damage, photobleaching, excessive scattering loss of marginal rays and unacceptably long measurement time. Beyond these limits, AO correction via indirect wavefront measurement 5,12 is the only option. Procedures for in vivo imaging. Mice 8 weeks or older were anaesthetized with isoflurane (1-2% by volume in O 2 ) and given the analgesic buprenorphine (SC, 0.3 mg kg À 1 ). Using aseptic technique, a 3.5-mm diameter craniotomy was made over the left cortex. Dura was left intact. For experiments with ICG as GS, 5 nl of ICG solution (0.1% in saline) was slowly injected into target imaging area with a glass pipette with a 15-20 mm opening bevelled at 45°and back filled with mineral oil. To introduce iRFP GS, 30 nl of AAV1-CaMKII-iRFP (Addgene #47903) virus solution (produced by the NIDA Optogenetics and Transgenic Technology Core facility) was injected into V1 (left hemisphere, 3.4 mm posterior to Bregma; 2.7 mm lateral from midline; 0.4 mm below pia). A titanium headpost was attached to the skull with cyanoacrylate glue and dental acrylic. We adopted the following practice for optimal imaging performance without AO: to minimize non-brain-induced aberration, a cranial window made of a single 170-mm-thick coverslip (Fisher Scientific no. 1) was embedded in the craniotomy and sealed in place with dental acrylic. (The final cranial window has a clear aperture of B3-mm diameter.) During imaging, the mouse head was carefully aligned to make the cranial window and the brain maximally perpendicular to the microscope objective optical axis, so that the spherical aberration caused by the cranial window can be largely compensated by the correction ring on the objective (Supplementary Fig. 4).
In vivo functional imaging. When using an ICG GS, functional calcium imaging experiments immediately followed the injection, whereas a 3-week post-surgery recovery period was adopted for iRFP to reach sufficient expression level. Visual stimuli were presented to the eye contralateral to the hemisphere with craniotomy using a computer monitor. The stimuli were blue sinusoidal gratings at 100% contrast that drift at 2 Hz in eight different directions (0, 180, 45, 225, 90, 270, 135 and 315°) for 5 s (10 imaging frames) each. They were interleaved with 5 s of a black screen. For each imaging session, the sequence was repeated five times and a total 800 calcium imaging frames were collected.