Instant FLIM enables 4D in vivo lifetime imaging of intact and injured zebrafish and mouse brains

Traditional ﬂuorescence microscopy is blind to molecular microenvironment information that is present in a ﬂuorescence lifetime, which can be measured by ﬂuorescence lifetime imaging microscopy (FLIM). However, most existing FLIM techniques are slow to acquire and process lifetime images, difﬁcult to implement, and expensive. Here we present instant FLIM, an analog signal processing method that allows real-time streaming of ﬂuorescence intensity, lifetime, and phasor imaging data through simultaneous image acquisition and instantaneous data processing. Instant FLIM can be easily implemented by upgrading an existing two-photon microscope using cost-effective components and our open-source software. We further improve the functionality, penetration depth, and resolution of instant FLIM using phasor segmentation, adaptive optics, and super-resolution techniques. We demonstrate through-skull intravital 3D FLIM of mouse brains to depths of 300 µ m and present the ﬁrst in vivo 4D FLIM of microglial dynamics in intact and injured zebraﬁsh and mouse brains for up to 12 h. © 2021


INTRODUCTION
Imaging molecular contrast is essential to continued advances in cellular biology. Fluorescence microscopy has been a significant tool over the past decades in imaging cellular and subcellular molecular contrast [1]. Traditional fluorescence microscopy typically obtains molecular contrast by labeling parts of cells with different fluorophores and imaging emission intensity. However, fluorescence emission contains a wealth of information on the molecular microenvironment that is not captured by the emission intensity but is present in the fluorescence lifetime. By performing fluorescence lifetime imaging microscopy (FLIM), fluorophores with overlapping emission spectra can be differentiated as long as their lifetimes are different, and physiological parameters such as pH, refractive index, ion concentration, dissolved gas concentration, and Förster resonance energy transfer (FRET) can be measured [2][3][4][5]. When combined with multiphoton microscopy (MPM) [6,7], FLIM can provide lifetime measurements in vivo with high resolution, deep penetration, and reduced photodamage [8,9]. Despite the biologically relevant information provided by fluorescence lifetime, the widespread use of FLIM in biomedical imaging has been limited due to its slow image acquisition and processing speed, low signal-to-noise ratio (SNR), difficult implementation, and high instrumentation cost [10][11][12][13][14][15][16][17].
State-of-the-art time-domain (TD) [15,16,[18][19][20][21][22][23] and frequency-domain (FD) [11,13,[24][25][26][27] FLIM techniques have been developed to overcome the limitations above. The most widely used and commercialized TD-FLIM technique is timecorrelated single-photon counting (TCSPC), which extracts the lifetime information from a histogram acquired by repetitively recording the arrival time of each photon [18][19][20]22]. Whereas state-of-the-art TCSPC systems can acquire fluorescence decay data at around 10 µs/pixel, they cannot generate lifetime images immediately using a regular computer due to the complicated postprocessing procedures (e.g., deconvolution and curve fitting) applied to the time-resolved fluorescence data acquired at gigabyte per second (GB/s) rates [16]. Therefore, most TCSPC systems store the raw data to the hard drive during the imaging session and then postprocess the data offline to get lifetime results. Without GPU processing, the data processing time for large TCSPC images (e.g., 1 MP) can be several minutes [28]; GPU processing can reduce the time to a few seconds, which, however, still cannot satisfy the real-time requirement. To reduce the data processing time, Ryu et al. employed the analog mean-delay (AMD) method to extract the TD lifetime information through numerical integration and realized real-time visualization of fixed tissues [15]. Li et al. developed a center-of-mass method (CMM) to implement real-time TD lifetime calculations in hardware [29][30][31]. Besides TCSPC, Bower et al. utilized a high-frequency digitizer to directly sample the TD fluorescence signal and achieved highspeed imaging of metabolic dynamics in living cells [16]. While both the AMD and the direct sampling methods reduced the pixel dwell time to below 10 µs, they required expensive high-frequency digitizers (>$10,000), and the limited computer memory and bandwidth prevented them from streaming lifetime images without interruption due to the large amount of data sampled by the digitizers [16]. On the other hand, FD-FLIM techniques are less commonly used or commercialized compared to TD-FLIM approaches due to their relatively difficult implementation and low SNR in lifetime measurements [10,14]. Conventional FD-FLIM techniques typically require external modulation sources (usually sinusoidal modulation), high-voltage but imperfect (less than 100% modulation degree) detector gain modulation, sequential phase shifting, specialized electronics, and can achieve lifetime image acquisition and processing as fast as 40 µs/pixel [11,13,24,26,32,33]. Recently, Raspe et al. demonstrated siFLIM, an FD-FLIM technique capable of video-rate (around 10 frames per second) lifetime imaging of living cells [27]. However, siFLIM requires a dedicated camera, and it relies on a widefield microscope with no optical sectioning capabilities; therefore, it cannot be used to acquire 3D lifetime images. Overall, due to the limitations in acquisition or processing speed, SNR, or optical sectioning capabilities, so far, only a few existing FLIM systems have demonstrated 3D lifetime imaging; no systems, however, have demonstrated long-term, time-lapse 3D (i.e., 4D) in vivo FLIM through-skull deep in the brain, where useful ballistic photons are scarce due to severe scattering and prolonged imaging time is not feasible because of animal movements [34]. Moreover, for functional imaging experiments in vivo where animals under anesthesia have limited experimental time, operators typically want the experiment to progress based on the real-time outcomes of lifetime measurements; this would not be possible without an in vivo FLIM system that can generate lifetime outcomes instantaneously, a requirement that cannot be satisfied with existing FLIM techniques.
Here we demonstrate instant FLIM, a novel FD-FLIM technique that utilizes analog signal processing to simultaneously address the challenges in image acquisition and processing, SNR, implementation, and cost faced by existing FLIM methods. We present instant FLIM as a tool that provides real-time streaming of two-photon fluorescence intensity, lifetime, and phasor imaging data through basic matrix operations applied to the analog data acquired at megabyte per second (MB/s) rates, as well as the first FLIM technique to our knowledge that allows instantaneous generation of lifetime measurements for functional imaging experiments in vivo. The word "instant" refers to acquiring FLIM data simultaneously with instantaneous processing, where lifetime images and phasor plots [35,36] are instantaneously generated without recording the fluorescence decay curves, thus eliminating the limitations not only in the speed but also the computer memory and bandwidth faced by state-of-the-art FLIM techniques [15,16]. We show that an instant FLIM system can be easily implemented as an upgrade to an existing two-photon laser scanning microscope for under $2,500 using cost-effective off-the-shelf components and our open-source, highly modularized, and user-friendly software packages. We also show that the imaging functionality, penetration depth, and resolution of an instant FLIM system can be further improved using phasor segmentation [37], adaptive optics (AO) [38], and super-resolution FLIM [39][40][41] techniques. Finally, employing an instant FLIM system, we demonstrate intravital 3D lifetime imaging of mouse brains through-skull to depths of 300 µm, and we present the first long-term, in vivo 4D lifetime imaging of microglial dynamics in intact and injured larval zebrafish and adult mouse brains for up to 12 h.

A. Experimental Setup and Analog Signal Processing
We implemented the instant FLIM system based on a custombuilt two-photon laser scanning microscope ( Fig. 1A; Fig. S1 of Supplement 1). The intensity of a mode-locked Ti:sapphire laser (Spectra-Physics Mai Tai BB, 710-990 nm, 100 fs, 80 MHz) is controlled by a neutral density filter (NDF), a motorized halfwave plate, and a polarizing beam splitter (PBS). A power meter is used to measure the excitation power by monitoring a small fraction of the laser beam reflected by a glass slide. A mechanical shutter (Thorlabs SHB1T) is used to block the laser beam when no imaging acquisition takes place. A sensorless AO setup consisting of a deformable mirror (Thorlabs DMP40-P01), a beam expander composed of two achromatic doublets (Thorlabs AC254-030-B, AC254-075-B), an achromatic quarter-wave plate (Thorlabs AQWP05M-980), and another PBS is utilized to correct the wavefront of the excitation beam in order to improve the imaging depth (Section S4 of Supplement 1). The AO setup is optional and can be switched into and out of the optical path using a folding mirror. The laser beam is directed to a conventional two-photon microscopy setup consisting of a pair of galvo scanners (Thorlabs GVS002), a scan lens (Thorlabs AC254-040-B), a tube lens (Thorlabs AC254-200-B), an objective lens (Nikon CFI APO NIR, 40×, 0.8 NA, or Olympus XLPLN25XWMP2, 25×, 1.05 NA), and a motorized stage (Prior OptiScan III). A longpass filter is used to block ambient light from entering the objective. The two-photon excitation fluorescence (2PEF) is epi-collected by the objective lens, reflected by a dichroic mirror, filtered through a set of bandpass and shortpass filters to eliminate residual excitation, and detected by a photomultiplier tube (PMT, Hamamatsu H7422PA-40) through a collection lens.
The analog signal processing module in instant FLIM utilizes the fluorescence signal from the PMT and the 80 MHz reference signal from the Ti:sapphire laser to generate the intensity, lifetime, and phasor data simultaneously. As shown in Fig. S2 of Supplement 1, the current signal from the PMT is amplified and converted to a voltage signal by a transimpedance amplifier (Aricorp DC-100), filtered by a lowpass filter (LPF, Mini-Circuits BLP-90+), and separated into DC and radio frequency (RF) parts by a bias tee (Mini-Circuits ZFBT-282-1.5A+). The DC signal (V DC ) is acquired by a data acquisition (DAQ) card (National Instruments PCIe-6323) to reconstruct the intensity image. The RF signal is amplified by a low-noise amplifier (LNA, Mini-Circuits ZX60-P103LN+) and split to four paths by a four-way power splitter (Mini-Circuits ZSC-4-3+). Meanwhile, the 80 MHz reference signal from the laser v ref (t) is filtered by an LPF to eliminate higher harmonics, amplified by an LNA, and split to four signal paths v 80MHz (t), also by a power splitter. A phase shift is introduced to each reference signal path by a pair of phase shifters  (Mini-Circuits JSPHS-150 with TB-152+). Note that each phase shifter can introduce a phase shift within π to the 80 MHz signal; connecting them in tandem introduces a total phase shift within 2π for each path. The phase shifts are independently controlled by the bias voltages generated by the DAQ card. The four phaseshifted reference signals are then amplified by LNAs and directed to four RF mixers (Mini-Circuits ZAD-3H+). Each mixer takes a reference signal path v LO (t, ϕ) to its local oscillator (LO) port and a PMT signal path v RF (t) to its RF port and generates a mixed signal v IF (t, ϕ) on its intermediate frequency (IF) port. The IF signals from each mixer are then filtered to DC, i.e., V IF (ϕ), by an LPF (Thorlabs EF502) and measured by another DAQ card (National Instruments PCI-6110). In the end, for each intensity image (2D, 3D, or 4D) acquired, four corresponding mixer images are acquired simultaneously, so the data acquisition is intrinsically synchronized and the effect of the PMT timing jitter is minimized. Fluorescence lifetime images as well as phasor plots are then instantaneously generated through basic matrix operations. The DAQ cards are also used to control the motorized half-wave plate, the shutter, and the galvo scanners during the imaging process. The motorized stage and the deformable mirror, on the other hand, are controlled directly by the computer through universal serial bus (USB) ports. Note that all electronic components in the instant FLIM system are impedance matched to 50 to suppress signal reflections, and LNAs are used and the RF components are properly shielded to minimize additional electronic noise introduced to the measurement. The parts and price list for the implementation of an instant FLIM system is presented in Table S2. The total cost to upgrade an existing two-photon laser scanning microscope (including data acquisition devices) to an instant FLIM system is less than $2,500.

B. Simultaneous Acquisition and Processing of Intensity, Lifetime, and Phasor Data
With the analog signal processing in instant FLIM, the fluorescence intensity, lifetime, and phasor data can be acquired simultaneously ( Fig. 1B and Section S1 of Supplement 1). Specifically, the 2PEF intensity image is generated from the DC part of the PMT signal: where P is the excitation power, c is the fluorophore concentration, T is the modulation period of the Ti:sapphire laser, and B and O B are the conversion loss and offset from the bias tee's RF&DC to DC ports, respectively. The lifetime and phasor data, on the other hand, are obtained by applying basic mathematical operations on the outputs of the four mixers' IF ports: where ϕ is the phase shift introduced by the phase shifters, a i is the intensity-weighted fractional contribution of the fluorophore with lifetime τ i ( i a i = 1), ω is the angular modulation frequency, and M and O M are the conversion loss and offset from the mixer's RF to IF ports, respectively. The average (phase) lifetime [2] image is calculated as and the components of the phasors are obtained as where M/B and O B are calibrated before measurements using the procedures detailed in Section S2 of Supplement 1.  4)] images from 2D, 3D, and 4D instant FLIM measurements were exported as 32-bit TIF files using the Instant-FLIM-Control program. Whereas the program allows the export of additional FLIM data, to reduce the consumption of the computer's storage space, we exported only the raw intensity, g , and s images, which can be used to reconstruct other types of FLIM data. We used the "Correct 3D Drift" ImageJ plugin [42] to register the 4D raw images to correct for the sample drift during time-lapse measurements. To perform the image registration simultaneously on the three raw images, we created a color image by merging the raw intensity, g , and s images as its red, green, and blue channels, respectively; then, as the 3D image registration was performed on the red (intensity) channel, the other channels were registered simultaneously. The registered image was cropped to remove the empty voxels generated from the registration process, and its channels were split into three separate images, which correspond to the registered intensity, g , and s images.
The intensity, g , and s images were then imported to the Instant-FLIM-Analysis program to generate other types of FLIM data. Since the raw FLIM data usually have a low SNR [14], we provided a filtering option in the program, such that one could apply a median filter (3 × 3 or 5 × 5 kernels) or a smoothing filter on the raw images, one or multiple times, to increase the SNR; note that applying a median filter to the phasor images does not decrease the image resolution [36]. In this work, we applied a 3 × 3 median filter three times on the raw phasor images for all in vivo measurements. The program could also uniformly scale the g and s images by a constant ratio to effectively zoom in or zoom out the phasor plot while keeping the calculated lifetime unaltered; a ratio between 0.7 to 1.0 was used in our measurements to post-compensate for the inaccuracy in system calibration and make sure that the majority of the phasor points fall inside the universal semicircle [(g − 0.5) 2 + s 2 = 0.25]. We then generated the phasor plot from the preprocessed g and s images. The phasor plot was a 2D histogram of the phasor components g and s , where the magnitude (represented with a color map) of each grid (with a predefined size) in the 2D histogram represented the number of phasor points located inside that grid. Note that the phasor plot could be generated simultaneously with intensity and lifetime images in the Instant-FLIM-Control program. In the Instant-FLIM-Analysis program, however, the phasor plot could be further analyzed using phasor-based image segmentation techniques. To perform the phasor analysis, the program allowed the user to either (a) manually draw regions of interest (ROIs) on the phasor plot and segment the pixels corresponding to the phasor points enclosed by the ROIs with different colors [36] or (b) automatically group the phasors into K clusters using the K-means clustering algorithm and segment the pixels corresponding to the phasor clusters with different colors [37]; both techniques could segment the raw image into structures with different lifetime/phasor characteristics ( Fig. S6 of Supplement 1). After the analysis described above, the raw lifetime image (gray-scale image with pixel value as lifetime), composite lifetime image (RGB image with pixel brightness as intensity, hue as lifetime), phasor plot (RGB image), and segmented images based on phasor labeling or phasor clustering techniques (RGB image) were generated and exported as 32-bit TIF files. For 3D images, the TIF files were imported into ImageJ, and the maximized z-projections of the stacks were generated. For 4D measurements, the stacks were first converted to hyperstacks in ImageJ to facilitate the time-lapse analysis, and a time-lapse maximized z-projection sequence could be generated. We also used Imaris to visualize the 3D and 4D stacks and enhance the qualitative information of FLIM by surface rendering the composite lifetime images.
To quantify the results of in vivo instant FLIM measurements (Figs. 3-6), we extracted the raw lifetime as well as g and s values from the TIF files exported by the Instant-FLIM-Analysis program. Specifically, the files were opened in ImageJ, a single-plane ROI was drawn around the cell of interest, and the mean value was measured within that ROI. The plots representing the phasor locations of cells were generated using Illustrator (Figs. 3D and 5C). Using the Instant-FLIM-Analysis program, ROIs were drawn on the phasor plots to correspond with the pixels representing individual cells. Individual ROIs were drawn for each cell analyzed. The locations for each of these ROIs were then recapitulated within the universal phasor semicircle. These specific locations were determined by exporting each phasor plot with the drawn ROIs and determining the coordinates of the ROIs within the exported phasor plot image using ImageJ. The coordinates were then used to place representations of each cell in the proper location within the universal phasor semicircle in Illustrator. In Figs. 3-6 separate statistical tests on τ , g , and s were performed to directly compare lifetime measurements between experimental groups. This method allows for determination of specific lifetime components, which are different between samples or experimental conditions.

D. Animal Procedures and Sample Preparation
All animal studies were conducted in accordance with the University of Notre Dame Institutional Animal Care and Use Committee guidance. The acquisition parameters for all the images shown in this work are presented in Table S1. Note that the excitation power and pixel dwell time in each imaging experiment were controlled carefully to prevent photobleaching.
Intravital imaging of the mouse brain was performed similarly to previously described [43]. Briefly, Cx3cr1-GFP/+ mice (generated in house by crossing Cx3cr1-GFP/GFP mice with wildtype C57Bl/6 mice) were anesthetized with a ketamine and xylazine cocktail by intraperitoneal injection. The mouse's head was secured and fixed in place using a stereotaxic instrument (Stoelting Co), and the skull was exposed with a midline scalp incision. A high-speed microdrill (Ideal Microdrill) equipped with a 0.7 mm burr (Fine Science Tools, 19007-09) was used to thin the skull to approximately 30 µm in thickness, using light sweeping motions to thin the skull gradually without applying significant pressure to the brain. In some instances, dental cement was used to border the thinned skull to form a bowl-like barrier to help contain water for imaging. Following surgery, the anesthetized mouse was administered a retro-orbital injection of 70 kDa Texas Red-Dextran (Invitrogen D1864) to enable fluorescent detection of blood vessels. The mouse was placed on the stage for imaging and its heart rate, respiration rate, and toe-pinch reflex were monitored periodically to ensure that it was fully anesthetized and not under duress.
The transgenic zebrafish line used in this study was Tg(pu1:gfp). All embryos were generated from pairwise matings and raised at 28 o C until imaging. Stable, germline transgenic zebrafish were used for all experiments. Embryos of either sex were used for all experiments. At 4 dpf, the embryos were dechorionated and anesthetized with 3-amino-benzoic acid ester. After anesthetization, embryos were mounted on their ventral side in 0.8% low-meltingpoint agarose in 35 mm Petri dishes with glass bottoms. Following mounting, the embryos were imaged using the instant FLIM system described above.
To prepare a fixed mouse brain to image for select experiments, a living Cx3cr1-GFP/+ mouse was first deeply anesthetized with isoflurane. Next, the mouse's chest cavity was opened to expose the heart, and the mouse was provided with a 100 µL injection of fixable Dextran 594 directly into the heart. After allowing the dextran to circulate for 1 min, the mouse was perfused with 10 mL ice-cold 4% paraformaldehyde (PFA) to thoroughly fix the brain. Subsequently, the brain was extracted and fixed in 4% PFA overnight at 4 o C and washed in 1x phosphate-buffered saline, after which point it was ready for imaging.
MDA-MB-231-EGFP cells were cultured in DMEM high glucose supplemented with 10% fetal bovine serum and 1% Penicillin-Streptomycin in an incubator at 37 o C, 5% CO 2 . Prior to imaging, the cells were grown to about 80% confluence for the imaging experiments. During imaging, refrigerated or heated culture media were added to the cell culture to change the microenvironment temperature, which was simultaneously monitored by a thermometer placed in the media.
FluoCells prepared slide #1 (Invitrogen F36924) was used as a biological test slide to evaluate the performance of the instant FLIM system. This test slide contained bovine pulmonary artery endothelial (BPAE) cells labeled with multiple fluorescent dyes: the mitochondria were stained with MitoTracker Red CMXRos, the F-actin was labeled with Alexa Fluor 488 phalloidin, and the nuclei were labeled with DAPI.
Four lifetime standards, i.e., fluorophore solutions with known fluorescence lifetimes, were prepared as previously described [44,45] To prepare the standards, the Coumarin 6 (Sigma-Aldrich 546283) was dissolved in methanol (VWR BDH2029) and ethanol (Millipore 818760), respectively; the Fluorescein (Sigma-Aldrich F245-6) was dissolved in NaOH 1.0N in aqueous solution (VWR BDH7222); and the Rhodamine B (Alfa Aesar A13572) was dissolved in water. The fluorophore mixtures were acquired by mixing the Fluorescein and Rhodamine B lifetime standards described above with different mole ratios.

A. Instant FLIM System and Principle
Built upon our preliminary work presented in Ref. [46], instant FLIM uses a RF analog signal processing approach, where the 2PEF signal is split four ways and mixed with the phase-shifted 80 MHz reference signals from the Ti:sapphire laser in a multiplexing manner (Fig. 1A; see Figs. S1 and S2 of Supplement 1 for details). It is essentially a homodyne FD-FLIM method to extract the lifetime information from the first harmonic of the 80 MHz laser repetition in fluorescence. We employed the reference signal from the laser because the laser repetition rate had a ±1 MHz variance, so a fixed-frequency external reference signal could introduce errors, and the implementation was cost effective. In instant FLIM, the four paths of the fluorescence and reference signals are operated independently and simultaneously during each measurement, and the mixers' outputs are DC signals that can be digitized by almost any data acquisition devices. The parallel, analog signal processing enabled simultaneous acquisition and instantaneous processing of 2PEF intensity and lifetime images and phasor plots for singleor multi-exponential decay analysis ( Fig. 1B; see Section S1 and Section S2 of Supplement 1 for details). Consequently, no additional acquisition time compared to conventional two-photon intensity measurement was required in instant FLIM, and it was deconvolution-free and fit-free, as lifetime images and phasor plots can be generated instantaneously through basic matrix operations with no extra computation time or memory, eliminating the bottleneck of state-of-the-art FLIM systems [15,16].
Fluorescence lifetime images alone are usually not enough to resolve the heterogeneity of fluorophores with multi-exponential decays, as different fluorophore compositions could result in the same lifetime measurements. Phasor plots, on the other hand, can resolve the fluorophore heterogeneity because different fluorophore compositions can alter the phasor components (horizontal coordinates g and vertical coordinates s ) even if the average lifetime might be unaltered [35,36]. While phasor coordinates can be computed from any TD-FLIM data using fast Fourier transforms, which are less computation-and time-consuming than curve fitting, Laguerre expansion, and principal component analysis techniques [47][48][49], it is still difficult to generate phasor results immediately using a regular computer due to the GB/s data rates acquired with a state-of-the-art TD-FLIM system. On the contrary, instant FLIM generates phasor results immediately through basic matrix operations applied to the analog data acquired at MB/s rates. To confirm the accuracy of phasor measurements of the instant FLIM system, we acquired the phasor plots of four fluorophores with single-exponential decays, which are usually used as fluorescence lifetime standards as their lifetime values are stable and well studied [44,45,50]. As shown in Fig. 1C, the phasors of these single-exponential fluorophores all located on the universal semicircle, and their lifetime measurements matched the expected values: Coumarin 6 in methanol, 2.29 ± 0.05 ns; Coumarin 6 in ethanol, 2.44 ± 0.05 ns; Fluorescein, 3.96 ± 0.24 ns; and Rhodamine B, 1.66 ± 0.02 ns. We then used the instant FLIM system to acquire the intensity and lifetime images and phasor plots of heterogeneous fluorophore mixtures consisting of Fluorescein and Rhodamine B: whereas the lifetimes of the mixtures of different mole ratios of Fluorescein and Rhodamine B, e.g., 15:1 and 7.5:1, were hard to distinguish (Fig. 1D), their difference in the phasor plot (Fig. 1E) was evident and could be used to differentiate the two mixtures.
We next analyzed the SNR performance in lifetime measurements of an instant FLIM system and compared it with conventional FD-FLIM techniques (see Section S3, Supplement 1 for details). The SNR performance was quantified using the F-value, i.e., photon economy, a widely used figure of merit independent of common factors such as fluorophore concentration and quantum efficiency to describe the sensitivity of FLIM techniques [10,51]. The F-value is defined as the ratio of the uncertainties in lifetime and intensity measurements: a smaller F-value is desired, as it represents a more accurate lifetime measurement with better SNR performance; there is, however, a lower limit of 1 on an F-value, which only exists in an ideal shot-noise-limited FLIM system where the available photons are utilized as efficiently as physically possible. Through Monte Carlo simulations and analytical error-propagation analyses, we showed that instant FLIM has a lower F-value, and therefore superior SNR performance, when compared to conventional FD-FLIM techniques for all fluorophores with a lifetime shorter than 4.5 ns. Although the SNR performance of instant FLIM is not as good as that of TCSPC, which records almost all the photons in the fluorescence decay and has a nearly perfect F-value of 1 regardless of fluorescence lifetime values, the F-value of instant FLIM can approach 1 at certain lifetime values, which cannot be achieved using conventional FD-FLIM techniques. The superior SNR performance of instant FLIM was mainly achieved by efficiently utilizing the intrinsic 80 MHz mode-locked femtosecond laser pulses as the modulation source and employing the low-power external RF mixing, instead of the detector gain modulation used in conventional FD-FLIM systems [10,14].
With the simultaneous image acquisition, instantaneous data processing, and superior SNR performance, in this work, we demonstrated acquisition and processing of 2PEF intensity, lifetime, and phasor imaging data altogether in 12 µs/pixel using a pair of galvo scanners (Table S1). The 12 µs/pixel acquisition time in our instant FLIM system was mainly limited by the bandwidth (175 Hz for sawtooth waves) of our galvo scanners (Thorlabs GVS002), while the data processing time was around 2 ns/pixel running on an Intel Core i7-8750 H 2.20 GHz laptop PC, which was orders of magnitude shorter than the image acquisition time. The pixel dwell time could be reduced to below 1 µs if resonant scanning mirrors or polygon scanners were used [16], where the intensity of the excitation laser beam needed to be increased accordingly to compensate for the signal loss. We used galvo scanners, instead of resonant mirrors or polygon scanners, mainly because galvo scanners are the most widely used scanners in conventional two-photon laser scanning microscopes. Nevertheless, thanks to the modular design of the cost-effective hardware (Fig. S1 of Supplement 1) and our open-source software (Instant-FLIM-Control and Instant-FLIM-Analysis) (Fig. S5, Supplement 1), modifications to an instant FLIM system such as replacing the galvo scanners with resonant mirrors or polygon scanners can be easily implemented.

B. Instant FLIM with Improved Functionality, Depth, and Resolution
To make instant FLIM a comprehensive and high-performance platform for 4D in vivo lifetime imaging in deep brains and to present the full potential of instant FLIM, we improved its imaging functionality, depth, and resolution using phasor-based image segmentation, AO, and super-resolution FLIM techniques, respectively. These techniques lay the foundation of the biological results we present in the later sections. Note that while these techniques are not specific to instant FLIM and can be done on TD-FLIM, it is still difficult for many researchers to use these techniques in practice. Here we present all the hardware and software implementation details of these techniques in this work and our open-source software packages, which become essential parts of the open-access toolkit of instant FLIM.
Phasor-based image segmentation techniques utilized phasor plots to segment pixels with similar phasor components (g and s ) in a raw image to resolve fluorescence heterogeneity [3,36], thus improving the functionality of instant FLIM as an imaging tool. Here we demonstrated two complementary approaches to implement phasor-based image segmentation: the manual phasor labeling [36] and the automatic phasor clustering techniques [37] (Figs. S6A and S6B, Supplement 1). In the phasor labeling approach, ROIs were manually drawn on the phasor plot, and the corresponding pixels in the raw image were labeled with different colors [36]. Figure 2A shows an example of how different cellular structures in a 3D instant FLIM stack of a fixed Cx3cr1-GFP/+ mouse brain could be segmented into different pseudo-colored groups by manually labeling their phasors with ROIs on the phasor plot in Fig. 2B (Visualization 1). On the other hand, the phasor clustering approach segmented an instant FLIM image by applying an unsupervised machine learning approach, i.e., K-means clustering, to automatically cluster the phasors into a specified number of groups (e.g., K = 3 as shown in Fig. S6B of Supplement 1) and labeling the corresponding pixels in the raw image with different colors [37]. The two segmentation methods are complementary: the phasor labeling approach is flexible but could lead to biased results, while the phasor clustering approach is unbiased and yet choosing a proper K value might require multiple trials.
We also added a sensorless AO setup as an optional module to our instant FLIM system (Fig. S1 of Supplement 1) to improve the penetration depth of our imaging system, which could be used to compensate for the optical aberrations in in vivo through-skull imaging deep in mouse brains [38]. We used one of three optimization algorithms (see Section S4 of Supplement 1 for details) to iteratively adjust the parameters of the wavefront shaping element, i.e., a deformable mirror in our setup, to improve the image quality quantified by an optimization metric [52,53]. We acquired a 3D lifetime stack of the brain, through-skull, in a living Cx3cr1-GFP/+ mouse using the instant FLIM system combined with the AO setup, and we compared it with the 3D lifetime stack acquired from the same mouse but without AO (Visualization 2). As shown in Fig. 2C, when there was no AO, our instant FLIM system could only achieve a penetration depth of 130 µm for through-skull 3D lifetime imaging in a living mouse brain; in comparison, by adding a well-optimized AO module into our instant FLIM system, the penetration depth for through-skull 3D FLIM in the same mouse was 300 µm, which was more than twice deeper than the depth without AO. To present the full potential of instant FLIM, we further demonstrated super-resolution FLIM with our instant FLIM system using generalized stepwise optical saturation (GSOS) microscopy [41], which used two instant FLIM images acquired at different excitation powers to generate a super-resolution lifetime image with preserved lifetime information and a √ 2-fold increase in both lateral and axial resolutions (see Section S5, Supplement 1 for details). As shown in Fig. 2D, after linear combining two diffraction-limited (DL) lifetime images acquired with excitation powers of 8.95 mW and 10.61 mW, respectively, a super-resolution GSOS lifetime image with improved lateral resolution of the same field of view can be generated. Whereas we have utilized GSOS to generate 2D super-resolution FLIM images of fixed cells like the ones in Fig. 2D [41], we could not demonstrate GSOS in 3D due to the excessive time required to generate multiple 3D FLIM stacks under different excitation powers using conventional FLIM systems. In instant FLIM, however, due to the analog signal processing, 3D FLIM stacks could be generated at the same speed as 3D intensity stacks. Therefore, by using GSOS in an instant FLIM system, generating a 3D superresolution FLIM stack only took twice the time of acquiring a 3D two-photon intensity stack. In Fig. S8 of Supplement 1, we generated a 3D super-resolution FLIM stack by applying GSOS to a pair of DL instant FLIM stacks of a fixed Cx3cr1-GFP/+ mouse brain acquired with excitation powers of 12.31 mW and 13.44 mW, respectively. As shown in Visualization 3 and Fig. S8D of Supplement 1, the cellular structures in the GSOS stack were better resolved with higher lateral (Fig. S8D, right) and axial resolutions (Fig. S8D, left) compared to the ones in the DL stacks.

C. In vivo 4D Instant FLIM Imaging in Intact Zebrafish and Mouse Brains
We characterized the in vivo performance of instant FLIM by measuring the fluorescence lifetime and phasor components of green fluorescence protein (GFP) expressed in microglia in living zebrafish and mouse brains, as microglia are critical for the functionality of the brain in homeostatic and disease states [54,55]. The GFP lifetime and the corresponding phasor coordinates are dependent on microenvironmental factors such as temperature [56], pH [2], and refractive index [57,58], and as cellular conditions and stress changes these chemical and physical properties, a change is seen in the GFP lifetime and phasor [59,60]. Before measuring GFP lifetimes in vivo, we performed an in vitro instant FLIM experiment by imaging GFP expressed in living MDA-MB-231-GFP cells under 18 different temperatures from 18.1 • C to 46.7 • C (Fig. S6C, Supplement 1). Whereas the intensity images showed no clear distinctions under different temperatures, the fluorescence lifetimes decreased monotonically as temperature increased, which was likely caused by the increase in the rate constant of nonradiative processes as discussed in Ref. [2] and reported in Ref. [56]. We also used the phasor labeling (Fig. S6D) and phasor clustering (Fig. S6E) techniques to segment the images and demonstrated that the GFP phasors under different temperatures located differently on the phasor plot. The results confirmed that instant FLIM was able to detect changes in the intracellular microenvironment through lifetime and phasor measurements.
To test instant FLIM as an in vivo lifetime imaging modality, we first imaged Tg(pu1:gfp) zebrafish at 4 days post fertilization  (dpf ) using regulatory sequences of pu1 to express GFP in myeloid cells including microglia and macrophages (Fig. 3A). So far, other than anatomical locations, identifiable markers that distinctly label these cells are limited. To determine if we could detect differences in GFP lifetimes within these cells, we imaged neural regions where both central nervous system (CNS) and peripheral nervous system (PNS) located myeloid cells could be detected and identifiable by their anatomical locations. The instant FLIM measurement reported at least two distinct GFP lifetime profiles using the phasor approach (Figs. 3B-3D). The phasors of PNS-located myeloid cells clustered distinctly compared to that of CNS-located myeloid cells, which also segregated into at least two distinct clusters by their g component, suggesting that lifetime could report heterogeneity among myeloid cells. To investigate if lifetime differences were presented in distinct subdomains of individual CNS-located myeloid cells over time, we performed 4D instant FLIM by collecting 3D stacks every 15 minutes for 12 hours (Figs. 3E and 3F). The 4D lifetime images in Fig. 3F show that the lifetimes of individual cellular subdomains changed over time as the cells migrated (white arrowheads denote subdomains with increased lifetimes over time). Note that the lifetime changes observed here are consistent with the GFP lifetime variations over the cell cycle as reported in Refs. [61,62]. However, these changes largely occurred within the cellular subdomains, whereas the average lifetimes of the cells remained stable during homeostasis (Fig. 3E). We repeated this analysis using skull-thinned Cx3cr1-GFP/+ adult mice whose microglia were labeled with GFP (Fig. 4A). We also retro-orbitally injected Texas Red-Dextran into the animal to distinguish blood vessels from microglia. These adult microglia displayed dynamic and complex branching emanating from the cell body (Fig. 4B). Given that microglia in larval zebrafish displayed distinct lifetime subdomains, we hypothesized that adult microglia could also have distinct lifetimes in their cell bodies and surveilling protrusions. To test this, we measured τ , g , and s and compared these values between the cell bodies and protrusions.
While we did not detect differences in g and s , the surveilling protrusions displayed increased τ compared to that of the cell bodies (Figs. 4C and 4D), indicating that the protrusions had distinct changes in their microenvironment while interacting with other neural cell types. We also employed 4D instant FLIM by taking 3D stacks of the mouse microglia every 2 min for 6 min (Figs. 4E and 4F). These images demonstrated that while the microglia had dynamic processes, under homeostatic conditions, the lifetimes of the cell bodies and surveilling protrusions were stable.

D. In vivo 4D Instant FLIM Imaging in Injured Zebrafish and Mouse Brains
As the brain's immune cells, microglia sense injury by continuously surveying the parenchyma with highly motile processes and converging to the site of injury to establish a barrier between the healthy and injured brain tissue [55,63]. We next used instant FLIM to determine if we could detect lifetime changes in microglia when they responded to brain injury. To do this, we created lesions in the larval Tg(pu1:gfp) zebrafish brain with the femtosecond laser and acquired 4D instant FLIM movies of microglial response to the site of injury by collecting 3D stacks every 15 min for 12 h (Fig. 5A). Consistent with the injury response [63], microglia migrated to the site of injury ( Fig. 5B; Visualization 4). We investigated the phasors extracted from the 4D instant FLIM measurement. As shown in Fig. 5C, the phasors of pre-injury microglia clustered together; from 0 to 60 min post-injury (mpi), the phasors segregated into two clusters in opposite directions; this clustering continued after 60 mpi with few phasors resembling pre-injury ones. Meanwhile, in plotting average τ , g , and s values, we detected decreased s components in microglia after injury (Fig. 5D). We next analyzed the lifetimes of whole microglia and their individual cellular subdomains in response to injury (Figs. 5E and 5F). After injury, both the microglia and subdomains adjusted their lifetimes, as denoted by the change in average lifetime values (Fig. 5E) and the increase of the number of red subdomains (red denoting longer lifetimes) (Fig. 5F), with continuing changes through 75 mpi. These observations demonstrated instant FLIM's capacity to detect lifetime changes in vivo after physiological challenges such as laser injury. We then used instant FLIM to investigate if similar lifetime changes could be detected in adult mouse microglia when they responded to brain injury. We created lesions in the skull-thinned Cx3cr1-GFP/+ mouse brain with the femtosecond laser and acquired 4D instant FLIM movies of microglial dynamics in response to injury by collecting 3D stacks every 2 min for an hour (Fig. 6A). Adult mouse microglia were markedly more abundant than larval zebrafish microglia. Consistent with the observations reported in Ref. [63], the laser injury in the adult mouse brain parenchyma induced an instantaneous response from the microglia where processes were extended toward the site of injury ( Fig. 6B; Visualization 5). This was in contrast with microglia in larval zebrafish, which utilized whole-cell migrations to the site of injury. Adult mouse microglial processes surrounded the lesion site similar to the cloaking arrangement of macrophages in the PNS [64]. We first compared lifetime changes from before the injury (−2 mpi) to after the microglia have extended their processes to the injury site (22 mpi) (Fig. 6C). To do this, we measured the lifetimes and phasor components of the cell bodies, responding protrusions, and protrusion tips which were migrating to the site of injury (Fig. 6D). These measurements did not detect changes in τ , g , or s from −2 mpi to 22 mpi but did detect differences in τ and g between each of the cellular subdomains. These data suggested that adult microglia maintained subcellular lifetime and phasor differences while responding to injury (Visualization 6). Further, we analyzed lifetime dynamics throughout the process of protrusion extension to cloak the injury site (Figs. 6E and 6F). These measurements indicated that lifetimes and phasors in each subdomain of the microglia remained relatively stable during early extension and cloaking of the injury site (Fig. 6E). Considering the stability of lifetime and phasor information of adult mouse microglia in response to injury, we used both the phasor labeling and phasor clustering approaches to segment the 4D instant FLIM voxels into different cellular structures (e.g., cell bodies, protrusions, protrusion tips, etc.) based on the similarity of their phasors and distinguished their responses to the laser injury (Visualization 7).
Taken together, these results demonstrate the capability of instant FLIM to delineate the dynamics of lifetimes and phasors in diverse cellular subdomains in zebrafish and mouse brains in vivo. They also highlight an important contrast in microglial responses to injury early in development and adulthood: microglia in larval zebrafish demonstrated lifetime changes after injury, while this effect was not observed in microglia in adult mice. Whereas the fundamental causes of the GFP lifetime or phasor variations in microglial subdomains are beyond the scope of this article, these variations measured by instant FLIM will be beneficial to distinguish and label cellular subdomains in microglia and understand their roles in the immune surveillance process [55].

DISCUSSION
Through analog signal processing, we have demonstrated instant FLIM as a novel FD-FLIM system that enables simultaneous acquisition and instantaneous processing of 2PEF intensity, lifetime, and phasor imaging data. However, the performance does not come without caveats. First, since instant FLIM utilizes the intrinsic femtosecond laser pulses as the modulation source, the modulation frequency is fixed at 80 MHz; therefore, as shown in Fig. S4C of Supplement 1, the SNR performance in lifetime measurements, quantified by the F-value, will become worse for fluorophores with longer lifetimes. As a result, instant FLIM will perform best with short-lifetime fluorophores such as Rhodamine B and Indocyanine green (ICG) [65]; for long-lifetime fluorophores or samples consisting of a wide range of lifetime components [66], the pixel dwell time for instant FLIM measurements should be increased accordingly to compensate for the lower photon economy. Second, while it is advantageous for instant FLIM to generate lifetime images and phasor plots directly without recording fluorescence decay curves to eliminate limitations in computer memory and bandwidth, users who are familiar with TD-FLIM systems may find it less intuitive or not straightforward to interpret the lifetime results. This is a trade-off between functionality and cost, as fluorescence decay curves can only be fully recorded using expensive TCSPC or high-frequency digitizers. Third, due to the electronic and RF components required to implement the analog signal processing in instant FLIM, additional electronic noise such as thermal noise and electromagnetic interference from the environment could be introduced to the lifetime measurement if the instruments were not well connected or shielded. In our experience, however, using low-noise amplifiers and properly shielding the electronics could successfully suppress the additional noise, and shot-noise limited measurements could be achieved.
The four-phase analog signal processing in the current instant FLIM system can be further improved. Theoretically, to extract lifetime information via homodyne FD-FLIM measurements, minimally only three phase images are required, and the lifetime measurement accuracy can be further improved if more phase images, e.g., 12, are employed [27]. In conventional FD-FLIM systems, these phase images need to be captured sequentially, so acquiring more phase images requires a longer acquisition time. Meanwhile, for more phase images, the processing for lifetime information becomes more complicated and time-consuming, as complex trigonometry calculations or curve fittings are required. In this work, we only acquired four phase images to reduce the cost of the system and the complexity of lifetime and phasor calculations. Nevertheless, following the principle of multiplexing analog signal processing, the current instant FLIM setup could be readily expanded to allow simultaneous acquisition of 12 or more phase images, where the 2PEF signal could be split to 12 or more paths and mixed with the phase-shifted reference signals from the femtosecond laser; therefore, the lifetime measurement accuracy of instant FLIM could be improved while no extra image acquisition time would be needed.
In conclusion, we have presented instant FLIM as a powerful tool for high-speed, long-term, 4D in vivo FLIM that allows realtime streaming of 2PEF intensity, lifetime, and phasor imaging data. As shown in Table S3, compared to existing FLIM techniques, the novel and unique aspects of instant FLIM include (1) the instantaneous data processing that allows real-time streaming of lifetime results, (2) the significantly reduced requirement for computer memory and bandwidth, and (3) the high performance in imaging speed, penetration depth, and resolution that enables the deepest and longest in vivo FLIM measurements to date. We have also demonstrated that an instant FLIM system could be combined with phasor labeling and clustering, AO, and GSOS to provide versatile phasor-based image segmentation, deep penetration depths, and super-resolution FLIM performances. The benefits of instant FLIM have been demonstrated extensively through the 4D in vivo FLIM experiments of intact and injured mouse and zebrafish brains. Using instant FLIM, we have achieved unprecedented in vivo FLIM imaging depth (300 µm through skull) and duration (12 h nonstop) and identified cellular subdomains in microglia, which will be beneficial for biologists to understand their roles in the immune surveillance process. Biologically, the identification of cellular subdomains with different fluorescence lifetime properties of a cytosolic fluorophore was surprising. These domains could be the result of a variety of phenomena such as distinct cell signaling hubs or organelle density. Regardless, these results were accomplished by upgrading a conventional two-photon laser scanning microscope using cost-effective off-the-shelf components with a total cost less than $2,500 and our fully open-source, highly modularized, and user-friendly software packages (Instant-FLIM-Control and Instant-FLIM-Analysis). As a result, instant FLIM can be easily accessed by many labs and has the potential to enable future discoveries in biology, including the mechanism of lifetime subdomains identified here, in addition to a wide variety of disciplines.