## Abstract

We investigate theoretically and experimentally the parameters governing the accuracy of correction in modal sensorless adaptive optics for microscopy. On the example of two-photon fluorescence imaging, we show that using a suitable number of measurements, precise correction can be obtained for up to 2 radians rms aberrations without optimising the aberration modes used for correction. We also investigate the number of photons required for accurate correction when signal acquisition is shot-noise limited. We show that only 10^{4} to 10^{5} photons are required for complete correction so that the correction process can be implemented with limited extra-illumination and associated photoperturbation. Finally, we provide guidelines for implementing an optimal correction algorithm depending on the experimental conditions.

© 2012 OSA

## 1. Introduction

Adaptive optics (AO) is an effective method to restore the quality of images recorded within aberrating samples. It aims at compensating for optical aberrations introduced by the imaging system and the sample, by use of an active element such as a deformable mirror or a spatial light modulator. In particular, AO has proven valuable to improve the signal and the resolution in non linear microscopy of complex samples. In these point-scanning microscopies, only the distortion of the excitation wavefront affects the image quality. Several methods can be used to measure this distortion and compensate for it [1–6]. The accuracy of the correction achieved with these techniques, however, has so far hardly been discussed in the literature.

In this article, we aim at characterising the parameters governing the accuracy of correction in sensorless, modal adaptive optics. This correction method, originally developed by Booth et al. [1], is based on the optimisation of a metric related to the quality of the images using a modal decomposition of aberrations and a model of the influence of aberrations on the variation of this metric. One advantage of this approach is that it is easily integrated in an existing microscope as it only requires the addition of a deformable mirror. Furthermore it is based on a limited number of measurements and provides fast correction compatible with *in vivo* imaging [7].

Here we investigate the parameters governing the accuracy of correction for both large and moderate amounts of initial aberrations. We present results on two-photon excited fluorescence (2PEF) microscopy and we derive guidelines for choosing an optimal correction algorithm. Since the optimisation method is similar for other non linear signals, extension to other techniques such as third-harmonic generation (THG) is straightforward.

## 2. Principle of model-based modal aberration correction

In modal AO, the phase aberration at the entrance pupil of the objective is represented as a linear combination of phase distribution functions, or aberration modes (e.g. Zernike modes, see appendix A). First, these modes are combined with tip, tilt and defocus to ensure that they do not induce any lateral or axial shift of the images (see appendix B for more details). The principle of correction is then to optimise the correction of N aberration modes by maximising an image quality metric M, e.g. the average intensity of the image. The metric is chosen so as to reach a maximum in the absence of aberration, and to exhibit no secondary maxima.

The principle of the optimisation algorithm is the following. For each aberration mode in turn, P images are recorded with different known amplitudes of aberration (bias) applied in the probed mode using a wavefront-shaping device such as a deformable mirror (Fig. 1(a)), and the values M are subsequently calculated from the images (Fig. 1(b), left; blue and green dots). The location of the maximum for M, corresponding to the best correction in the considered mode, is then inferred using the measured values and a model for the metric curve as a function of aberrations (purple dots). Finally, the correction is simultaneously applied in each of the modes using the same wavefront-shaping device (orange dot). Since the measurement for a bias set to zero (blue dot) is used for each of the modes, the total number of measurements is (P-1)N+1. In the following, this type of algorithm will be referred to as “2N+1 algorithm” (for P=3), “4N+1 algorithm” (for P=5),“8N+1 algorithm” (for P=9), etc.

Alternatively, the correction can be applied sequentially in one mode before the measurements for the next mode are performed (Fig. 1(b), right). In this case for the same value of P the number of measurements is slightly greater (P×N) as the measurement at zero bias must be repeated for each mode. In the following, this type of algorithm will be called “3N algorithm” (for P=3), “5N algorithm” (for P=5),“9N algorithm” (for P=9), etc.

In order to achieve efficient correction when sequentially optimising the modes, the different aberration modes should have independent influence on the metric, so that aberration in one mode does not influence the correction in others. For small amounts of aberrations, the metric M can be expressed as a function of aberrations as [4, 8]:

where**a**is the vector of coefficients of aberration in different modes, and the matrix

**A**describes the influence of each aberration mode on the value of M. The diagonal elements of

**A**are the mode eigenvalues and the non-diagonal elements are the crosstalks between different modes. Under this assumption, the crosstalks are independent of the amount of aberration, and can thus be suppressed using an appropriate linear transformation of the initial mode basis. This transformation can be determined theoretically or experimentally (see [8] for more details), and its use is essential to the quality of the correction when the initial crosstalks are significant. This is the case in particular when the symmetry of the modes does not match that of the imaging process. An example is the case of Zernike modes in structured-illumination microscopy with a one-dimensional grid pattern [8]. Another example is the case where the eigenmodes of the correction device are used [7]. In these particular examples, the measured crosstalks were up to 100% of the eigenvalues, so that accurate correction could not be achieved even after several iterations of the correction algorithm without linear combination of the modes.

On the other hand, complete suppression of the crosstalks requires careful calibration of the experimental setup so that in many cases residual crosstalk may remain. Additionally, we observed experimentally higher order nonlinear terms in the case of large amounts of aberration, which cannot be cancelled out with a linear transformation of the set of aberration modes. It is therefore relevant to investigate the accuracy of correction achieved in presence of residual crosstalk for various amount of initial aberration and correction algorithms.

In this article, we studied experimentally the accuracy of correction in 2PEF microscopy for various correction algorithms and parameters. The experimental setup is presented on Fig. 1(a). Here we used the intensity (mean pixel value) of the images, which has been shown theoretically and experimentally to be a suitable quality metric for 2PEF microscopy [4], and a set of 11 low-order Zernike modes excluding tip, tilt and defocus (z=5 to 15, see Appendices A and B). The command voltages sent to the deformable mirror to produce these modes were determined as described elsewhere [9]. When the two-photon intensity of the images is used as metric M, some of these modes exhibit moderate crosstalks of 10 to 15% [10]. Additional higher order variations of the metric also arise for certain modes for larger amplitude of aberrations. For comparison, we also used modes for which the linear crosstalk had been removed.

## 3. Influence of residual linear crosstalk

The accuracy of correction was measured as follow: a fixed, stained rosemary stem slice exhibiting almost no photobleaching was used as a test sample. First, aberrations in all modes were corrected as precisely as possible with several iterations of the 5N correction algorithm. In the following, we always restricted ourselves to a fraction of the field of view sufficiently small to ensure that initial aberrations were homogeneous, so that residual local aberrations would not influence our results. As a second step, we used the DM to introduce a known amount of aberration randomly distributed amongst the 11 studied modes, subsequently referred to as initial aberration. Finally, assuming this initial aberration to be unknown, we chose one of the possible algorithms (2N+1, 3N, 4N+1, etc.) to blindly measure and correct for it. The final (residual) aberration was then calculated as the difference between the initial (introduced) aberration and the blindly measured aberration. This process was iterated 100 times for each set of parameters. The amplitude of aberration is always indicated in terms of the root mean square (rms) value of the phase profile, in radians, so that it corresponds to the geometric sum of the aberration coefficients in each mode, and that the corresponding Strehl ratio can be inferred as exp [−rms^{2}].

Let us first consider the case of small amounts of aberrations (up to 0.5 rad rms). As expected, after one pass of the 2N+1 algorithm, the correction is less precise when the crosstalk is not suppressed than in the case of independent modes (Fig. 2). The difference is small, however, due to the modest values of the crosstalks involved here. Furthermore, the residual error also increases with the initial amount of aberration in the case of orthogonal modes. For larger amounts of aberrations, no difference is even observed between the two sets of modes. This is due in part to the presence of higher order crosstalk terms (Fig. 1(c), right) that cannot be suppressed by linear combination of the modes. In the following, we will thus concentrate our analysis on the use of Zernike modes to assess the accuracy that can be achieved in this case.

## 4. Influence of the measurement bias in a 3-measurements scheme

On top of the presence of crosstalk between the modes, another significant source of error is that the correction relies on the estimation of the location of the peak of the metric using a finite number of measurements and a model for the curve of the metric as a function of aberrations.

In the case of 2PEF image intensity (amongst others), M exhibits a quadratic dependence on small amplitudes of aberration (see equation 1). For larger amplitudes, it is usually difficult to derive an analytical expression, so that the shape of the curve is determined experimentally. Depending on the type of microscopy and the chosen metric, this shape may vary: for example, a Gaussian shape was found for image sharpness in THG microscopy [7]. Here, we found on a variety of sample, including live *Drosophila* embryos and fresh mouse brain tissue, that the shape of the curve was well described by the square root of a Lorentzian curve (see e.g. Fig. 3(c)), a shape which we used throughout this paper. We found, however, that using a Gaussian or Lorentzian fit did not significantly affect the accuracy of correction. In any case, the results presented here can be straightforwardly extended to the case where another such simple function is used to fit the variations of M as a function of aberrations.

In such case, the variation of M with the amplitude of aberration is fitted using three free parameters per mode : the width, centre and amplitude of the curve. As a result, a minimum of three measurements per modes are required to locate the maximum for M. In the 2N+1 algorithm, the number of measurements for correction is thus minimised, but the fitted values for the parameters are strongly affected by variations on any of the measurements: in presence of noise in the signal, the calculated value for the centre varies and significant aberration estimation error may arise, depending on the initial aberration and on the measurement bias. This is illustrated on Fig. 3, where the amplitude of the bias is varied from 0.5 to 2 radians.

Although for small aberrations, the best accuracy is achieved with a small bias (0.5 radians), the correction quickly deteriorates when the initial aberration reaches 0.5 radians. Indeed, one can intuitively conceive that the error resulting from a small fluctuation becomes more significant when the centre is outside or near the border of the range encompassed by the three measurements. Conversely, using larger biases allows correcting for slightly greater amounts of aberrations. The range does not improve much, however, because the influence of noise also depends on the local slope of the curve at the chosen bias: when using a 2 rad bias, for example, the two side points are located in a portion of the curve where the slope is much smaller than with a bias of 0.5 or 1 rad, so that a small fluctuation in one of these two measured values results in a larger error in the determination of the location of the peak of the curve.

Ideally, when using only three measurements, the bias should therefore be chosen to be roughly equal to the half-width of the curve of M as a function of aberration whenever this width is approximately known. In order to improve the accuracy of correction, the number of measurements per mode should instead be increased.

## 5. Influence of the number of measurements per mode

Indeed, accuracy is greatly improved when increasing the number of measurements from P = 3 per modes to P = 5 (Fig. 4), since noise in one of the measurements has a lesser impact on the localisation of the maximum of the metric M. A slight further improvement is obtained for P = 9, but at the expense of a doubling of the number of measurements. Since we aim at limiting exposure, P = 5 appears an optimal compromise between limited exposure of the sample and stability of the correction algorithm. This result can be extended to more complex curve shapes with more free parameters by accordingly increasing the number of measurements P.

Still, the range over which the final error is below 0.325 radians (corresponding to a Strehl ratio of 0.9) is only about 0.6–0.7 radians, due to residual crosstalks. In order to improve the range of correction, a sequential algorithm can be used as described on Fig. 1(b), right: it is easily understandable that the effect of crosstalks is mitigated in this case, as demonstrated on Fig. 5 for P = 5. In the case of a 5N algorithm, aberrations up to 1 rad rms can be accurately corrected, at the expense of a relatively low (N-1) increase of the number of measurements.

If an even greater dynamic is required, several iterations of the algorithm can be used, as illustrated on Fig. 5 for the 4N+1 and the 5N algorithms : with 3 iterations, up to 1.6 radians of aberrations can be efficiently corrected for (if the worst result in 100 trials is considered). It should be noted that such a large amount of aberrations is rarely encountered in practice and corresponds to a highly distorted image. Such aberrations may be found when imaging deep within a sample, but in this case intermediate corrections can be performed at intermediate depths within the sample, so that more moderate amounts of aberrations are corrected incrementally as one focusses deeper. Nevertheless, it is interesting to see that even for very large amounts of aberrations, correction can be achieved efficiently even without fully optimising the correction modes.

## 6. Signal level and accuracy of correction

In the case of such large aberration amplitudes, a significantly greater number of measurements is required than in the previously demonstrated 2N+1 algorithm [4]: this number can reach up to 15N measurements for 3 iterations of the 5N algorithm, that is 165 measurements if N=11 as in the experiments shown here. Although this is still well below the numbers encountered with a random search optimisation algorithm [11], this is a concern for applications in biological imaging: photobleaching and photoperturbation limit the number of exposures that can be used, and the acquisition time needed for such a large amount of data is also limiting. In order to mitigate this effect, we investigated the signal level required for accurate correction by modelling the effect of photon noise on the correction accuracy.

Let us consider that for each mode *i*, the theoretical curve *f* (*a** _{i}*) for M perfectly fits the noiseless experimental data, and that the only sources of imprecision in the measurements are the shot noise in the signal and the dark noise from the detectors. If the fit parameters (amplitude, width, centre and if required offset due to the dark noise) are perfectly known, the residual error between the fitting curve and the measurement points,
${\epsilon}_{\mathit{noise}}={\sum}_{j=1}^{P}{(f({a}_{i}={b}_{j})-{m}_{j}^{(i)})}^{2}$ (with

*a*

*the amplitude of aberration in mode*

_{i}*i*and ${m}_{j}^{(i)}$ the

*j*th measurement in mode

*i*performed with bias

*b*

*), is given by the sum of the square of the noise in each measurement. Assuming that the dark noise also exhibits a Poissonian distribution, the error becomes :*

_{j}*N*is the total number of photons in the P measurements of one mode

_{tot}*i*, and

*B*is the average value of the dark noise. Let us now assume that there is no noise in any of the P measured values. For each mode

*i*, the total squared difference between these values and the fitting function

*f*is given by :

*I*

_{0},

*w*,

*B*,

*c*are respectively the estimated amplitude, width, offset and centre of the curve, and

*I*

_{0}

*,*

_{c}*w*,

_{c}*B*,

_{c}*c*are their true values. If the parameters are set to their correct values, this error is zero. If now a small error

_{c}*dc*is introduced on

*c*, the error becomes :

*f*are all taken at

*I*

_{0}

*,*

_{c}*w*,

_{c}*B*,

_{c}*c*and $\frac{\partial {I}_{0m}}{\partial c}$, $\frac{\partial {w}_{m}}{\partial c}$, $\frac{\partial {B}_{m}}{\partial c}$ are the partial derivative of the fitted values of

_{c}*I*

_{0},

*w*,

*B*as a function of the value set for

*c*. When a least square fit is performed,

*ε*is the quantity that is minimised and thus yields the residual error when

*c*is evaluated with an error of

*dc*. It is therefore reasonable to assume that the error

*dc*on the value of

*c*due to the presence of noise is obtained by setting

_{c}*ε*(

*dc*) =

*ε*, so that :

_{noise}Since this is valid for the N modes and assuming that the N errors are independent (which is true if the crosstalks are negligible because several algorithm iterations are used or the initial aberration is small), the total correction error is obtained by multiplying this value by $\sqrt{\text{N}}$.

To test this model, we again performed correction of known amounts of aberrations in 11 Zernike modes, using a 9N algorithm, this time while varying the number of photons used for each aberration mode. Here a fixed error should be added to the total error *E* determined above to account for imprecise knowledge of the initial aberration :

The results are displayed on Fig. 6. The black curve is the theoretical curve from equation 6, where *F* has been calculated from the measured shape of the curve of M as a function of aberrations and the values of the biases (Fig. 6, inset). Dark noise level *B* was determined by acquiring an image with equivalent size and pixel dwell time in absence of sample, and *E*_{0} was estimated by considering the best accuracy achieved, obtained for *N _{tot}* = 6 × 10

^{5}: since the initial correction was performed using this value for

*N*and set as zero, and assuming that the initial error and the subsequent measure are independent, the value obtained at this point is $\sqrt{2}{E}_{0}$, so that

_{tot}*E*

_{0}= 0.0148. The theoretical curve is thus plotted with all parameters fixed and remarkably fits the experimental data.

This demonstrates that the correction accuracy is ultimately limited by the number of photons used for correction. This is an important point, as it permits estimating beforehand what accuracy can be achieved, or alternatively what level of exposure is necessary to achieve a given accuracy. Here it can be seen that only about 2000 photons per mode and per iteration are necessary to reach a Strehl ratio of 0.9, so that even in the case of 3 iterations, the total number of detected photons required for 11 modes is about 6.6 ×10^{4}. This is illustrated on Fig. 7 on a lily pollen grain imaged with 3-colour 2PEF. Here, both system aberrations and sample-induced distortion (mostly due to the index mismatch between the sample embedding medium and the objective immersion medium) are corrected. The total corrected aberration in (b) is 0.96 rad rms, and correction is performed using 2 iterations of the 5N algorithm. Here the total number of photons used for correction was 3.9 ×10^{5}, about 9 times the minimum value determined above. This value was obtained at the maximum speed of our scanner and using the minimum power that could be set for the excitation source. As expected, the correction results in a significant improvement in brightness and resolution of the image.

## 7. Discussion

The results presented in this article provide guidelines for choosing the optimal correction algorithm in sensorless AO, and for predicting the correction accuracy. The choice can be adapted as a function of the sample and the conditions of correction: for example, if the correction needs to be updated as a function of time or depth, it is expected that the variations from one correction to the next should be limited. In this case, one iteration of the 2N+1 algorithm is usually sufficient to provide accurate correction with minimal illumination of the sample. If moderate amounts of aberration are present (0.5 to 1 rad rms), or if the aberration amplitudes are unknown, the 5N algorithm provides a better estimate, and can be used for up to 2 rad initial aberration provided that 2 or 3 iterations are used. This can be adjusted on a case by case basis, e.g. if the estimated aberration at the first round exceeds 1 rad rms.

The accuracy of correction can be further improved in case of a priori knowledge of aberrations. For example, if it is known that most aberrations are distributed amongst a small number of modes, greater accuracy is achieved if these modes are corrected before measuring aberrations in the remaining modes. This might occur, for example, in relatively homogeneous samples with a refractive index different from that of the immersion medium of the objective, in which case spherical aberration might predominate over other aberrations. Such customisation of the correction scheme is easily implemented on a case by case basis by simply reordering the aberration modes used by the algorithm.

We also demonstrated that accurate correction can be achieved even using a set of modes with residual crosstalks for the chosen metric. This is of practical importance, first because it simplifies the initial calibration process of the adaptive microscope: once the wavefront shaping device (deformable mirror or spatial light modulator) has been calibrated to produce a chosen set of modes (Zernike modes, mirror eigenmodes, etc.) of which tip, tilt and defocus have been excluded, this set can be used without further processing to correct for aberrations in the appropriate modal scheme. This also implies that the correction process can accommodate for distortions such as caused by a compact XY scanner in the microscope: indeed in such a scanner, the scanning mirrors are not perfectly conjugated with the entrance pupil of the microscope, inducing a small movement of the image of the mirror in that plane (if the scanner is, as here, positioned in between the deformable mirror and the objective) or a movement of the excitation intensity profile on the deformable mirror (if the scanner is placed before the deformable mirror). In both cases, the crosstalks between the modes might as a result vary with the scan angle, so that they can only be cancelled in a small region of the field of view. Accommodating for such distortion therefore permits working with a fixed scheme over the whole field of view of the objective. Finally, using a scheme relatively insensitive to crosstalks implies that the same set of modes can be used if the metric is changed or another control signal is used, for example if a non fluorescent sample is imaged and the third-harmonic generation (THG) signal is used to correct for aberrations [7].

We point out here that our results permit correcting for aberrations with good accuracy, but under the assumption that these aberrations are spatially homogeneous. In case they vary within the field of view, a smaller region must be selected for correction so that they can be measured locally. If the whole field of view is imaged during correction, a mean aberration over the whole image is calculated, with potentially significant residual distortion remaining locally.

Importantly, our results also show that for moderate amounts of aberration, the accuracy of correction is ultimately limited by the number of photons in the images used for correction, and that accurate correction can be achieved with modest signal levels. Since improving the Strehl ratio above 0.9 has little effect on the resulting images, a total residual aberration of 0.2–0.3 is acceptable, so that in the conditions tested here a value of only about 2000 photons per mode provides good correction accuracy. This value depends little on the number of measurement per mode P, but rather, through the parameter *F* (see equation 4), on the modulation depth of the metric curve that is probed during these P measurements. As a result we note that using a signal that varies faster with the amount of aberrations such as THG [7] would further decrease the number of photons necessary for correction.

We emphasise that our model for correction accuracy as a function of the signal level does not rely on any specific property of the sample, the microscope or the imaging technique: the only assumption that was used is that image intensity is used as a metric, but the model can be straightforwardly extended to the case where, e.g., image sharpness is used, with very similar results. The properties of the sample only play a role in calculating the parameter *F*, which depends on the shape of the curve of M as a function of aberrations. This shape in turn depends mostly on two factors: first, the structure of the sample determines how strongly the signal is affected by aberrations. For example, in two-photon microscopy, it has been shown analytically and experimentally that the signal from point objects in a 2D image is more affected than that of a bulk sample [4]. As a result, the brightness of a sparse sample will be more affected by aberrations than that of a relatively homogeneous sample, and *F* will be greater for the former and smaller for the latter. This leads to the intuitive result that a stronger signal is needed to correct for aberrations when this signal is weakly sensitive to aberrations.

Secondly, the shape of the curve of M as a function of aberrations is also affected by aberrations in other modes: if the focal spot is strongly distorted by high order aberration modes, as is the case when imaging deep within highly scattering sample, one particular aberration mode has a lesser effect on an already degraded focussing. In this case, the width of the curve of M as a function of aberration is increased, so that *F* decreases.

Practically, if the exposure of the sample is critical and needs to be optimised, *F* (and hence the optimal exposure during correction) can be calibrated before imaging using a similar sample: for example, it can be expected that when imaging at a given depth in a given region of fresh mouse brain tissue, the shape of the curve for M will be more or less identical from one sample to the next. It can thus be measured as a function of, e.g., depth, excitation wavelength (which might affect aberrations in high order modes) or immersion medium so that the optimal exposure is known once and for all for the subsequent studies. In case exposure is less critical, a conservative value of 10–20 times the threshold obtained here should compensate for a possible drop in modulation of the curve for M in most samples. The results presented here can in summary be easily used for optimising the correction process in any kind of sample.

In this study, we focussed on the widely used 2PEF microscopy. We used image intensity (mean pixel value) as a metric, because it has been proven theoretically and experimentally to yield an accurate estimation of aberrations in 2PEF microscopy. In this case and with the sample studied here, it appears that correction of up to 1 rad aberration can be performed with as little as 2 × 10^{4} photons for 11 aberration modes. As a comparison, a 512 × 512 image with a moderate average intensity of 15 photon counts per pixel corresponds to about 4 ×10^{6} detected photons. Even if the number of measurements is significant, the exposure required for correction is therefore limited and compatible with biological imaging. This number of photons required for correction grows linearly with the number of corrected modes: here we used only 11 low order Zernike modes that could be accurately produced by our deformable mirror, but correction of higher order modes might be beneficial in certain cases. It is beyond the scope of this paper to determine the number of modes that should be used for correction in biological samples, and this question should be addressed in further studies.

Another important parameter for *in vivo* imaging is the time required to perform the correction. Thank to the simplicity of our correction algorithm, the processing time is very small compared to the acquisition time of the data. In our setup, this time was in most cases not limited by the signal intensity, but rather by the speed of our deformable mirror and galvanometer mirrors. The minimum time necessary for each measurement of the metric M was around 60 ms, so that the total time for correction ranged from 1.3 s (2N+1 algorithm, 23 measurements) to 3.3 s (5N algorithm, 55 measurements). In order to keep the number of photons to a low level at this acquisition time, the excitation power was decreased by an amount calculated from the initial image intensity. Once correction was achieved, greater sampling and pixel dwell time were used to increase image quality, so that the acquisition time for the corrected image was usually a few seconds. Although the time required for correction in our setup is still significant, the resulting delay is nevertheless compatible with numerous studies of biological samples, e.g. study of slow developmental processes or of the 3D morphology of tissues, or static aberration correction for the study of a rapid process such as neuronal activity.

Furthermore, it should be noted that contrary to the signal level, this temporal limitation is only due here to the response time of our apparatus, and could straightforwardly be reduced by using faster scanning and deformable mirrors. Instead, the speed limit for the correction can be calculated as the time required to acquire enough photons without saturation of the detectors. Since in nonlinear microscopy the signal is usually created by ultrashort pulses, the saturation when using photon-counting detectors is reached when more than one photon reaches the detector per excitation pulse. This typically becomes statistically significant above one photon detected every 5 pulses: for a typical 80MHz source, the maximum detected photon rate is thus 1.6 ×10^{7} photons/s. As a result, the minimal time required for correction could in principle be decreased to 1.4ms for the 2N+1 algorithm or 3.6ms for the 5N algorithm, enabling fast aberration correction during live imaging.

## 8. Conclusion

In conclusion, we have shown here that modal sensorless AO can provide reliable estimation and correction of aberrations at speed and exposure compatible with biological imaging. We have investigated the parameters governing the accuracy of the correction scheme, and determined optimised settings for good accuracy and minimal exposure of the sample. This work provides practical guidelines for setting up or optimising AO systems on new or existing microscopes, which are briefly summarised below:

- Modal sensorless aberration correction can be implemented using any convenient set of N modes, provided that the crosstalk between the modes for the chosen metric is moderate, i.e. the error induced in mode A by aberrations in mode B does not exceed 10–20% of the amplitude of aberration in mode B.
- If the aberration amplitude is small (0–0.5 rad rms), one iteration of the 2N+1algorithm is sufficient to correct for it. If the amplitude is moderate (0.5–1 rad rms) the 5N algorithm yields accurate results. For greater amplitudes, several iterations may be used.
- When P=3 measurements per modes are used, the bias should be set as roughly equal to the width of the M curve. When P is greater than 3, the probed range can be accordingly extended to ensure stability of the algorithm over a greater aberration range.
- If more than 3 free parameters per mode are used to fit the curve of M as a function of aberration amplitude, the number of measurement per mode, P, should be increased accordingly to ensure good correction accuracy.
- Accuracy can be further increased using a priori knowledge of the aberrations, e.g. by changing the order in which the modes are corrected (modes with large amounts of aberration being corrected first).
- Sampling and illumination can be reduced during correction to minimise exposure. A conservative value of 2 −5 ×10
^{4}photons per mode and per algorithm iteration can be used for accurate correction when phototoxicity or photobleaching are not critical. - If exposure is critical, illumination can be optimised using a priori knowledge of the shape of the curve of metric M as a function of aberrations, which can be measured on a similar sample for calibration.
- Correction should be performed on a region of the field of view over which aberrations are roughly homogeneous, else the correction accuracy may be degraded by residual aberration remaining locally.

## Appendix A Zernike modes and numbering scheme used in this work

Table 1 shows the 15 Zernike modes that were used in this paper.

## Appendix B Experimental removal of residual tip, tilt and defocus from the modes used for correction

When correcting for aberrations it is of utmost importance that the imaged area is not shifted in space during the process, either laterally (by tip and tilt) or axially (by defocus). Movements induced by the modes are therefore corrected by adding the appropriate amounts of tip, tilt and defocus to each of the *i* modes. This is performed experimentally so as to take into account the exact intensity profile of the excitation beam which strongly influences the shift induced by each mode. Our approach is similar to the method described in [12].

The process is illustrated on Fig. 8 on the example of astigmatism: the shift of the images is first measured in two-dimensions by correlating images obtained with different amounts of aberration applied, in each mode *i* as well as for tip, tilt and defocus. The amount of tip and tilt to add to mode *i* is then calculated as the opposite of the ratio between the displacement for mode *i* and that for tip or tilt, respectively. This is also applied to defocus so that subsequent correction for the axial shift does not reintroduce lateral shift.

As a second step, the z-profile of the 2PEF signal from a thin sample (such as a layer of 100 nm diameter fluorescent beads) is acquired for various amount of aberration applied for all modes *i* and defocus in turn. Following the same principle as for the lateral shift, the axial shift for each mode *i* is then removed by adding the appropriate amount of defocus.

## Acknowledgments

This work was supported by the Agence Nationale de la Recherche (RIB2007 program).

The authors thank Guillaume Labroille for fruitful discussions, and Pierre Mahou and Max Zimmerley for technical assistance.

## References and links

**1. **M. J. Booth, M. A. A. Neil, R. Juškaitis, and T. Wilson, “Adaptive aberration correction in a confocal microscope,” Proc. Nat. Acad. Sci. **99**, 5788–5792 (2002). [CrossRef] [PubMed]

**2. **P. N. Marsh, D. Burns, and J. M. Girkin, “Practical implementation of adaptive optics in multiphoton microscopy,” Opt. Express **11**, 1123–1130 (2003). [CrossRef] [PubMed]

**3. **M. Rueckel, J. Mack-Bucher, and W. Denk, “Adaptive wavefront correction in two-photon microscopy using coherence-gated wavefront sensing,” Proc. Nat. Acad. Sci. **103**, 17137–17142 (2006). [CrossRef] [PubMed]

**4. **D. Débarre, E. J. Botcherby, T. Watanabe, S. Srinivas, M. J. Booth, and T. Wilson, “Image-based adaptive optics for two-photon microscopy,” Opt. Lett. **34**, 2495–2497 (2009). [CrossRef] [PubMed]

**5. **N. Ji, D. E. Milkie, and E. Betzig, “Adaptive optics via pupil segmentation for high-resolution imaging in biological tissues,” Nat. Methods **7**, 141–147 (2009). [CrossRef] [PubMed]

**6. **R. Aviles-Espinosa, J. Andilla, R. Porcar-Guezenec, O. E. Olarte, M. Nieto, X. Levecq, D. Artigas, and P. Loza-Alvarez, “Measurement and correction of in vivo sample aberrations employing a nonlinear guide-star in two-photon excited fluorescence microscopy,” Biomed. Opt. Express **2**, 3135–3149 (2011). [CrossRef] [PubMed]

**7. **N. Olivier, D. Débarre, and E. Beaurepaire, “Dynamic aberration correction for multiharmonic microscopy”, Opt. Lett. **34**, 3145–3147 (2009). [CrossRef] [PubMed]

**8. **D. Débarre, E. J. Botcherby, M. J. Booth, and T. Wilson, “Adaptive optics for structured illumination microscopy,” Opt. Express **16**, 9290–9305 (2008). [CrossRef] [PubMed]

**9. **D. Débarre, T. Vieille, and E. Beaurepaire, “Simple characterisation of a deformable mirror inside a high numerical aperture microscope using phase diversity,” J. Microsc. **244**, 136–143 (2011). [CrossRef] [PubMed]

**10. **M. A. A. Neil, M. J. Booth, and T. Wilson, “New modal wave-front sensor: a theoretical analysis,” J. Opt. Soc. Am. A **17**, 1098–1107 (2000). [CrossRef]

**11. **A. J. Wright, S. P. Poland, J. M. Girkin, C. W. Freudiger, C. L. Evans, and X. S. Xie, “Adaptive optics for enhanced signal in CARS microscopy,” Opt. Express **15**, 18209–18219 (2007). [CrossRef] [PubMed]

**12. **A. Thayil and M. J. Booth, “Self calibration of sensorless adaptive optical microscopes,” J. Eur. Opt. Soc. **6**, 11045 (2011).