Image distortion and its correction in linear galvanometric mirrors – based laser-scanning microscopy

. To simplify imaging focusing and calibration tasks, a laser-scanning microscope needs to scan at a moderate frame rate. The inertia of a galvanometric scanner leads to time delays when following external commands, which subsequently introduces image distortions that deteriorate as scan frequency increases. Sinusoidal and triangular waveforms were examined as fast axis driving patterns. The interplay among driving pattern, frequency, sampling rate, phase shift, linear scanning range, and their effect on reconstructed images was discussed. Utilizing position feedback from the linear galvo scanners, the effect of response time could be automatically compensated in real time. Precompensated triangular driving waveform offered the least amount of image distortion. © The Authors. Published by SPIE under a Creative Commons Attribution 3.0 Unported License. Distribution or reproduction of this work


Introduction
Laser-scanning microscopy (LSM) is an indispensable imaging tool in biology and medicine. 1,2By eliminating scattered light from out-of-focus planes, LSM offers high spatial resolution images and the capability for "optical sectioning" of cells and tissues. 3Real-time LSM systems applied to in vivo and noninvasive skin imaging have been reported. 4,5Among various laserbeam-scanning technologies, acousto-optical deflector, rotating polygon mirrors, and resonant galvanometers are able to achieve video-rate scanning. 6The galvanometric scanner, also known as galvo, is a popular optical scanning device based on permanent magnetic motor principles and a resonant galvo typically has a maximal rotating frequency of 8 KHz. 7Besides its applications in real-time and in vivo tissue imaging, LSM is also useful in examining ex vivo samples for potential disease biomarkers.To explicitly characterize tissue, cellular morphology needs to be correlated with the underlying chemical composition, which requires spectra (fluorescence and/or Raman) to be acquired by allowing the excitation laser to dwell at focus points for a specified time period.A resonant galvanometer cannot be driven at frequencies other than its frequency and does not allow random access to individual scanning pixels. 6A closed-loop linear galvanometer allows arbitrary scan patterns with high accuracy at variable scanning speeds.Therefore, a linear galvanometer excels in providing precise control of scan angle and dwell time despite its slow speed.As a mechanical device, the inertia of a galvo rotor means a constant response time, which translates into position errors between commanded and actual scanner positions during continuous scanning.At a fast image update rate, the position errors lead to image distortions that complicate calibrating/focusing of the microscopy.Unlike a resonant scanner that comes with line scan synchronization trigger signals, a linear galvo scanner needs to eliminate the effect of inertia differently. 8One proposed method is to use the actual mirror position to synchronize data acquisition (DAQ) and limit the scanning range within the central linear scanning range. 9This method circumvents the effect of response time and also avoids the distortion due to the galvo's limited bandwidth.However, its performance strongly depends on a proper image reconstruction algorithm.Another possible method is to shift pixels according to the time delay either in real time or after image acquisition. 10hifting pixels always results in imprecise timing of the delayed response.In this paper, we discuss the scanning parameters that affect the reconstructed image quality at a moderate image update rate.We demonstrate a new method that offers precise and real-time error correction between the driving command and the actual galvo position.
confocal reflectance light to the avalanche photodiode (APD) detector.A long-pass dichroic mirror (DM) directed the twophoton excited fluorescence (TPEF) signal to a photomultiplier tube (PMT).The microscopic objective (MO) (Olympus America Inc., Center Valley, Pennsylvania) was a ×40 water immersion type.The optical scanner was a small beam diameter scanning galvanometer mirrors system (GVS202, Thorlabs, Newton, New Jersey).The motor had a maximum angular scanning range of 12.5 deg, a repeatability of 15 μrad, and a step response time of 300 μs.Within a small scan angle (AE0.

Galvo Driving Patterns and Image Reconstruction
Sinusoidal and triangular driving patterns with variable amplitude, frequency, and sampling rate were tested.The symmetry of both sinusoidal and triangular driving patterns allowed bidirectional scanning within each cycle, allowing better utilization of laser scanning time. 11Only image lines belonging to the same scanning direction were used to reconstruct the image in order to minimize line shift distortion. 10

Computing Program and Software
A program was developed using LabVIEW (National Instruments, Austin, Texas).Synchronization of galvo driving signal and acquisition of detector and driving board diagnostic outputs were achieved by sharing the start trigger signal of the analog output.The voltage output from detectors was acquired as a linear array with a length equivalent to the total number of pixels.Once each cycle of the scan was completed, the linear array was folded into images with the correct dimensions.Raw image data were further analyzed in MATLAB® (Mathworks, Natick, Massachusetts).

Resolution Target and Cell Culture
A positive combined resolution and distortion test target (18 × 18 mm, R1L1S1P, Thorlabs, Newton, New Jersey) was used.The concentric sector star pattern was scanned to detect image distortions and to verify the effectiveness of correction.Hut78 suspension T lymphoma cells cultured in RPMI-1640 medium (R0883, Sigma-Aldrich Canada, Oakville, Ontario) and stained with FM1-43 fluorescence dye were imaged.The cell culture was kept in the dark before imaging.
3 Results and Discussion

Position Error Correction
For a specific driving frequency and sampling rate combination, the phase shift remained fairly constant.Therefore, it was possible to counteract the phase shift effect by introducing an initial phase to the driving waveform.An advanced phase amount caused the galvo mirror to respond ahead of the commanded scanning position.Except for the initial starting period during which the galvo accelerated to follow the command voltage, the actual galvo mirror position eventually coincided with the commanded position after the galvo managed to synchronize with the input voltage.The initial phase shift is calculated using where Δ (degrees) is the manually introduced phase shift, T d (s) is the response time, and f (Hz) is the driving frequency.
The galvo mirror inertia also prevented the galvo from following abrupt changes when the scanning direction reversed.The consequence was a reduced duty cycle.To compensate for the reduced scanning range, the driving voltages could be amplified with a factor.For a sinusoidal driving pattern, the positional error for the galvo mirror could be effectively lowered to manageable levels that were comparable to that of the sequential step scan mode.The triangular driving pattern suffered from a reduced duty cycle more severely when compared to the sinusoidal waveform.As the driving frequency went up from 200 to 500 Hz, the duty cycle went down rapidly from 85.4% to 65.8%.

UnderSampling of Driving Voltage Pattern
When galvo mirrors continuously scanned at a moderate rate, the position error suggested that precisely updating the command voltage at every scanning position did not necessarily translate into a more accurate galvo mirror position.Instead, it makes more sense to update the driving signal less frequently because the nonresonant galvo scanner has a rather limited bandwidth.For a resolution of 500 × 500 pixels, i.e., 500 command positions per image line, the sampling rates for the galvo driving signal were set at between 10 KS∕s and 1 MS∕s to find out whether lower sampling rates impacted position error significantly.
In Fig. 2, both the average and the maximum position errors did not significantly decrease once the sampling rate for the galvo driving voltage went beyond 50 KS∕s, i.e., 50 voltage updates per image line.It was also evident that the triangular driving waveform generally resulted in a lower position error compared to the sinusoidal driving waveform.The average and maximum position errors for the triangular driving waveform were below 1.4 and 3.3 mV, respectively.The average and maximum position errors for the sinusoidal driving pattern were 2.3 and 5.8 mV, which almost doubled those of the triangular waveform.Therefore, the triangular driving waveform rendered a more accurate scanning position within the linear scanning range, which was important for spectral mapping.

Effect on Scanned Target Images
The scanned images of a sector star pattern in Fig. 3 demonstrate the phase shift effect and its correction.Essentially, the phase shift created a folding effect along the slow axis direction [Figs.3(a) and 3(d)].For a sinusoidal driving waveform, the effect created difficulty in subsequent image correction using a linearization technique. 12The image in Fig. 3(b) was further distorted due to the varying scanning speed using a sinusoidal waveform.For a triangular driving waveform, the folding effect could be virtually eliminated after phase compensation [Fig.3(e)].However, there still existed a certain amount of image distortions, e.g., elongation, along the edges due to the reduced duty cycle.An effective way to compensate for the reduced duty cycle was to scan a wider range by increasing the driving pattern's amplitude and the number of sampling points accordingly.After the image was acquired with 1.5 times scanning range along the fast axis, the image was cropped to exclude regions displaying significant geometrical distortion due to the reduced duty cycle [Fig.3(f)].The resulting image was distortion free and there was no need for image linearization.It is also important to note that the triangular scanning mode preserved image geometry with high fidelity, whereas image restoration in the sinusoidal scanning resulted in a noticeable sawtooth pattern along the straight edges [Fig.3(c)].

Conclusions
Without adjunct imaging techniques such as white light microscopy within the same system, calibrating a linear galvanometric mirrors-based laser scanning microscope can be challenging at a low image update rate.To drive the galvanometric mirrors at a high frequency, e.g., 500 Hz, the effect of response time of the galvanometric scanner should not be neglected.Previously published correction methods had drawbacks such as imprecise pixel shifting.In this paper, it was found that the error magnitudes could be greatly reduced by compensating for the phase shift due to galvanometric mirror response time.The effective combined hardware and software approaches achieved a position error level comparable to that of the sequential point scanning mode, where the effect of response time was absent.It was also found that an update rate beyond 100 samples per cycle to drive the galvanometric mirror might not be useful in lowering the position error during a high speed scanning.The position error for a sinusoidal driving waveform is generally twice that of a triangular waveform.The image acquired using a triangular driving waveform achieved the best resolution and minimum image distortion.
2 deg), the maximum input frequency could go up to 1 KHz.The galvo driving board accepted external command input from a DAQ card.The driving board provided diagnostic pins with voltage signals proportional to the position of the scanner mirror.A multifunction DAQ card (NI USB-6363, National Instruments, Austin, Texas) drove the galvo, acquired APD and PMT output, and detected the galvo mirror position diagnostic signals.

3. 1
Driving Pattern, Frequency, and Position ErrorTo find out the position error varying pattern versus the driving frequency, the galvo mirror driving signal frequency changed from 100 Hz to 1 KHz at an interval of 100 Hz.Sampling rates ranged from 100 to 500 KS∕s.Results from the sinusoidal driving waveform showed that the position error varying pattern closely resembled the corresponding galvo mirror driving pattern, suggesting excellent linearity.The response time translated into a phase shift between commanded and actual movement patterns, thus it was possible to correct position error through phase compensation.The amplitudes for position error pattern with sinusoidal driving waveform were proportional to the sine values of the phase shift.The position errors for a triangular driving pattern were trapezoids.To find out the achievable minimum position error obviating the effect of response time (∼300 μs), a sequential step scan mode was implemented.Under this mode, the galvo scanner stayed for 500 μs after each position command, then the actual position voltage signal was measured.The resulting position error was a combination of position error and the readout error of the DAQ card (∼0.15 mV).Calculated from 200 readings, the achievable minimum position error had an average of 0.68 mV and a maximum of 2.2 mV.

Fig. 2
Fig.2Maximum and average position error for sinusoidal and triangular waveform when updated with different sampling frequencies.Opened square: sinusoidal maximum; filled square: sinusoidal average; circle: triangular maximum; triangle: triangular average.

Fig. 3
Fig. 3 Distortion correction of a section star pattern image.For a sinusoidal driving waveform, image (a) without and (b) with phase shift corrected, (c) image corrected with pixel relocation algorithm.For a triangular driving waveform, image (d) without and (e) with phase shift corrected, (f) image acquired with increased scanning range showing the region of interest.(Image resolution 500 × 500 acquired at 2 fps).

3. 5
Live Cell Imaging Reflectance confocal and TPEF images of live T lymphoma cells were taken.The confocal images [Figs.4(a) and 4(c)] clearly show the cell membrane and cytoplasm.In the TPEF images, the cell membrane and nucleus membrane stained with FM1-43 fluorescence dye could be clearly distinguished from the rest of cell by their strong fluorescence.Cell images without phase correction show a folding effect similar to that of the section star target.Without prior knowledge of the individual cell shapes and spatial arrangement in the culture medium, the distortions might be otherwise considered as cells with abnormal morphology, undergoing mitosis, or simply overlapping with each other.