Practical considerations for high-fidelity wavefront shaping experiments

Wavefront shaping (WFS) is a technique for directing light through turbid media. The theoretical aspects of WFS are well understood, and under near-ideal experimental conditions, accurate predictions for the expected signal enhancement can be given. In practice, however, there are many experimental factors that negatively affect the outcome of the experiment. Here, we present a comprehensive overview of these experimental factors, including the effect of sample scattering properties, noise, and response of the spatial light modulator. We present simple means to identify experimental imperfections and to minimize their negative effect on the outcome of the experiment. This paper is accompanied by Python code for automatically quantifying experimental problems using the OpenWFS framework for running and simulating WFS experiments.

The ability to focus light through scattering media is critical for a wide range of applications, including deep tissue microscopy. However, it is challenging to focus light deep inside opaque media due to inhomogeneities in the refractive index of the medium. These inhomogeneities cause aberrations and scattering that prevent light from forming a diffraction-limited focus, thereby reducing the imaging resolution and contrast [17].

Wavefront shaping (WFS) is a powerful method for focusing light at target positions inside or behind scattering materials. The basic idea of WFS for microscopy is illustrated in figure 1. Here, it is assumed that we use a scanning microscope, and we are interested in focusing the light inside the sample. In the ideal case (figure 1(a)), the sample is transparent and the microscope objective focuses the light at the desired spot. We can describe this focusing as constructive interference, where each part of the converging wavefront interferes constructively at the focal point. When trying to focus light into an aberrating or scattering sample, (figure 1(b)), light coming from different parts of the incident wave picks up different random phase deviations, causing random interference rather than constructive interference. As a result, the intensity in the focus is reduced, and the focus is spread out spatially. In the case of strong scattering, a disordered speckle pattern is formed.

Figure 1. Schematic illustration of wavefront shaping. SLM: spatial light modulator. Objective. a. Focusing inside a non-aberrating sample. b. Focusing inside an aberrating sample results in a distorted focus. c. Focusing inside an aberrating sample with a WFS microscope. By shaping the incoming wavefront with a spatial light modulator, the focus can be restored.

Standard image High-resolution image

WFS works by spatially modulating the incident wavefront to exactly compensate these random phase deviations, restoring constructive interference, causing the light to form a high-contrast, high-intensity focus inside the scattering sample (figure 1(c)). Since the first demonstration of focusing light through opaque scattering objects [39], the field has seen rapid development towards applications in fundamental research, microscopy, endoscopy, communication, and cryptography [3, 9, 12, 16, 27].

The key goal in WFS is to find the unique incident wavefront that maximizes constructive interference in the target focus. A wide range of techniques are already available (see e.g. [13, 16]), and exciting new approaches based on digital twins [25, 32, 45, 48], image-based metrics [46] or deep learning [9] are actively being developed.

One can easily compute the theoretical expected improvement of the focus quality under ideal circumstances [39]. In an actual experiment, however, the measured improvement may be significantly lower. Here, we address the following questions:

What are the basic principles of WFS?How much can I expect WFS to improve the focus?Why does my WFS experiment perform worse than expected?What can I do about it?

This tutorial article is supported by our Python package OpenWFS [35], which includes code for automated analysis and troubleshooting of WFS experiments. The package is available through the standard PyPI package repository [36], and documentation can be found at the Read the Docs website [37]. Throughout this article, we will refer to the relevant functions for detecting specific problems in WFS experiments.

For most of the analysis, we will assume that a 'classical' WFS approach is used to find the optimized wavefront, that is, a phase-stepping technique that uses feedback from the desired focal point [21, 22, 26, 31, 34]. Although this covers only a fraction of the approaches in use, these classical algorithms have the advantage that they can be described analytically, allowing one to prove the convergence, analyze the effect of noise, and compute the expected improvement under a large range of circumstances. Moreover, many of the considerations here are generally valid regardless of the WFS algorithm used to find the optimal wavefront.

After introducing the basic concepts that are needed to understand, run, quantify, and predict the outcome of a WFS experiment, we cover the most common issues influencing the outcome. We will explain how each of these issues affect the enhancement, how we detect or quantify them, and how to reduce their impact. In addition, we will show that the effect of most of these issues can be quantified from regular phase-stepping measurements directly. This allows for an approach where troubleshooting metrics are conveniently built into the WFS algorithm at no extra cost. In addition, we provide a troubleshooter for detecting issues that do require specific measurement procedures to quantify them. We explain how to run the troubleshooter and analyze the troubleshooting metrics in section 8.

2.1. The transmission matrix

We can describe propagation of light through an arbitrary object with a matrix:

Equation (1)

where Ea is the incident field for input mode a, and the summation runs over all optical input modes. Eb is the field at point b where we want to focus the light, i.e. the output mode. When focusing light through a scattering object, t is the transmission matrix. Note, however, that this formalism is valid for any linear system, so tba may also refer to propagation to a point inside a sample, or reflection, or in fact any linear system. Also note that the formalism does not depend on how we represent these modes (e.g. as a Hadamard or Fourier basis). We do restrict ourselves to orthonormal sets of modes, so that we have the simple expression $P_\mathrm = \sum_a\left|E_a\right|^2$ for the total incident power.

The aim of WFS is to find the incident field Ea that maximizes the intensity 2 . The answer to this optimization problem is given by the Cauchy-Schwartz inequality, which states that:

Equation (2)

The first term on the right hand side is a property of the sample. It can be understood in terms of a phase conjugation experiment: imagine we would place a point source in b, and observe the fraction of the total emitted power that propagates to all modes a together. In this case, this fraction is exactly given by $\sum_a \left|t_\right|^2$, which we will denote Tb from here forward.

For a given sample and incident power, the right hand side of this inequality is fixed. It directly follows that at most a fraction Tb of the incident light can be focused at Ib. This maximum is reached when both sides of equation (2) are equal, which is the case when $E_a\propto t^*_$, leading to an optimal value of

Equation (3)

All WFS algorithms for focusing light, in one way or the other, are aimed at determining tba and subsequently displaying $t_^*$ on the SLM.

2.2. Example experimental setup

A typical setup for WFS experiments is shown in figure 2. In this setup, HeNe laser light (Thorlabs, 2 mW, λ = 632.8 nm) is expanded by a beam expander (Thorlabs BE15M-A), and then modulated by a phase-only spatial light modulator (SLM, Hamamatsu LCoS-SLM, X13138 SLM) using a 50$\%$ beam splitter (Thorlabs CM1-BS013). A polarizer (P1, Thorlabs LPVISE100-A) is used to rotate the polarization to the linear polarization required by the SLM. A half wave plate (HWP, Thorlabs WPH10M-633) is used to control the total power entering the system.

Figure 2. Example schematic of a simple WFS setup. HWP: half wave plate, P: polarizer, M: mirror, ×15: beam expander, SLM: spatial light modulator, BS: 50$\%$ non-polarizing beam splitter, obj: objective lens, CMOS: complementary metal oxide semiconductor camera. The lens focal distances are typically chosen such that the active SLM area is conjugated to the objective back pupil, and slightly overfills aperture. For this example: $L_1: f = 200$ mm, $L_2: f = 75$ mm, $L_3: f = 75$ mm, $L_4: f = 150$ mm, $L_5: f = 50$ mm.

Standard image High-resolution image

A 4f system images the SLM onto the back focal plane of a microscope objective (Zeiss A-Plan 100×/0.8 M27), which focuses the light onto the sample. After transmitting through the sample, the light is collected by another objective lens (Zeiss A-Plan 100×/0.8 M27), and recorded by a CMOS camera (Basler acA640-750um). A 4f system images the back surface of the sample onto a CMOS camera. This camera provides the feedback signal for WFS.

Note that there are many other options to provide the feedback signal. A mechanism to obtain a feedback signal that is correlated with localized light intensity is referred to as a 'guidestar'. This guidestar can be a localized physical object (e.g. a fluorescent particle), as well as a localized physical phenomenon (e.g. multi-photon fluorescence or the photo-acoustic effect). [13]

2.3. Phase-stepping interferometry

Each element of the transmission matrix tba corresponds to an initially unknown complex optical field that must be measured. The phase of optical fields can typically not be measured directly. However, we can indirectly measure the relative phase of the field with a technique known as phase-stepping or phase-shifting interferometry [18].

We will explain the use of phase-stepping interferometry with the Stepwise Sequential Algorithm (SSA) as an example, but the technique is generally applicable. For SSA, the SLM pixels are divided into segments. We iterate over each segment a to measure its contribution $M_a = t_E_0$ to the field at feedback location b. E0 is the field amplitude at the SLM surface, which is assumed to be equal for all segments. If the SLM is illuminated unevenly, we can include the illumination profile in the matrix element tba (c.f. Section 4.2). The rest of the segments are used as static reference and produce the field R at b.

In each iteration, we phase-modulate the segment of interest by a set of phases φp to produce the field $M_a e^$ at b. In other words, the relative phase between the fields is varied between 0 (including) and 2π (excluding) in $P\unicode 3$ steps. Due to the interference between light originating from the modulated segment $M_a e^$ and light originating from the other segments R, the feedback intensity will respond sinusoidally:

Equation (4)

where

Equation (5)

$I^_$ corresponds to the intensity in output mode b, measured when applying phase φp to the modulated input mode a. Note that the terms with $M_a R^*$ and $M_a^* R$ carry a factor $e^$. By combining the measurements $I^_$ in a Discrete Fourier Transform (DFT), these terms can be isolated:

Equation (6)

where k is an integer in the range:

Equation (7)

It follows that $F_ = M_a R^* = t_E_0R^*\propto t_$. So we can find the optimal input wavefront as:

Equation (8)

In theory $I^_$ follows a sinusoid with an offset, hence only $F_, F_$ and $F_$ are non-zero. However, in real measurements, the values for $\left|k\right| \gt 1$ are never exactly zero, due to noise in the measurements and imperfect SLM response calibration (see section 6.1).

2.4. Enhancement

One way to quantify the improvement of the focus, is the fraction of the incident power that is focused into mode b, i.e. the fraction $S\equiv I_b/P_$. In adaptive optics, it is usually assumed that all light is scattered in the forward direction, so that $T_b = 1$, and S is called the Strehl ratio [17]. From equation (3), it is direct that in this case the optimal wavefront achieves perfect diffraction-limited focusing: S = 1.

For a scattering sample, it is often not possible to determine exactly what fraction of the incident power reached the focus. Therefore, it makes more sense to use a relative measure $\eta\equiv I_b/I_0$, which is called the enhancement [39]. The reference intensity I0 is technically defined as the intensity in point b, averaged over all possible 'similar' samples for a given optimized incident wavefront [34], i.e.

Equation (9)

where $\tilde_$ is the transmission matrix for a different sample with the same scattering strength, thickness, etc and $\left\langle \cdot \right\rangle$ denotes averaging over all such samples.

For strongly scattering samples, $\tilde_$ and tba will be completely uncorrelated. Moreover, we assume that all elements tba are statistically independent and identically distributed for all modes a [10], so that $\left\langle t_^* t_}} \right\rangle = \delta_}}\tau$ where $\delta_}}$ is the Kronecker delta, and the value $\tau = \left\langle \left|t_\right|^2 \right\rangle$ is an average 'mode-to-mode' transmission coefficient which does not depend on mode index a. We can now use these statistical properties and insert $E_a = E_0 t_^*$ into equation (12) to find

Equation (10)Equation (11)Equation (12)

In practice, I0 can be determined by translating the sample, while keeping the shaped wavefront constant, and averaging measurements taken at different positions. Alternatively, the average speckle background can often be used [34]. Expressions for the expected enhancement as a function of the number of modes, and for phase-only light modulation are given in section 4.1 and section 4.2, respectively.

In an experimental setting, the generated wavefront always deviates from the optimal one, so that the fraction of light that reaches the focus is always lower than Tb. To account for these imperfections, we describe the incident field as a superposition of the optimal field and a residual field that is orthogonal to the optimal one [41]:

Equation (13)

Here, the incident fields are normalized such that $\sum_a \left|E_a^\text\right|^2 = \sum_a \left|E_a^\text\right|^2$. The factor γ denotes the fraction of the incident field that is shaped correctly. It is defined as the correlation coefficient of the ideal wavefront $E_a^\text$ and the actual wavefront Ea [41]:

Equation (14)

By definition, the residual field does not contribute to the target intensity at all. Therefore, the fraction of light that reaches the focus equals $\left|\gamma\right|^2 T_b$. The factor $\left|\gamma\right|^2$ is called the fidelity, and equals the fraction of the incident power that is shaped correctly. For ideal control over the incident wavefront $\left|\gamma\right|^2 = 1$. In practice, however, there are many effects that reduce the fidelity. In this paper, we will treat the following effects:

the effect of a finite number of modes $\left|\gamma_N\right|^2$ the effect of phase-only modulation $\left|\gamma_A\right|^2$ the effect of non-modulated light $\left|\gamma_0\right|^2$ the effect of imperfect phase modulation $\left|\gamma_\phi\right|^2$ the effect of phase jitter $\left|\gamma_J\right|^2$ the effect of noise in the feedback signal $\left|\gamma_S\right|^2$ the effect of sample drift and decorrelation $\left|\gamma_D\right|^2$.

For each of these values, we will estimate the expected value, averaged over noise and over all 'statistically similar' samples; that is, samples that are macroscopically the same, but differ in the microscopic placement of the scattering particles. This averaging is denoted by $\left\langle \cdot \right\rangle$.

We assume that each of these effects is uncorrelated with the other, meaning that we can multiply the fidelities and simply estimate the expected intensity in the target focus as

Equation (15)

Here, all factors were assumed to act independently, except for the terms $\left|\gamma_A\right|^2\left|\gamma_N\right|^2T_b$, which were averaged together, as described in Sections 4.1 and 4.2. Clearly, it is essential that all fidelities are as close to 1 as possible. For each of these factors, we now describe how to estimate it from the experimental data, and what measures can be taken to increase it if it is too far below 1.

4.1. Finite number of modes

So far, we considered $\sum_a$ a summation over all optical input modes. In practice however, a WFS experiment only controls a fraction of the incident angles and positions, and often only a single polarization. We now analyze how this limitation affects WFS fidelity.

First, consider the case of ideal phase and amplitude modulation, where the SLM generates the optimal field $E_a = E_0 t^*_$ for a finite number of modes $a\unicode N$, and that $E_a = 0$ for a > N. Inserting this field into equation (14) gives

Equation (16)

Unsurprisingly, this ratio equals 1 when all optical modes are considered, and it reduces when N decreases. Intuitively, one can interpret $\left|\gamma_N\right|^2T_b = \sum_a^N\left|t_\right|^2$ as the fraction of the light that would propagate from a light source at point b into the N modes controlled by the SLM in a 'time-reversal' experiment.

For each additional mode, we need additional measurements to determine tba . When fewer modes are considered, the WFS process will be faster, at the cost of reducing the fidelity. In general, not all modes contribute equally. In this case, it is beneficial to choose a set of modes that contributes most to the intensity, and discard all other modes. For example, for a sample that mainly scatters light in the forward direction, one can choose a basis consisting of smooth modes that correspond to small angular deviations [21]. For a homogeneously illuminated SLM, we can thus use the same expression as for ideal phase and amplitude modulation (equation (16)).

A similar approach is taken in adaptive optics, where a set of low-order Zernike modes may be used [17]. There is, however, a key difference: in adaptive optics the modes are used to express the phase of the light rather than the field. This results in a highly non-linear response for phase variations $ \gt 1\,\mathrm$, causing many of the algorithms used in adaptive optics to fail if aberrations are strong [28].

In practice, the set of modes should be chosen correctly even for a strongly scattering sample. For example, in the pupil-conjugate geometry shown in figure 2, the SLM is mapped to the back pupil of a microscope objective. If we choose modes that correspond to (groups of) pixels, some modes may correspond to pixels that are blocked by the back pupil of the objective (see figure 3). Clearly, including these modes in the WFS process costs time and does not contribute to the enhancement of the focus.

Figure 3. Measured beam location on the SLM. Each segment's displayed brightness corresponds to the measured contribution $\left|t_\right|^2$ for that segment.

Standard image High-resolution image 4.1.1. Enhancement in strongly scattering samples

For strongly scattering samples, we can use the assumptions described in section 2.1 to compute the estimated enhancement. Firstly, we use the fidelity in equation (16) to find the optimized intensity of

Equation (17)

Together with the reference intensity $I_0 = \tau P_\text$ (equation (12)), we get an enhancement of

Equation (18)

Which averages to

Equation (19)

Therefore, for strongly scattering samples and ideal WFS, the expected enhancement is equal to the number of segments. Due to the experimental factors discussed below, in practice a lower value (around 0.5 N for strongly scattering samples in our typical experiments) results.

4.1.2. Automatic detection and quantification

After running a WFS algorithm, we have access to the measured values of $\left|t_\right|^2$ for each mode a (see section 2.3), which we call the contribution of that mode. By plotting the contribution for each mode, as in figure 3, we can verify if all modes contribute approximately equally, or whether some modes may be omitted. In practice, the modes that contribute will often have a different contribution depending on their position on the SLM or shape of the generated optical mode. In section.

Comments (0)

No login
gif