Automatic detector synchronization for long‐term imaging using confocal light‐sheet microscopy

Light sheet fluorescence microscopy (LSFM) is an important tool in developmental biology. In this microscopy technique confocal line detection is often used to improve image contrast. To this end, the image of the illuminating scanned focused laser beam must be mapped onto a line detector. This is not trivial for long‐term observations, since the spatial position of the laser beam and therefore its image on the detector may drift. The problem is aggravated in two‐photon excitation LSFM, since pulsed laser light sources exhibit a lower laser beam pointing stability than continuous wave lasers. Here, we present a procedure for automatic synchronization between the excitation laser and detector, which does not require any additional hardware components and can therefore easily be integrated into existing systems. Since the recorded images are affected by noise, a specific, noise‐tolerant focus metric was developed for calculating the relative displacement, which also allows for autofocusing in the detection direction. Furthermore, we developed an image analysis approach to determine a possible tilt of the excitation laser, which is executed in parallel to the autofocusing and enables the measurement of three solid angles. This allows to automatically correct for the tilting during a measurement. We demonstrated our approach by the observation of the migration of oligodendrocyte precursor cells in two‐day‐old fluorescent Tg(olig2:eGFP) reporter zebrafish larvae over a time span of more than 20 hours.


| INTRODUCTION
In the past years, light sheet fluorescence microscopy (LSFM) became a powerful tool for observing living samples in vivo. LSFM allows to observe a fluorescently labeled specimen with one (or more) objective lenses, whose focal plane is illuminated perpendicular to the detection axis by a thin sheet of light (Dodt et al., 2007;Huisken et al., 2004).
The sheet may be created by special optics such as cylindrical lenses.
An alternative method to generate a light sheet is realized in digitally scanned light sheet microscopy (Keller et al., 2008). Here, a laser beam is scanned across the focal plane by a mirror or an acousto-optical deflector (Duocastella et al., 2017;Gavryusev et al., 2019), which is positioned in a plane conjugated to the back focal plane of the illumination objective. The beam is focused into the sample with its main axis in the focal plane of the observation objective. When the beam is swept across the focal plane multiple times during image acquisition a planar illumination equivalent to a sheet but with improved illumination efficiency and a relative uniform intensity distribution is achieved.
LSFM offers intrinsic optical sectioning and reduced photobleaching (for review, see Power & Huisken, 2017;Stelzer, 2015). Threedimensional (3D) image stacks can be acquired by moving the specimen through the illuminating sheet within the detection plane of the imaging objective while acquiring a sequence of images. When using sensitive and fast CMOS cameras, image rates of hundreds of frames per second can be achieved. Furthermore, the technique can well be combined with expansion microscopy (Schwarz & Kubitscheck, 2022;Tillberg & Chen, 2019).
In living samples, the image quality is often degraded by scattered light. This can largely be overcome by using confocal line detection (Baumgart & Kubitscheck, 2012;Silvestri et al., 2012). Here, the excitation laser focus is moved through the sample once during image acquisition. The sCMOS camera sensor is read out in the so-called rolling shutter mode, where only a small band of pixels is active at a time. This pixel band represents a line-detector, and it is shifted across the sensor synchronously with the moving excitation laser and thus creates a confocal image.
For rolling shutter detection to work properly, a precise overlay of the position and orientation of the laser beam image and the line detector is mandatory. Long term imaging sessions that can last for several hours or even days-the time scale of developmental biology-place high demands on the stability of the microscope optics and especially the spatial alignment of the excitation laser.
The problem is aggravated in two-photon (2p) excitation LSFM, since pulsed laser light sources exhibit a lower laser beam pointing stability than continuous wave lasers. It is important to keep the room temperature as constant as possible and to use optomechanical components with a low coefficient of thermal expansion. This can increase the stability, but a loss of synchronization still cannot be ruled out and can easily ruin a long-term experiment.
Here, we present a method that actively accomplishes synchronization and therefore allows to use contrast enhancement by confocal detection without risking signal loss due to desynchronization between laser and detector during the experiment.
Zebrafish larvae (zfl) are a common vertebrate model to study embryonal development. Due to their transparency and complete exutero development, they are an ideal model for in vivo time lapse microscopy (Nagarajan et al., 2020). Zebrafish are visually guided animals, therefore repeated strong visible light exposure onto their retina during long term fluorescence microscopy could possibly affect the zfl in its development. This is especially true when performing long term physiological measurements, for example, using fluorescent reporters for changing calcium or glutamate concentrations. To avoid unnecessary harmful and distracting stimulation of the visual system of the developing zfl invisible infrared two-photon excitation is an alternative that is often chosen if available. Deeper penetration into the larvae tissue is an additional advantage of using infrared light compared to visible light for fluorescence excitation.
Long term observations in living zfl adds a further experimental challenge, which is finding the right concentration of agarose for embedding and anesthetics to paralyze the fish to make it keep still. In both cases, too high a dosage will harm the development of the fish and natural growth, but too low a dosage will make it impossible to image the fish because of its waste movement. However, the ability to correct for some movement and growth of the zfl gives us the opportunity to greatly reduce the concentration of agarose and anesthetics, which is very helpful in achieving more natural and realistic experimental conditions and results.

| Experimental setup
We used a custom-built 2p light-sheet microscope based on a previously described setup (Baumgart & Kubitscheck, 2012). The zfl sample was held in low melting point agarose in a FEP tube, which was immersed in a water-filled chamber with a built-in hole for the illumination objective (CFI APO 40XW NIR WD 3.5 mm water dipping, Nikon) with a numerical aperture (NA) of 0.8. A pulsed laser with a variable output wavelength between 680 and 1300 nm served as light source (InSight DeepSee, Spectra-Physics

| Correction of axial defocus
Axial defocus occurs when the illumination plane does not coincide with the focal plane of the detection objective lens ( Figure 1a). The result is a blurred image, in which fine structures cannot be resolved.
For the determination of the optimal detection lens position, an automated focus system was developed: the detection lens was moved in z-direction with steps based on a suitable search algorithm, which employed a modified Fibonacci sequence with variable increments.
The step size increased with growing distance from the start position, since it was assumed that the optimal position was already close to the start position. At defined positions images were acquired and the relative image sharpness was determined with a particular focus metric as discussed below. The optimal position for the detection lens was defined as that with the highest value of the focus metric.

| Robust focus metric
In practice, every recorded image contains noise due to the camera sensor. The relative amount of camera noise in the image is higher the less light is captured by the sensor. In 2p microscopy images often exhibit a poor signal-to-noise ratio, because the 2p absorption cross-section σ 2P of most dyes is low. Image noise is therefore a significant problem when focusing 2p images and many established focus metrices fail to reveal the optimal focus position.
Light scattering in the specimen-in our case within the zflcauses additional noise both in excitation and detection. Therefore, we searched a focus metric for autofocusing as robust to noise as possible. A number of known focus metrices as well as three new metrices were examined and compared with each other (Harder, 2021). Spectral focus metrices were shown to be less susceptible to noise than other metrices due to their intrinsic low-pass filter.
This observation was consistent with the results of Royer and coworkers (Royer et al., 2016). The influence of the noise could further be reduced by pre-processing the images before the computation of the metric (see below). Overall, one of the new metrices, F(I), was found to be optimal for low light conditions. It examines the image spectrum and is defined as follows: Here, I designates a two-dimensional image with pixel intensity I x,y ð Þ at position (x,y) and n designates the number of pixels. F x I y ð Þ corresponds to the one-dimensional (1D) fast Fourier transform (FFT) of the image line I y in x-direction at position y. r 0 is the assumed support radius of the optical transfer function (OTF) and r HP describes the limiting radius of a high-pass filter. The optimal values for r 0 and r HP depend on the employed detection optics. Assuming a laterally isotropic point spread function (PSF), the relationship between r 0 and the PSF radius r P of the detection unit is given by (Royer et al., 2016): Here, w I ð Þ and h I ð Þ correspond to the width and height of the recorded image I: The value for r HP was determined empirically for the employed detection objective as the value that yielded a minimal half width of the focus metric. In our experiments, the values for r 0 and r HP were determined as

| Further noise reduction
In order to further reduce the impact of noise, the recorded images were subjected to three pre-processing steps before the focus metric was calculated. These were a Gaussian filter, a scaling of the image size by a factor of 1/2 in x-and y-direction and the application of a threshold value. The optimal combination of pre-filters was determined for each examined focus metric according to the following criteria (Harder, 2021): minimization of the number of secondary maxima and the half-width of the focus metric together with maximization of the normalized height h ¼ F max ÀFmin F max of the metric´s main peak.
Here, F max and F min correspond to the maximum and minimum value of the metric, respectively.

| Synchronization of the confocal detector position and laser beam image
Next, we developed a procedure for automatic detector synchronization (ADS) based on the metric defined in Equation (1). In case the image of the illumination laser beam does not perfectly coincide with the active detector lines of the camera in the image plane, a deterioration of image quality will occur. In the worst case, no signal from the specimen will be detected ( Figure 1b). The position of the maximum intensity of the laser and the center of the active pixel band of the detector in y-direction are denoted as L C and D C , respectively. To create a good confocal image, L C and D C must coincide and move exactly synchronously to each other. A mismatch of L C and D C can be designated as lateral defocusing and can therefore be quantified using the same approach as introduced above for correcting an axial defocus.
Our approach to automated synchronization employed the fluorescence signal of the observed sample, was not dependent on structural details and worked as follows.
To begin with, a single overview image was recorded and a region of interest (ROI) with a sufficient fluorescence signal intensity was automatically selected from this ( Figure 2). In all following steps only this ROI was considered, which largely reduced the required recording time and the associated amount of data.
Next, the laser was moved through the selected ROI in m discrete steps to positions y m using the scanning mirror. Several images R m of the ROI were acquired at each position of the laser using a global shutter for detection. Figure 3a,b show two exemplary images that would result from such a laser illumination at different positions.
When scanning the laser beam across the complete ROI, the positions y m are passed by the laser at time points t m .
Obviously, the two brighter areas indicate the y-position of the laser and the corresponding y m can be guessed from these recordings.
In general, however, the fluorescence of the tissue is too variable to allow a precise determination of the laser beam positions y m . Therefore, the following quantitative approach was used.  Figure 3, the I n in Figure 4 were outlined by the same colors. The images I n generated from the virtual detector lines D n differed in their overall brightness and contrast, which was optimal for that I n deduced from the virtual detector line with D c ¼ D opt ¼ L C . As already mentioned, a mismatch of L C and D C results in a laterally defocused image. The best-focused image I opt could therefore be determined from the images I n analogously to the autofocus procedure described above for finding the optimal position of the detection lens using the focus metric given in Equation (1 So far, we assumed that there exists one detector line that coincides precisely with L C . Generally, however, D opt differs from L C not by an integer value, but by a number of pixels plus a subpixel distance. F I G U R E 2 Overview image of the brain (optic tectum) of an eGFP-reporter zfl.
Therefore, we determined D opt by finding the maximum of the focus metric values, F I n ð Þ by fitting a Gaussian function ( Figure 5).

| Correction of beam tilt
In an ideal case, the generated light-sheet is orthogonal to the detection direction Z. During long-term observation, thermal drifts of the laser or the optical setup may cause a tilting of the laser beam. Such tilts can be described by an angle α in the xz-plane and by an angle β in the xy-plane ( Figure 6).
Similar as shown above, the developed focus metric can also be employed to determine these tilt angles and further be used to introduce a feedback-loop to correct for them online during long term measurements in an automatic manner.
Finally, the light sheet may also be tilted by an angle γ in the yzplane. In that case the illumination plane is not co-planar with the F I G U R E 4 Exemplary reconstructed images I n of six exemplary virtual detectors corresponding to the marked and colored lines in Figure 3c,d.
F I G U R E 5 Relative focus values determined by Equation (1) for the images I n generated by the virtual detectors D n from Figure 3. The data points shown in color correspond to focus metric values of the images shown in Figure 4. detection plane. This misalignment type is not caused by a beam tilt but by a misalignment of the scanning mirror. This does not occur during long-term measurements, but can be checked before the measurement. Indeed, the image stack recorded for focusing in axial direction can also be used to measure and correct the inclination of the light sheet with regard to the detection axis. Royer et al. (Royer et al., 2016) divided such an "alignment image stack" into smaller tiles and calculated the optimal focus position for each of the tiled stacks and then used the 3D distribution of these foci to find the position of a plane comprising these points. Finally, they extracted the tilt angles α and γ by a linear plane adaptation (Royer et al., 2016).
In classical scanned light sheet microscopy, it is not mandatory to adjust the angle β to zero. Since the laser is scanned in the Y direction, the time-averaged light sheet remains practically unchanged, even if the beam is tilted by a small angle β. However, when using a rolling shutter for confocal line detection β must equal zero, since the laser beam image and the detector band must run parallel to one another.
In order to determine β we made use of the principle outlined above for synchronizing the lateral roller shutter position.

| Measurement of the tilt angles α, β, und γ
We developed a procedure by which all three angles α, β and γ can automatically be determined and corrected during a long-term measurement. The procedure is carried out in an analogous manner for all three angles. Therefore, we only illustrate here the determination of α from the z-focus series ( Figure 7).
We employ the images, which were captured at different positions z i of the detection objective lens, that is, the z-focus and the spatial nature of the sample under investigation, which is not known a priori.
The knowledge of α then allowed an automatic correction by adjusting a motorized mirror in the custom-made holder. A comparable procedure was used to determine the tilt angles β and γ. Longterm measurements started with angle values being equal to zero due to careful pre-alignment. During long-term measurements the acquired image stacks were continuously evaluated for the angles α and β. If required the positions of the respective motorized mirrors were corrected. In our hands though all deviations during the experiments were relatively small.

| Zebrafish husbandry and strains
Adult zebrafish (zf ), either sex and mixed-strain, were maintained according to national law and under standardized conditions (Westerfield, 1995 (Kimmel et al., 1995). The transgenic zebrafish line Tg(olig2:eGFP) used in this study was provided by the lab of Prof.
Catherina G. Becker and the lab of Prof. David Lyons (Shin et al., 2003).

| Sample holder
The specimen holder was specially built for observing zfl. The larva was embedded in a medium made of agarose with a very low gelation temperature (Sigma-Aldrich, A2576), which in turn was located in a plastic tube made of perfluoroethylene propylene (FEP) (Bohlender GmbH) with internal and external diameters of 1 and 1.4 mm, respectively. The tube was fixed horizontally in the specimen holder and placed into a chamber filled with water. FEP has the advantage that its refractive index of around 1.34 is very close to that of water, which results in low optical aberrations. The refractive index for agarose of around 1.33 (at a concentration of 1.5% (Jain et al., 2012)) also differed only slightly from that of water. The tube comprising the zfl was fixed in the holder at both ends. A hole in the holder below the tube allowed to illuminate the zfl with transmitted light.
The horizontal fastening had the advantage that zfl were held in the tube in a natural position, especially for long time in vivo imaging experiments. The specimen holder was suspended from a custombuilt motorized XYZ translation unit, which allowed precise specimen positioning. Furthermore, together with our self-written control software, it allowed automatic correction of zfl motion during long-term measurements.
2.10 | Impact of the focus and movement corrections on long-term measurements To analyze the effectiveness of the detector synchronization and beam angle measurement, a region in the spinal cord of a four-day-old Tg(olig2:eGFP) zfl was observed over a period of more than 16 h.
Every 5 min, an image stack was recorded consisting of 125 slices with an axial step size of 1 μm. These short time intervals between the image recordings allowed the observation of morphological changes with high precision.

| Focus corrections
The z-autofocus kept the light sheet in the focal plane of the detection lens for the entire measurement period. This was achieved by moving the objective with the piezoelectric device to counteract any displacement of the laser beam. The automated detector synchronization in scanning direction also kept the relative position between the laser image and the rolling shutter constant by adjusting the scanning mirror ( Figure 8).
The two blue dashed lines in Figure 8 mark the limits of the rolling shutter detector projected into the sample plane at the time of the first exposure. The width of the detector slit was about 4 μm and was adjusted to the beam diameter 2ω 0 (marked in gray in Figure 8). The graphics shows that without synchronization, the laser and detector would have drifted against each other by more than 2ω 0 during the measurement. After approximately 3 h the fluorescence would have F I G U R E 8 Drift of the laser beam position in y-direction in the sample plane as a function of time. The plot shows the positional drift of the laser beam center (black line) that was measured by the correction procedures. The measured drift between two subsequent images was used to generate a feedback signal to the scanning mirror, which kept the laser center in a conjugate position to the center of the virtual detector. The 1/e 2 -radius ω 0 of the beam at its waist was 2 μm (gray area in the plot). The extension of the confocal slit detector in the object plane corresponded to 4 μm and is indicated by the dashed blue lines.
been completely lost. Furthermore, a tilting of the light sheet by the angles α and β was corrected with the motorized mirror in the custom-made holder during the measurement. The corrected tilt was up to 0.5 degrees. Finally, the self-motion of the zfl was automatically compensated by the motorized XYZ translation unit, which kept the entire examined region in the spinal cord continuously in the field of view of the camera.

| Data acquisition
Images were acquired with a 40Â magnification using an objective of NA 0.8 in water. Therefore, the theoretical Rayleigh resolution in the sample of 420 nm corresponded to 16.8 μm on the sCMOS chip, which featured a pixel size of 6.45 μm. Thus, we imaged well below the Nyquist limit. Z-stacks comprising 125 slices with a step size of 1 μm were recorded every 5 min.

| Long term imaging of oligodendrocyte precursor cell migration
Employing confocal slit detection, the dorsal migration of OPCs in the spinal cord of young zfl was examined. OPCs originate from the neuroepithelium of the spinal cord and migrate from there to other areas of the central nervous system (CNS) (Osterhout et al., 1999). This happens in several waves and ultimately leads to the formation of oligodendrocytes (Spassky et al., 2001). OPCs constantly examine their surroundings by actively expanding and retracting their cell processes (Michalski & Kothary, 2015). With these processes, they finally encase the axons of the nerve cells with a myelin sheath (Sherman & Brophy, 2005). Myelin acts as an electrically insulating shell and leads to a reduction in membrane conductance and membrane capacity. In demyelinating diseases, such as multiple sclerosis, axons lose their myelin sheath. As a result, they often lose the ability to perform their . See also Movie S1. Image brightness and contrast were increased for visualization without applying a gamma correction in order to pronounce the fine image details. The recorded raw images were far from being oversaturated.
end of the measurement. The magnification of another OPC revealed the advantage of the high temporal resolution (Figure 13 and Movie S4).
One can see an oligodendrocyte precursor cell that has moved only a few μm out of the right main strand of the ventral spinal cord and is scanning the area with its cellular processes. It then retracts one of its processes back to the cell body at high speed.

| DISCUSSION
Long term, high throughput, 3D in vivo imaging with sub cellular and high time-resolution is of great importance in developmental biology (Cutrale et al., 2019). Suitable instruments to perform such measurements are LSFM due to their low phototoxicity and excellent imaging properties. The examined specimen often scatter excitation and emission light resulting in contrast deterioration. Fortunately, this can be minimized by confocal line detection (Baumgart & Kubitscheck, 2012;Silvestri et al., 2012). For this microscopy approach a perfect alignment between the exciting laser beam and a line detector, which is usually realized by a sCMOS camera operated in the so-called rolling shutter or "light-sheet" mode, is mandatory. However, for long-term measurements it is often problematic to maintain the required alignment due to mechanical drifts in the optical setup and to changes in the specimen itself.
With this work we present a new method to automatically determine and correct a possible desynchronization between laser and line detector in confocal LSFM. This method also enables an automatic adjustment of the focal plane of the detection objective and the light sheet orientation in the sample space. The new method can be performed during long term measurements and requires only two scans.
A region with high fluorescence intensity is searched and selected in a first scan, while the second scan covers exclusively this region. This reduces the amount of light to which the sample is exposed.
In an exemplary application we observed the dynamics of migrating oligodendrocyte precursor cells (OPCs) and their cellular processes in 3D with high temporal and spatial resolution. The permanent readjustment prevented the loss of synchronization over the entire recording duration of 20 h. We found that without the use of the synchronization, the excitation laser and detector area would have been shifted relative to each other by more than the beam diameter, which would result in a complete loss of the signal long before the end of the measurement.
A quantitative measurea metricfor assessing the focus quality was required for both the automatic detector synchronization and the autofocusing in the detection direction. We searched and identified a metric that was as insusceptible to image noise as possible. This search resulted in the new metric specified by Equation (1). Furthermore, we developed a new method to quantify the tilting of the F I G U R E 1 0 MIPs along ydirection in the spinal cord of a two-day-old Tg(olig2:eGFP) zfl derived from the same image stack as shown in Figure 9. (a) t = 0 h, (b) t = 6:40 h, (c) t = 11:30 h, and (d) t = 20:25 h. the blue dashed lines in D separate the dorsal from the ventral area (main cords). Image brightness and contrast were increased for visualization without applying a gamma correction in order to pronounce the fine image details. The recorded raw images were far from being oversaturated.
F I G U R E 1 1 Number of ventral to dorsal migrated OPCs during the long-term measurement. Only about half as many migration events were detected in the left area as in the right. Since the left side was further away from the detection objective, the image quality was lower in this area and it was more difficult to make out individual cells.
F I G U R E 1 2 Magnification of the dorsal migration process and search movements of the cell processes of an OPC (Movie S3). The images show MIPs of the yellow marked area in Figure 9b. A gamma correction (factor of 0.5) was applied to improve the contrast of the relatively dark branches of the cell extensions F I G U R E 1 3 Magnification of a second OPC exploring its surroundings (Movie S4). MIP of the area marked by the yellow frame in Figure 9c. (a-d) The cell explores its surroundings with its cellular processes. (e-i) One cell process rapidly gets retracted to the cell body (white arrows in e-g). A gamma correction (factor 0.5) was used to adjust the image contrast.
illuminating laser beam with regard to the detection image plane and the confocal line detector. These angle measurements were based on the same calculation of the focus metric and were independent of the sample structure. The calculation of the offset angles is easy and robust, since only two 1-D calculations have to be performed.
Over the last 15 years and with the advances in the CRISPR/Cas system, the importance and use of zfl as a vertebrate model is growing rapidly (Kuil et al., 2020). Especially in developmental biology and medical research the zfl has taken over in many cases from cell culture as well as from mice research. The zfl is nowadays a well-established model organism. It allows to improve our understanding of developmental processes and related inherited human diseases and also to perform developmental as well as physiological drug and compound screenings for pharmaceutical reasons. In this context a reliable, stable, and automated long-term in vivo observation of zfl development and behavior is absolutely necessary for high quality data generation and their subsequent automated analysis. This should also be true for physiological long-term imaging experiments using zfl with genetically engineered fluorescent reporters like, for example, GCaMPs for changes in Ca 2+ or iGluSnFR for changes in Glutamate concentrations (Kettunen, 2020;Marvin et al., 2013).
Long-term image recordings from strongly scattering, living samples benefit particularly from confocal detection with automated detector synchronization, because the image quality can be kept at an optimal level. The presented method does not require any additional optical components and is independent of the sample structure. This further allows to use our method in different microscopic setups for a large variety of applications that benefit from confocal detection.
However, the automatic synchronization only works reliably if the sample can be considered to be static for the duration of the focusing.
Since the focus procedure in the arrangement used here required less than 600 ms for a scan process, intrinsic movement during focusing should only be a problem in rare cases, for example, when imaging fast physiological changes with the help of fluorescent reporters.
The new metric remains to be tested in further optical and biological systems. We expect that it is advantageous compared to other focus metrices. Our metric could be used in almost all imaging areas and applications that require automatic focusing. The use is not only limited to microscopy, but could extend to commercial photo cameras or industrial quality control processes.