{'fraction_non_alphanumeric': 0.04821352957495583, 'fraction_numerical': 0.016776906566209646, 'mean_word_length': 4.273987371014939, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
When topological derivatives met regularized Gauss-Newton iterations in holographic 3D imaging

We propose an automatic algorithm for 3D inverse electromagnetic scattering based on the combination of topological derivatives and regularized Gauss-Newton iterations. The algorithm is adapted to decoding digital holograms. A hologram is a two-dimensional light interference pattern that encodes information about three-dimensional shapes and their optical properties. The formation of the hologram is modeled using Maxwell theory for light scattering by particles. We then seek shapes optimizing error functionals which measure the deviation from the recorded holograms. Their topological derivatives provide initial guesses of the objects. Next, we correct these predictions by regularized Gauss-Newton techniques. In contrast to standard Gauss-Newton methods, in our implementation the number of objects can be automatically updated during the iterative procedure by new topological derivative computations. We show that the combined use of topological derivative based optimization and iteratively regularized Gauss-Newton methods produces fast and accurate descriptions of the geometry of objects formed by multiple components with nanoscale resolution, even for a small number of detectors and non convex components aligned in the incidence direction. The method could be applied in general imaging set-ups involving other waves (microwave imaging, elastography...) provided closed-form expressions for the topological and Frechet derivatives are determined.


Introduction
Digital in-line holography is a promising tool for high speed three dimensional (3D) imaging of live cells and soft matter [21,44]. It can achieve high temporal (microseconds) and spatial (nanometers) resolution while avoiding the usage beam illuminates a sample. The resulting hologram is recorded on a CMOS camera. (b) Schematic representation of an in-line holography set-up used in the algorithms and simulations presented in this paper. The incident reference wave Einc interacts with the sample Ω generating a scattered wave Esc. The interference pattern created by both of them forms the hologram Imeas = |Einc + Esc| 2 . We have superimposed on the CMOS screen the hologram created by a sphere placed at a distance zs = 5 µm (1µm=10 −6 m) from that screen, when a 660 nm (1 nm=10 −9 m) laser is emitted.
of toxic stains and fluorescent markers. Holograms are two-dimensional (2D) light interference patterns that contain information about the 3D positions and optical properties of an object or set of objects [56]. Figure 1 illustrates the formation of an in-line hologram from the interference of the light field scattered from a sample and the undiffracted beam [34]. In tracking experiments, one expects to infer the position of objects as a function of time analyzing a time-series of holograms. Instead, in characterization experiments, one aims to extract the size, shape and refractive index of the particles under study. Traditional optical reconstructions shine light back through the hologram to produce a 3D image, though this process may introduce a number of artifacts for sizes comparable to the employed light wavelength [54]. In contrast, digital holography aims to achieve numerical reconstructions, facing the inherent difficulty of computationally recovering 3D geometries from the 2D holograms they generate. From the mathematical point of view, finding objects and their optical properties from holograms is an ill-posed inverse scattering problem.
Recent work has relied on scattering theory to analyze holograms. As demonstrated in [52,53], in-line holograms can be predicted combining Lorenz-Mie scattering theory with a model for the propagation and interference of the light fields in the microscope. Later, spherical colloidal particles were successfully tracked and characterized by fitting scattering models based on the Lorenz-Mie theory to holograms [34]. More general scattering approximations allow to treat non-spherical particles like rods as well as clusters of spherical particles [21,59] fitting to the data a forward model, that is, a model that can evaluate a holo-gram based on a theory of scattering and propagation inside the microscope, using solvers such as discrete dipole approximations (DDA), see for instance [58,59]. These methods proceed by 'least squares fitting': a few parameters representing radius, orientation, position, refractive index and so on are adjusted iteratively by a Levenberg-Marquardt algorithm to minimize the error when comparing the synthetic holograms generated by the approximate objects as predicted by the selected forward model and the true measured hologram. Alternative bayesian and machine learning approaches are discussed in [15,57]. Successful reconstructions typically require significant a priori knowledge about the objects being imaged, such as their approximate positions in the field of view and a simple parametrization (sphere, cylinder...), for example.
To track and characterize objects without a priori knowledge (other than the optical properties of the ambient medium and the incident light) we may formulate more comprehensive optimization problems. The idea is to optimize the error functionals with respect to arbitrary shapes and arbitrary functions representing the imaged objects and their optical properties. When illuminating simple object configurations with time harmonic and polarized light, the problem somewhat simplifies, since we can use scalar Helmholtz approximations to simulate the polarized component of light [5,6]. Within this simplified framework, Ref. [6] succeeds in producing first guesses of objects and of their optical properties from the holograms they generate by combining topological derivative and gradient based optimization procedures, provided the size of the objects is of the same order or smaller than the employed light wavelength. Helmholtz equations for the forward problems are solved in [6] by coupled boundary element (BEM)/finite element (FEM) methods [48,51], whereas shapes are constructed by means of blobby molecule coverings and signed distance functions as in [5], without imposing any specific parametrization.
Instead of relying on particular scattering theories, here we implement topological derivative based optimization using the 3D vector Maxwell equations, which requires new closed-form formulas adapted to the holographic setting. We obtain them extending ideas developed in [6] to deal with holograms I = |E| 2 under scalar approximations for polarized light to derivations for error functionals using complex measured data E and vector Maxwell constraints [47,8,36,37]. As it happens in other imaging problems (acoustics, elastography...), topological derivatives allow us to generate first guesses of holographied objects and to correct the number of boundaries by creating, merging or destroying components. However, topological derivative based iterations may get stuck without providing a precise description of the shapes unless data distributed over a wide enough angle for a wide enough range of frequencies or incoming incident directions are available [1,7,8,26]. We find that this is the case in holography. Due to the way microscopes are built, only one incident direction and one frequency are usually available and data are measured on a limited screen behind the object [5,34,59]. Moreover, our tests show that the results do not really improve switching to optimization procedures that deform the approximate object contours along vector fields, such as shape derivative based deformations or level set techniques [9,17,28,46]. In this paper, we overcome this difficulty by combining topological derivative based optimization with iteratively regularized Gauss-Newton methods, see the videos in the supplemental material. For the true objects we will only require C 2 regularity. However, those objects will be approximated by star-shaped components during the iterative procedure. Star-shaped objects are defined by rays emerging from one fixed position c. Their boundary is located at distances of that point which vary with the angles. Therefore, they can be described using a spherical coordinate system, as it happens for ellipsoids and smoothed polyhedra, for instance. A general object formed by several star-shaped components is represented as Ω = ∪ L =1 Ω , ∂Ω = c + r (S 2 ), where r : S 2 → R 3 is a combination of spherical harmonics. Our method identifies automatically the number of defects L (i.e., we do not assume L to be known), and provides the centers c and the radii functions r defining our approximation of the true configuration, which does not need to consist in star-shaped objects. Furthermore, the method could be extended to a broader class of parameterizations dropping the star-shaped constraint, see [27]. To simplify, we assume that the optical properties are known and constant inside each component.
The starting point of our algorithm are star-shaped parametrizations fitted to initial guesses of the holographied objects provided by topological derivative optimization of the error functional comparing the synthetic hologram generated by any object with the true hologram. Next, we linearize the synthetic hologram contribution in this quadratic error functional about the current parametrization to obtain a nonlinear least squares problem for the next starshaped parametrization, which is regularized including a Tikhonov quadratic term. Gauss-Newton iterations are a very powerful tool for finding the best descent direction for minimizing nonlinear least squares problems [2,31,32,27]. There is work on coupling topological gradients and Gauss-Newton iterations [19] to solve a 2D inverse problem in elasticity, applied to parameter reconstruction instead of shape reconstruction. That study does not consider the iteratively regularized Gauss-Newton method whose regularizing Tikhonov parameter is exponentially decreasing to ensure the convergence of the algorithm [31,32] when the stoppping rule is given by Morozov's discrepancy principle, as we do here. Moreover, the classical application of the iteratively regularized Gauss-Newton method requires an initial guess formed by the true number of components, while our hybrid method does not: it automatically updates this number by topological derivative computations. This is the key starting point for constructing automatic/smart inverse algorithms. The hybrid inverse algorithm we are proposing is therefore new, as it is its application to holography.
Many other approaches have been developed for inverse scattering problems involving time harmonic electromagnetic waves of wavelengths larger than those of light. We may mention qualitative techniques such as linear sampling, factorization and MUSIC methods [4] and a variety of methods tracking permittivity variations [41]. In such cases, the complex amplitude (modulus and phase) of the scattered field is measured. When working with light, phases are not measurable due to its high frequency, only intensities in the form of interference patterns such as holograms are measurable. Ref. [5] showed that in case the complex amplitude was known the performance of topological methods might improve. Ref. [6] proposes a procedure based on gradient optimization and gaussian filtering to numerically approximate the modulus and the phase from the measured hologram. However, the applicability of methods exploiting this numerical approximation of the complex field is currently limited by the numerical error and by the constrained use of a single incident wave.
The paper is organized as follows. Section 2 recalls the formulation of the inverse holography problem. Section 3 adapts topological techniques to generate initial approximations of the holographied objects in the absence of a priori information, other than the emitted light and the refractive index of the ambient medium. Section 4 formulates an iteratively regularized Gauss-Newton method employing star-shaped parametrizations. This allows to use closedform expressions of the Fréchet derivatives with respect to the parametrization in the linearized operators. It also permits the use of fast spectral solvers for the Maxwell equations. Section 5 proposes a hybrid algorithm combining topological derivative based iterations to create, merge, or destroy objects with regularized Gauss-Newton iterations to sharpen their shape. We illustrate numerically the performance of this scheme for configurations containing multiple and non necessarily convex neither star-shaped components. The numerical solution of the auxiliary Maxwell systems and details on the computation of Fréchet derivatives and their adjoints are discussed in Section 6. Finally, Section 7 summarizes our conclusions and comments on possible further developments. A few appendices contain complementary information and technical details. Appendix A briefly compares with scalar approximations based on Helmholtz equations. Appendix B establishes formulas for the Fréchet, shape and topological derivatives relevant in holography. Appendix C collects some background on the selected spherical harmonics and related Mie expansions for ease of the reader.

The inverse holography problem
The general form of an inverse scattering problem is the following. An incident wave E inc (electromagnetic, elastic, acoustic, thermal...) interacts with objects contained in a medium. The resulting wave field E is somehow measured at a set of detectors. Knowing the emitted waves, the data measured at the detectors, and the properties of the background medium, we aim to reconstruct the geometry of the objects and their relevant material properties with regard to the employed wave (permittivities and permeabilities, elastic constants, thermal diffusivities...). In other words, we seek objects Ω with material parameters κ such that, when the emitted waves E inc interact with such objects, the resulting wave field E Ω,κ generates at the detectors data D Ω,κ which agree with the measured data D meas . In practice, one never knows the exact value of the true field at the detectors due to errors and noise. Therefore, it is often enough to find objects Ω with material parameters κ such that the error J(Ω, κ) when comparing D Ω,κ and D meas at the detectors is as small as possible, that is, we seek objects Ω ⊂ R 3 and parameter functions κ : Ω → R minimizing the selected cost functional J(Ω, κ).
In holography, the emitted waves are light beams, the measured data take the form of a hologram I meas recorded at a screen behind the object, and the material parameters of interest are usually its permittivity or its refractive index. The resulting wave field is governed by the linear time dependent Maxwell equations. When the emitted light beams are time harmonic, that is, , the resulting wave fields also happen to be time harmonic E Ω,κ (x, t) = Re[e −ıωt E Ω,κ (x)] and the complex amplitude E Ω,κ (x) satisfies a stationary version of the time dependent Maxwell equations, the socalled forward problem: where µ i , ε i , κ i and µ e , ε e , κ e are the permeabilities, permittivities and wavenumbers κ 2 = ω 2 εµ of the objects and the ambient medium, respectively [3,11,30,49,51]. In biological media, µ i ∼ µ e ∼ µ 0 , µ 0 being the vacuum permeability [40]. The signs + and − denote the values from outside and inside Ω, respectively. The vectorn represents the outer unit normal vector. We have imposed transmission conditions at the interface ∂Ω between the objects and the ambient medium, together with the Silver-Müller radiation condition at infinity. We will consider incident plane waves polarized in a directionp orthogonal to the direction of propagationd, that is, with E inc (x) = E 0p e ıκed·x where E 0 represents the units and magnitude of the incident field. As sketched in Fig.  1(b), in practice the direction of propagation is the z axis, orthogonal to the hologram recording screen. It is well known that system (1) has a unique solution for any real positive κ e > 0 [51]. Elliptic regularity implies that this solution belongs to the Sobolev space H 2,0 (Ω ) = {E ∈ H 2 (Ω ), div E = 0} for any smooth bounded domain Ω ⊂ R 3 \ Ω [23,25]. Sobolev's embeddings ensure then continuity in Ω . The solution of system (1) is the forward field E Ω,κi . The total field E Ω,κi is the sum of the scattered field E sc,Ω,κi and the incident field E inc outside the objects, but becomes the transmitted field E tr,Ω,κi inside. The hologram is I Ω,κi = |E inc + E sc,Ω,κi | 2 = |E Ω,κi | 2 evaluated at detectors placed at the screen.
Strategies to solve numerically (1) are discussed in Section 6. For numerical purposes, it is convenient to nondimensionalize the problem. We setx := x/L, where L is a reference length unit. Choosing L equal to a typical diameter of the object Ω, for instance, we obtain the dimensionless forward system: k i = κ i L and k e = κ e L being the 'dimensionless wavenumbers' (size parameters in the terminology of [3]) inside and outside the object, respectively. This assumes that the permeabilities are constant in the ambient medium and in the connected components of Ω, so that they can be scaled out. We will also assume β = µe µi ∼ 1. The standard refractive indexes become n i = κiλ 2π = kiλ 2πL and n e = κeλ 2π = keλ 2πL , where λ is the employed light wavelength. For ease of notation, in the sequel we will drop the˜symbol. In what follows, all the magnitudes are dimensionless. We wish to image objects using light, ranging from sizes of a few nanometers (viruses, colloidal particles, cell structures) to a few microns (prokaryotic cells). The reference length will be set to L = 1µm. We will work with laser lights of wavelengths varying from 405 nm (violet light) to 660 nm (red light). For refractive indexes typical of cellular structures we find k i and k e in the ranges 12 − 15 and 20 − 25, respectively, for instance.
In the general framework described above and assuming the ambient refractive index known, the inverse holography problem consists in finding objects Ω = ∪ L =1 Ω and functions k i : Ω → R + satisfying the equation where E Ω,ki = E inc + E sc,Ω,ki is the solution of the forward problem (2) with object Ω and dimensionless wavenumber k i (i.e. refractive index n i ) whereas I meas represents the hologram measured at the screen points x j , j = 1, . . . , N.
To simplify, in this paper we consider that the refractive indexes are constant and known inside each component of the objects. Therefore, the problem becomes finding objects Ω such that the equation: is satisfied. Alternatively, we can reformulate this equation as a constrained optimization problem: Find the global minimum Ω of Here, I Ω = |E Ω | 2 and E Ω is the solution of the dimensionless forward system (2). The object Ω is the design variable. The stationary Maxwell system (2) is the constraint. The true objects are a global minimum at which the cost functional vanishes.

7
In practice, we never know the true hologram I meas but a hologram I η meas = I meas + I η affected by noise I η of magnitude η, meaning that where δ = I meas − I η meas 2 is the noise level. Thus, I meas is replaced in (4) and (5) by I η meas . In the next section we explain how to approximate the number, size and location of holographied objects Ω from a hologram using the topological derivative of the cost functional (5).

Topological derivative based imaging
In the absence of any information on the holographied objects, other than the measured hologram and the nature of the ambient medium, some key features can be captured by a topological sensitivity analysis of the cost functional (5).

First guesses
The topological derivative of functional (5) measures its sensitivity to including and removing points in reconstructions of an object. Given a region R and a point x ∈ R, we have the expansion for any ball B ε (x) = B(x, ε) centered at x with radius ε. The coefficient D T (x, R) is the topological derivative of the functional at x [55]. When D T (x, R) is negative, the cost functional decreases for ε > 0 small, that is, J(R\B ε (x)) < J(R). This suggests that the cost functional decreases by forming objects Ω ap with points where the topological derivative is negative and large [8,20,47]: For large enough C > 0, we expect J(R \ Ω ap ) < J(R). In practice, to select a first approximation of the holographied objects we set R = R 3 and evaluate the topological derivative in a bounded region R obs ⊂ R 3 where objects are assumed to be located, i.e., with 0 < C 0 < 1 arbitrarily chosen (in most of our examples we will set C 0 = 0.15 or C 0 = 0.2). Computing the topological derivative using the expansion (7) is too costly from the computational point of view. We use explicit expressions in terms of adequate forward and adjoint fields instead. For the cost functional (5) and R = R 3 : where β = µe µi , see Appendix B.3. Notice that β ∼ 1 for biological samples [40], therefore we will neglect the second term. The forward E and adjoint P fields are solutions of where δ xj are Dirac masses concentrated at the detectors x j , j = 1, ..., N, and x = x |x| . As shown in Appendix B.3, the equation governing the forward electric field E and the boundary conditions at the interface of the object determine the expression of the derivative. The specific dependence on E of the cost functional influences the source of the adjoint problem instead. Expressions of the form (10) were first established in [47] with a different adjoint field to account for a different cost functional.
For an incident plane wave E inc (x) =pe ıkez , polarized in a directionp orthogonal to the direction of propagation (0, 0, 1), the solution of (11) is E = E inc . The conjugate of the solution of (12) is where G ke (x) = e ıke |x| 4π|x| is the outgoing Green function of Helmholtz equation, that is, the solution of −∆G − k 2 e G = δ satisfying an outgoing radiation condition. A quantifies the deviation of these 3D formulas for the topological derivatives of the holography cost functional with Maxwell constraints from the scalar Helmholtz approximations employed in [6]. Figure 2 shows results for an experimentally recorded hologram. Panel (b) represents the topological derivative constructed using the hologram in panel (a) in the vector Maxwell framework. The region where large negative values are attained would indicate the approximate location of an object. We can appreciate that this prediction is elongated and shifted towards the screen. Panel (c) displays the topological derivative obtained using the scalar formulas in A. This latter prediction improves noticeably and becomes comparable when we replace the true hologram by a synthetic hologram consistently generated using the scalar approximation for the polarized component. The increased shift is the result of neglecting the nonpolarized components, which contribute to the experimentally measured hologram. All the subsequent numerical tests in this paper use synthetically generated holograms, and devices of smaller size to reduce the computational cost of the evaluation of the involved fields in 3D regions. The distance to the hologram recording screen will be about 5µm and the size of the screen 10µm × 10µm in the set-up sketched in Fig. 1(b). Figure 3 illustrates the procedure for an ellipsoid when using red light of 660 nm. The estimation of the object location improves as we place it closer to the recording screen and reduce its size. However, the elongation in the predicted shape remains and the true orientation of the ellipsoid is missed in the initial guess. The same behavior is observed for violet light of 405 nm. Fixing the hologram size, the distance to the hologram recording screen and the light wavelength, we have noticed that oscillations may appear in the topological derivative as the size of the object grows. Then, the objects are more clearly located tracking the peaks of a companion field [16], the topological energy E T (x, R 3 ) = |E| 2 |P| 2 , where E and P are the forward and adjoint fields governed by (11) and (12). This issue is further discussed in [5,7,26]. Here, we focus on improving the reconstructions of objects whose sizes are similar to or smaller than the light wavelength to avoid this transition.

Correction of the number of components
Once we have an initial reconstruction of the objects Ω ap we may improve it by a topological derivative based iteration. We construct a new approximation Ω new from Ω ap as follows [5,8]: The positive constants C 1 , c 1 in (14) are selected to ensure a decrease in the shape functional: While the points where the updated topological derivative is negative and large are added to the former reconstructions, the points where it is positive and large are removed. In principle, we will set C 1 = c 1 = C 0 but they may be automatically reduced in case the cost functional does not decrease. This descent strategy is suggested by expansion (7) for x ∈ R = R 3 \ Ω and its equivalent for x ∈ Ω. Notice the change of sign when compared with expansion (7) for R 3 \ Ω. This is a matter of choice. Keeping the same sign in both we should add and remove regions with large and negative topological derivative. Changing the sign we achieve a simpler and more visual interpretation, which is easier to implement. Also, this choice ensures that the global expression of the topological derivative when β = 1 is continuous in R 3 for scalar problems [6,8].
In the presence of an object Ω = Ω ap , the topological derivative is given by when β = µe µi ∼ 1, see Appendix B.3, with forward and conjugate adjoint fields satisfying transmission Maxwell problems with object Ω = Ω ap wheren is the unit normal andx = x |x| . The procedure described in (14) allows for the creation of new components forming the objects (if missed in the previous iteration), for merging existing components (if they are close and intermediate points are indentified), for the destruction of proposed components (if they turn out to be spurious), and for the creation of holes inside them [8]. It does not rely on any object parametrization and can be used to reconstruct non convex and multiple objects [5,6].
A delicate step in the process is the fitting of surfaces to the objects defined by (9) and (14), in such a way that the corresponding forward and adjoint fields can be computed numerically. Here we resort to star-shaped parametrizations and spectral solvers, as described in Sections 5 and 6. When we are only interested in determining the number and location of the objects, we may just fit spheres to each component and use explicit Mie series solutions (see Appendix C) as done in [6] for scalar problems. In general, we may avoid choosing specific parametrizations by fitting to (14) smooth surfaces defined by means of blobby molecules and signed distance functions, and employing coupled BEM-FEM solvers as in [5]. We could also work directly with (14) and DDA solvers [58,59]. Figure 4 illustrates the performance of the iterative method based on (14) to detect two ellipsoids aligned in the incidence direction for the red light. The synthetic hologram is generated here solving numerically the forward problem (17) when the scatterers Ω are the true ellipsoids and adding 2% random noise, fnamely, when η = 0.02 in (6). The two objects are detected, with adequate approximate locations and sizes, but the process stagnates without recovering the correct orientation. The same happens if we modify the light, increase the number of detectors or change the thresholds C 0 and/or C 1 and c 1 .

Iteratively regularized Gauss-Newton approach
Topological derivative-based methods yield predictions of the number, location and size of holographied objects. However, the objects appear to be dis-13 placed and elongated towards the hologram recording screen and their global 3D shape is not really recognizable, though some xy slices may suggest it. We will show that this information can be refined by iteratively regularized Gauss-Newton methods (IRGNM) to obtain accurate reconstructions of the holographied shapes, provided we can rely on some kind of parametrization. However, IRGNM can only improve shapes, not alter the number of predicted object contours. This section adapts the IRGNM to holographic settings. A hybrid algorithm combining topological derivatives to allow for variations in the number of contours and IRGNM to correct shapes will be presented in Section 5.

General framework
We choose an algorithm studied in [31,32] and based on the IRGN method introduced in [2], which enjoys some convergence properties [2,31]. Let us recall the main ideas. Given two Hilbert spaces X, Y and a Fréchet differentiable operator F : D(F) ⊂ X −→ Y , we assume that the exact data y ∈ Y are attainable, that is, there is x ∈ X such that F(x) = y, but only noisy data y δ satisfying y δ − y Y ≤ δ are available. Starting from an initial guess x 0 , the IRGN method [2] generates a sequence x δ k+1 as follows. At each step, we linearize the equation at x δ k , solve F(x δ k ) + F (x δ k )ξ = y δ by means of the minimization problem: and set x δ k+1 = x δ k +ξ k+1 . The penalty term α k ξ X would lead to the Levenberg-Marquart algorithm [39,43]. The Tikhonov regularizing term α k x δ k + ξ − x 0 2 X has additional regularizing properties and facilitates convergence for specific choices of α k and of initial guesses x 0 [31]. From the theory of linear Tikhonov regularization, the unique solution of (19) is given by (20) where F (x δ k ) * denotes the adjoint of the Fréchet derivative F (x δ k ), see B.1.

Variant adapted to inverse holography
We introduce next a procedure based on star-shaped parameterizations inspired in [27,38]. We assume that the holographied object Ω true can be approximated by a finite number of star-shaped objects. This happens, of course, when Ω true is the union of star-shaped objects, but also for a wide range of 3D objects that are not star-shaped, like some "bean" or "peanut"-like objects. More complicated shapes, for instance "dolphin" or "aeroplane"-like ones cannot be well approximated by star-shaped parameterizations and the forthcoming method would fail. However, the ideas can be adapted to more general parameterizations [27] to deal with this kind of objects. This extension is out of the scope of the paper.
Let us first assume that Ω true consists in just one component which can be reasonably well-approximated by a star-shaped object Ω star . The extension to multiple components is straightforward and will be discussed at the end of this section. Points on the surface of Ω star are located at rays emerging from a point c star , at distances of this point which vary with the angles and can be referred to a spherical coordinate system by r star (x) = r star (x)x,x = x |x| ∈ S 2 . The spherical harmonics [11,30] furnish a basis to expand functions defined in L 2 (S 2 ) which we use to approximate r star (S 2 ), see C. Let H nmax be the finite dimensional space spanned by scalar spherical harmonics with degree up to n max ∈ N. Given a star-shaped approximation Ω qap of Ω star (namely, of Ω true ), we can describe its boundary as forx ∈ S 2 . Our goal is to find c ap and r ap in such a way that equation (4) is satisfied by the star-shaped object Ω = Ω qap defined by it. Gradient methods would seek to correct the approximate parametrization q ap in the direction in which some kind of domain derivative of the functional (5) is negative. Gauss-Newton methods instead aim to correct the parametrization by solving equation (4) linearized at the available approximation q ap . Both strategies may undergo stagnation in the direction of small gradient. To allow for convergence avoiding this artifact, regularizing terms are added to Gauss-Newton methods, as we have discussed in Section 4.1.
As indicated in Section 4.1, the minimizer of (22) is the unique solution of where I (q k ) * represents the adjoint of the Fréchet derivative I (q k ). Let us detail explicit expressions for both operators. Admissible perturbations q ∈ Q of a given spherical parametrization q ap of an initial guess starshaped with respect to a fixed center c ap take the form: and define deformed domains Ω q(ξ) such that ∂Ω q(ξ) := c ap +ξ ap (S 2 )+ξ(S 2 ). In this way, the function ξ is uniquely determined by ∂Ω q(ξ) . As argued in Section B.1, the Fréchet derivative of the hologram admits the explicit formula where x 1 , . . . , x N are the screen detectors, andĖ is the solution of with object Ω = Ω ap and transmission data E = E Ωap being the solution of (2) with Ω = Ω ap andn the outer unit normal.
Notice that this solution is continuously differentiable in a classical sense far from the obstacles [45]. Let us characterize now the adjoint. Let h be a real-valued function defined on the screen detectors x 1 , . . . , x N . The L 2 -adjoint operator of I (q ap ) is defined by and where E + h is the solution of the transmission problem with object Ω = Ω ap and incident field The IRGN method has never been used with intensities in electromagnetism before. Formula (30) is the same as that derived in [38] when working with measurements of the full field. However, the incident adjoint field E inc h changes and it is given by (31). To obtain the adjoint of I (q ap ) in H s it suffices to compose I (q ap ) * |L 2 with the diagonal operator We then have see Appendix B.1 for details. Formulas (27)-(28) can also be simplified by using only E + , as done in [38], Remark 5, thanks to the transmission conditions. These explicit expressions for the Fréchet derivatives and their adjoints allow us to solve numerically equation (23) in H s (S 2 ) as explained in Section 6. This idea can be generalized to multiple simply connected domains just by considering a set of parametrizations q = (q ) Lap =1 for the union of the boundaries of the components Ω ap, of Ω ap . Notice that the procedure we have just described fixes the approximate center of the object c ap and seeks for an adequate spherical parametrization about it. We correct the centers by a simple procedure embedded in the algorithm described in the next section.

Hybrid Topological derivative/Gauss-Newton algorithm
In general, we ignore the number of components of the holographied object a priori. Therefore a scheme should allow to create, merge and destroy contours at certain stages. In this section, we propose a hybrid scheme combining topological derivative based optimization with iteratively regularized Gauss-Newton iterations for inverting holographic data which achieves that goal. The algorithm proceeds in the following steps.
Step 1 -Observation region. We define a meshed region R obs where we seek the objects and evaluate the different fields. In our set-up, we assume the screen is the square [0, 10] Step 2 -Initial Guess.
(i) Choose 0 < C 0 < 1 and define Ω ap as in (9) where D T (x, R 3 ) is given by (10) with β = 1 and (11)- (13). Unless otherwise stated, in all our tests we set C 0 = 0.15 for the red light and C 0 = 0.2 for the violet one.
(ii) For all simply connected components Ω ap, of Ω ap , compute the centroid c ap, ∈ R 3 and the boundary points c ap, + r ap, .
(iii) Determine star-shaped parametrizations for r ap, (x) = r ap, (x)x finding the coefficients γ n,m = S 2 r ap, (x)Y n,m (x)dSx in the expansion (21) by means of the exact quadrature rule (2.42) in [22] after interpolating r ap, (x) to obtain its values at the Gauss quadrature points, for each component.
We can store the result of checking the condition (i) on the topological derivative at each grid point as a binary vector M of (M d + 1) 3 entries. In practical implementations, this vector will be longer. After obtaining Ω ap as described in Step 2(i), we consider a small cube around each simple connected component. This cube is again meshed and the topological derivative (TD) is evaluated at these points. In the end, the domain Ω ap is defined by the set of all the points in this finer grid where the TD satisfies (9).
For (ii), the MATLAB command CC = bwconncomp(M) extracts the number of connected components and labels the points within them. The command boundary extracts the boundary points of each component. The property centroid of the command regionprops provides the centroids. See also [36] for simple MATLAB instructions regarding (iii).
(ii) If any of the centers c k, is far from the gravity center of the corresponding component Ω k+1, (i.e. the distance is larger than 10% of the diameter), then we set c k+1, equal to the gravity center and replace q k+1, with the parametrization that uses that center, as indicated in Step 2 (ii)-(iii). Otherwise, set c k+1, = c k, .
(i) We estimate the noise in the measured hologram δ = I η meas − I meas 2 and select as stopping criterion the discrepancy principle. If we end the algorithm. To ensure an accurate approximation preventing early stops, we set τ = 1.01.
If we wish to allow for the destruction of existing components too, then we use (14) to generate Ω new from Ω ap = Ω k+1 .
(c) Go to Step 2 (ii) and repeat the procedure with Ω ap = Ω new .
We solve the problem (22) for the parameterization correctors and the forward and adjoint problems for the topological derivatives (17) and (18) using the methods described in Section 6. We have tested this algorithm in the set-up depicted in Fig. 1(b). After nondimensionalizing as indicated in Section 2, the detectors are placed on the screen [0, 10] × [0, 10] × {10}. The holograms are synthetically generated on that screen on a grid with 51×51 detectors by solving numerically the corresponding forward problems and adding random noise of magnitude 2%, i.e., such that (6) holds for η = 0.02. Detectors are located at the points x k = (0.2k, 0.2 , 10), k, = 0, . . . , 50. The direction of the incident light is (0, 0, 1) and the polarization vector is (1,0,0). We fix the refractive indexes of the objects, so that k e = 12.56 and k i = 15.12 for a red incident light of 660 nm and k e = 20.6, k i = 24.79 for a violet incident light of 405 nm. As said earlier, β = 1. We keep the default values for the parameters C 0 = 0.15 (red light), 0.2 (violet light), C 1 = c 1 = C 0 , α 0 = 0.1 and τ = 1.01 indicated in the description of the algorithm, unless stated otherwise. We have fixed in all our tests n max = 8 for the definition of the parameterizations (21). Figure 5 revisits the approximation obtained in Figure 4 with this technique keeping the parameters for red light. The location, size and shape of the two object components is now recovered with accuracy, setting Ω ap equal to the initial approximation in Fig. 4(d). The cost functional (5), which stagnated during the iterative procedure proposed in Section 3.2, decreases now after the introduction of the second component, as the location, size and orientation of both components improves. Video 1 in the Supplementary Material reproduces the whole sequence of approximations. In Figure 6 we repeat the tests for the violet light. We observe that our method is very robust with respect to the choice of the threshold C 0 in (9) and (34). It is able to find very accurate reconstructions even when the initial guess has only one component which is rather small (panels (a,b,c)), when it has only one component comparable in size with the objects to be found (panels (d,e,f)), and when the initial guess has the correct number of contours, but sizes are overestimated and orientations are incorrect (panels (g,h,i)). Comparing the decay of the cost functional for the three selected values, we find that for C 0 = 0.3 the cost functional decays rapidly during the first iterations because the initial guess has the correct number of components, and the number of iterations is slightly smaller because stagnation only occurs at the end of the procedure. Remarkably, when starting with a wrong number of components (panels (c,f)), the cost functional stagnates at the 5th iteration and the number of components is updated. At about the 10th iteration, the value of the cost function is almost the same for the three situations. Moreover, we have observed that a further increase in C 0 promotes initial guesses for which the cost functional increases, so that the method automatically reduces such constants. In the sequel we will set C 0 = 0.2 for the violet light. We next replace the ellipsoid located at (5, 5, 4) by a peanut. The parameterization of the boundary of a peanut centered at (c x , c y , c z ) is: (c x − r γ (θ) cos θ, c y + 2r γ (θ) sin θ sin φ, c z + r γ (θ) sin θ cos φ), with θ ∈ [0, π], φ ∈ [0, 2π] and r γ (θ) = cos(2θ) + γ + 1 − sin 2 (2θ).
We select (c x , c y , c z ) = (5, 5, 4) and γ = 0.5. The parameter γ > 0 determines the narrowness in the middle of the peanut shape (the closer to zero, the more constricted). Figure 7 illustrates the good performance of the hybrid algorithm, when Ω = Ω5. Cyan contours represent the true object, whereas the approximated object section is shown in magenta. (j) Approximate object Ω6 obtained from Ω5 using (34). A new component is detected.
(k,l) Approximate objects Ω12 and Ω23 obtained by the IRGNM. The location, size and shape of both objects is accurately recovered.   Figure 9 and Video 4 illustrate convergence when the two spheres are placed asymmetrically. Notice that in this case, recovering the sphere aligned with the ellipsoid should be in principle more complicated than approximating the sphere not screened by it. However, our method overcomes the difficulty and provides an accurate description of both spheres.
Finally, in Figure 10 (see also Video 5 in the supplementary material), we illustrate the performance of the hybrid algorithm in a configuration with three objects of different sizes and shapes. One of them is a bean, a non-star shaped object described by the parameterization with A(θ) = 0.64(1−0.1C(θ)), B(θ) = 0.64(1−0.4C(θ)), C(θ) = cos(π cos θ) for θ ∈ [0, π], φ ∈ [0, 2π]. The first identified object is the bean, that is closer to the screen. When the algorithm carries out a topological derivative iteration to update the number of objects, the existing approximation resembles an ellipsoid rather than a bean. After this update, only the ellipsoid is detected because is bigger than the sphere, which is not seen. Once this new component is found, the algorithm requires a new topological derivative iteration, finally determining the correct number of objects. At the 6th iteration (see panel (j)), the three objects resemble ellipsoids, but in a few iterations the true shapes are approximated with accuracy (panel (l)).
Remarkably, the quality of the previous approximations is maintained when reducing drastically the number of detectors, in agreement with the observations made in [13]. Let us consider a much coarser detector grid formed by just 121 detectors located at the points x k = (k, , 10), k, = 0, . . . , 10. Figure 11 shows the results obtained for different sets of scatterers using violet light. Comparing Figure 11(b,e,h,k) with Figure 6(e), Figure 7(l), Figure 9(c) and Figure 10(l), respectively, we observe that the quality of the approximations is similar. (a)

6 Numerical solution of boundary value and linearized problems
The optimization techniques to address the inverse holography problem described in Sections 3-5 rely on the availability of adequate solvers for the associated forward and adjoint problems on one side, and the characterization of the Fréchet derivatives on the other. All of them can be rewritten to adopt the same mathematical structure.

Forward and adjoint fields
Expressing the total light field E in terms of transmitted E tr , scattered E sc and incident E inc wave fields, and the conjugate adjoint field in a similar way where P inc is the solution of the conjugate adjoint problem in the whole space (13) we find systems (17) and (18) governing the forward and adjoint fields become on ∂Ω βn × curl W tr −n × curl W sc =n × curl W inc , on ∂Ω, lim |x|→∞ |x| curl W sc ×x − ık e W sc = 0, (38) for W = E or P. In principle, any solver for transmission Maxwell problems can be used.
In our setting, for scatterers whose boundary is defined by a C 2 -parameterization (in particular, by a star-shaped one) with piecewise constant refractive indexes, we use fast boundary integral/spectral codes [22,38]. Maxwell equations are solved by a Muller type boundary integral formulation [18,38,50]. The parametrization is exploited to transport the integral equations into unit spheres and the system is solved by means of Galerkin schemes using tangential vector spherical harmonics of low order [38]. This approach may be faster than implementing the discrete dipole approximation [58,59] or combing boundary element (BEM)/ finite element (FEM) in a 3D region [5,48,51]. Unlike these two latter methods, it is only applicable when a specific parametrization is available. Fast multipole scattering methods would also be adequate in the presence of many particles [24].

Linearized equation to correct parameterizations
The least squares problem (22) is minimized solving numerically equation (23) in H s (S 2 ) using the conjugate gradient method with initial solution ξ k+1 = 0 and residual 10 −2 . In each step of the conjugate gradient method, we must apply the operators I (q k ) and I (q k ) * to known vectors. Applying I (q k ) to a vector ξ amounts to solving system (26). System (26) has the structure (38) with transmission data (27)- (28). The techniques mentioned in Section 6.1 can be used to solve it.
To compute numerically the adjoint (32) there are two possibilities, depending on how we evaluate the Cauchy data (n × E + h ,n × curl E + h ): (i) Either we compute the data (n × E + h ,n × curl E + h ) by solving the transmission problem with the incident field E inc h as indicated above. Then we take the conjugate.
(ii) Or else, we compute the hermitian adjoint (transpose of the conjugate matrix) of the discretized approximation of the operator . This is our choice. Indeed, we have

Conclusions
We have proposed a fully automatic algorithm to numerically reconstruct 3D objects from the holograms they generate. The method seeks to minimize the difference when comparing the true holograms and the holograms generated by approximate objects as predicted by a Maxwell forward model of light scattering. The topological derivative of this error functional provides an initial guess of the holographied objects in the absence of a priori information, other than the ambient refractive index and the incident wave. Working with star-shaped parameterizations, we implement an iteratively regularized Gauss-Newton method to successively correct the parametrization by solving linearized problems. Automatically combined with additional topological derivative based iterations to create or destroy objects when the decrease in the error functional stagnates, this procedure yields accurate reconstructions of a variety of objects in an experimental holography setting. This scheme is quite general and can be applied to other inverse electromagnetic problems by changing the error functional, so that it is defined in terms of the adequate data. This usually requires adjusting the sources in the adjoint problems and adjusting the Fréchet derivatives. In general 'nonlinear least squares' problems, gradient methods seek to deform initial domains in the direction in which some kind of derivative of the error functional is negative, so that the functional decreases. This kind of methods includes topological derivative (TD), shape derivative (SD) and level set (LS) based optimization. Instead, Gauss-Newton type methods aim to correct the current approximation by linearizing about it and solving the resulting problem. Even when no spurious solutions are introduced by these procedures, they all may suffer from stagnation in the direction of small 'gradient'. Here, the inclusion of Tikhonov regularizing terms in Gauss-Newton methods allows for convergence avoiding this artifact. From a technical point of view, while Gauss-Newton approaches require an explicit expression for a Fréchet derivative with respect to the domain, descent methods based on TD, SD or LS rely on explicit expressions for the shape/topological derivatives. Such expressions can usually be obtained introducing auxiliary adjoint problems without the need of characterizing the Fréchet derivative. The availability of these latter characterizations allows us to implement the IRGNM considered here.
We have focused on recovering shapes assuming the refractive indexes of the objects known. To obtain both we may combine our algorithm for shape optimization with parameter optimization, as in [6] or explore bayesian techniques [15]. Moreover, this paper considers object sizes of the same or smaller order than the employed light wavelength. The design of effective methods for larger objects and for objects whose components cannot be well approximated by star-shaped descriptions will require further developments.
In principle, the algorithm we propose could be extended to other inverse electromagnetic scattering problems by adjusting the closed-form formulas for the pertinent derivatives, and also to other inverse scattering problems, provided closed-form formulas for the derivatives as well as solvers for forward/adjoint problems are available (acoustics, elastography...).

A Comparison with scalar approximations
When working with an incident wave polarized in the x or y directions, such as E inc = (E inc , 0, 0), E inc = e ıkez , a standard approximation sets the non polarized components of the electric field equal to zero and uses a scalar Helmholtz transmission problem to approximate the polarized component E 1 . In this framework, the inverse problem (4) is reformulated as finding Ω such that the solution E Ω of the scalar forward problem satisfies the equations I meas (x j ) = |E Ω (x j )| 2 , j = 1, . . . , N , or is a global minimum of the functional 1 A scalar version of the topological methods explained in Section 3 was implemented in [6].
This strategy may be reasonable in the presence of isolated smooth scatterers, placed far enough from the detector screen. However, it introduces a number of errors of varying magnitude: is the solution of the vector Maxwell system (2) for the true object Ω. The boundary conditions couple the three components of the electric field at the boundary of the object. However, if we work with well separated objects and the detectors are placed far enough from them, the value of E 2 (x j ) 2 + E 3 (x j ) 2 is expected to be small.
• The topological derivative for the scalar problem in the whole space is where E = E inc and the scalar adjoint Q is an outgoing solution of Particularizing formula (10) for the vector Maxwell problem with polarized light and β = 1, we find D T (x, where P = (P 1 , P 2 , P 3 ) is given by (12). To quantify the difference between both formulas for topological derivatives, we need to relate Q and P 1 . We find a term of the form k −2 e N j=1 ∇divG ke * d j δ xj , where G ke is the Green function of the Helmholtz equation. This error term decays with the distance to the detectors. Indeed, conjugating system (12) we obtain: lim |x|→∞ |x| curl P ×x − ık e P = 0.
For j = 1, . . . , N , we take the divergence curl (curl P j ) − k 2 e P j = d j δ xj , where d j = 2(I meas (x j ) − |E(x j )| 2 )E(x j ). Since div (curl A) = 0 for any vector A, we find div P j = − 1 k 2 e div d j δ xj . Making use of the vector We can solve the equations by convolution with the Green function of Helmholtz equation: This expression quantifies the difference between the Green function of Maxwell equation and Green functions of Helmholtz equations. Indeed, 30 notice that the right hand side can be rewritten as G ke * d j δ xj + 1 k 2 e G ke * [curl curl d j δ xj + ∆d j δ xj ]. Interchanging the derivatives in the convolution we find: for x = x j . Summing over j, this implies that formula (13) for the adjoint holds pointwise as long as we do not reach the screen where the hologram is recorded.
• When we consider the topological derivatives in the presence of approximated objects Ω ap = ∅, the differences between the vector and the scalar approach increase, since the expression for the topological derivative (16) becomes discontinuous across the boundary and the coupling of the field components at the boundary in (17) and (18) produces nonzero components for the forward and adjoint fields.

B Fréchet, shape and topological derivatives for holography
In this section we justify the formulas for the Fréchet, shape and topological derivatives for the hologram and the cost functional (5) employed throughout the paper. Given an object Ω ⊂ R 3 with boundary Γ = ∂Ω, we consider variations of Ω along vector fields ξ. For τ > 0, we introduce the family of deformations and consider the deformed domains ϕ τ ξ (Ω) = Ω τ ξ . Let us quantify first the variations of the hologram under such deformations.

B.1 Fréchet derivative of the hologram
The Fréchet derivative extends the concept of differential to general spaces of infinite dimension. Given two Banach spaces X, Y and a function F : In other words, it satisfies lim ξ X →0 Let us introduce the operator that maps the deformation of the object boundary to the solution of the forward problem evaluated at the detectors: where k ≥ 2, E Ω ξ is the solution of (2) with Ω = Ω ξ , x j , j = 1, . . . , N, are detectors placed on a screen. Then, we can write the corresponding hologram as I(ξ) j = |E Ω ξ (x j )| 2 = F(ξ) j · F(ξ) j , j = 1, . . . , N.
Theorem 1.The Fréchet derivative of the operator I(ξ) and its adjoint operator are given by (25) and (32), respectively.
Proof. The Gateaux derivativeĖ of the solution of (2) in the direction ξ is characterized as the solution of (26) in [12], Theorem 6.6. This provides the Fréchet derivative of the operator F defined by (44). Then, where F * (0) is characterized in [38], Proposition 6. The only difference with respect to the use of full measurements (phase+intensity) [38] is the multiplication of the incident adjoint field by 2h.
Using the same formula we get similar results inspired by [33,Eq. (1.3)] for the scalar case.
Theorem 1bis. Using the scalar approximation for polarized waves, the Fréchet derivative of the operator I(ξ) is given by whereĖ is the solution of ∂|x|Ė − ık eĖ = 0, with object Ω = Ω ap and transmission data (40) with Ω = Ω ap andn the outer unit normal. The L 2 -adjoint operator is defined by where E + h is the solution of the transmission problem (40) with object Ω = Ω ap and incident field

B.2 Shape derivative of the cost functional
When instead of the hologram we differentiate the cost functional (5) with respect to deformations along vector fields, we obtain the so-called shape derivative. Let us fix a vector field ξ. For any region R, the deformed domain ϕ τ (R) is the image of R by the deformation (42). Evaluating J on the deformed regions, we obtain a scalar function J(τ ) = J(ϕ τ (R)) of the deformation parameter τ , which can be differentiated with respect to it. The shape derivative along the vector field ξ is precisely this derivative: Theorem 2. Let us assume that Ω is a C 2 domain and the coefficients k e , k i , β are piecewise constant in the different components. Then the shape derivative DJ(R 3 \ Ω), ξ of functional (5) is given by: where E and P are the solutions of the forward and conjugate adjoint problems (17) and (18). Proof. Given the vector field ξ, we must evaluate (45). Differentiating with respect to τ the function J(R 3 \ φ τ (Ω)) with J given by (5) we find a vector version of the scalar formula in [6]: where E τ is a solution of the forward problem (17) with object Ω τ = ϕ τ (Ω). Evaluating at τ = 0, we obtain since E 0 = E is the solution of (17) with object Ω.
We setĖ = dEτ dτ τ =0 , which is the Gateaux derivative in the direction ξ of the solutions of the forward problems (17) with deformed domains Ω τ . For the transmission Maxwell system it is characterized as the solution of (26), see [12]. Then, elliptic regularity and Sobolev's embeddings ensure continuity of the solution and continuity of derivatives away from the interface ∂Ω [23,25,51]. Therefore, we can evaluate it at the detectors. We rewrite the right hand side in identity (46) as follows. Integrating the equations for the adjoint field and using Green's formula we obtain the identities: and B R \Ω (curl curl P−k 2 e P)·Ė+ ∂Ωn ×curl P Here, B R = B(0, R) is a sphere with radius R large enough to contain the objects and detectors and L ke stands for the Dirichlet to Neumann operator for Maxwell equations [49,Chapter 10]. To be able to use the transmission boundary conditions forĖ we combine (47)- (48) to get: Following [36], we analyze the boundary terms in this identity using the boundary conditions satisfied byĖ, E, P, together with classical vector identities and differential calculus relations on surfaces [51], to finally obtain the desired expression using (46), see [36] for details.
This Theorem is stated for piecewise constant coefficients and C 2 domains. However, piecewise C 1 coefficients and Lipschitz domains suffice [14,29,51].
Shape derivatives can be exploited to optimize the cost functional (5) since they provide vector fields ξ to deform an initial guess Ω ap in such a way that the cost functional decreases. The vector field ξ is selected to ensure that the shape derivative of (5) is negative. The process can be repeated, generating a sequence of reconstructions along which the cost functional diminishes.
When β = 1, the shape derivative of the cost functional (5) at the scatterer Ω ap is given by where E and P are the solutions of the forward and adjoint problems (17) and (18) with object Ω ap . Choosing ξ = ξ nn ,n being the unit normal vector on ∂Ω ap , with we ensure DJ(R 3 \ Ω ap ), ξ < 0. A new approximation is defined as Then, J(R 3 \ Ω new ) < J(R 3 \ Ω ap ) for τ > 0 small. When enforcing star-shaped parameterizations we should fit a star-shaped parametrization to the resulting object. Alternatively, we can adapt an strategy to preserve the parametrization used in [9]. We define a set of directions associated to the parametrization: .., n, n = 0, ..., n max .
Then, the parameters defining the star-shaped boundary of the new approximation Ω new would be: with τ , τ n,m > 0 small enough. We have tested both procedures, but the approximations stagnate without converging, as it happens for the topological derivative based iterations.

B.3 Topological derivative of the cost functional
Once an explicit formula for the shape derivative of a cost functional is available, we can obtain an explicit formula for the topological derivative taking an additional limit [20]. For every x ∈ R, we set B ε = B(x, ε) and R ε = R \ B ε , we have [20]: for every x ∈ R 1 . The vector field ξ is an extension to R 3 of ξ =n(z), z ∈ Γ ε = ∂B ε (x), where the normaln(z) = z−x |z−x| points outside 2 the ball, and vanishes out of a narrow neighborhood of ∂B ε . Theorem 3. Let us assume that Ω is a C 2 domain and the coefficients k e , k i , β are constant. Then the topological derivative of functional (5) in R 3 is given by (10) with forward and adjoint fields governed by (11) and (12).
Proof. Expressions of the form (10) for cost functionals involving the full wave field were first established in [47] using asymptotic expansions. We obtain it here exploiting the relation with shape derivatives (53), as in [6,8,20,36], To find an expression for the topological derivative in terms of adjoint and forward fields we must first evaluate the shape derivative. We set here R = R 3 . By Theorem 2 in Appendix B.2, DJ(R 3 \ B ε ), ξ is given by where E ε and P ε are the solutions of the forward and adjoint problems (17) and (18) with object B ε . These solutions admit explicit forms given by the series expansions in C. From them, we obtain the following asymptotic behaviors when |χ| = 1 as in [6,36]: when ε → 0. To justify this asymptotic behavior, we use the series expansion (62) with coefficients (63) for R = ε at z = x + εχ, evaluating α n,m ,β n,m from the series expansion of the incident wave (64). Since the spheres are centered at a point x instead of 0, M n,m (k i , x) and N (1) n,m (k i , x) are replaced by M (1) n,m (k i , z − x) and N (1) n,m (k i , z − x) [10,42,36]. The behavior of the conjugate adjoint fields P − ε is similar to (55), replacing E inc by P inc . Combining the asymptotic behaviors (55) with the identities ∂B1 (χ(z)·a)(χ(z)·b)dS z = 4 3 π a·b, where χ(z) = z−x |z−x| , |z − x| = 1, and ∂Bε a(z)dS z = ε 2 ∂B1 a(x + εχ)dS χ . we obtain expression (10) when taking the limit (53) using formula (54).
Theorem 4. Let us assume that Ω is a C 2 domain, the coefficients k e , k i are piecewise constant functions and the coefficient β = 1. Then the topological derivative of functional (5) in R 3 is given by (16) with forward and adjoint fields governed by (17) and (18).
Proof. We can adapt the arguments in either [6] for scalar holography or in [37] for full Maxwell measurements. Consider first points x ∈ R = R 3 \ Ω. Since ξ vanishes on ∂Ω, the only difference with the proof of Theorem 2 arises when justifying the limits (55). Let us first observe that (55) hold when E inc is replaced by a general field W inc which can be expanded as (64) and E ε is replaced by the solution W ε of (57) with R = ε. We set W inc = E equal to the solution of the forward problem (17) with object Ω. The proof is concluded by showing that to first order in ε we have W ε ∼ E ε on ∂B ε (x). To do so, let us quantify the difference between the solutions E ε of (17) with object Ω ∪ B ε (x) and the total fieldsẼ ε : W ε being the solution of (57) with R = ε. The functionsẼ ε satisfy Notice that both W inc = E and W ε,sc satisfy the transmission boundary conditions on ∂Ω, the first one by construction and the second one by regularity. Now, W ε,sc (z) is given by a series of the form (61) setting in the coefficients R = ε and using M n,m (k e , z − x) [10,42]. Exploiting the asymptotic behavior of the spherical Bessel functions [11] as ε → 0, j n (kε) ∼ (kε) n 2 n n! (2n+1)! , y n (kε) ∼ −(kε) −(n+1) (2n−1)! 2 n−1 (n−1)! , as well as the relations h (1) n = j n + ıy n , and z n (kε) = −z n+1 (kε) + n(kε) −1 z n (kε) for z n = j n , h (1) n , we see that the coefficients a n (ε) and b n (ε) given by (63) behave like ε 2n+1 . Therefore, the source term (k 2 e − k 2 i )W ε,sc (z) = O(ε 3 ) andẼ ε ∼ E ε at zero order in ε. Let us consider now x ∈ Ω. The proof of identity (53) in [20] uses expansions of the form (7). If we revisit that proof using expansion (15) instead and setting R = R 3 \ Ω, we find that D T (x, R) = − lim ε→0 1 4πε 2 d dτ J(ϕ τ (R ∪ B ε )) τ =0 for x ∈ Ω. Now, the roles of k i and k e are exchanged when computing the shape derivative d dτ J(ϕ τ (R ∪ B ε )) τ =0 following the proof of Theorem 1. Therefore the formula for the shape derivative has the opposite sign and the two minus signs cancel each other, yielding (16) for β = 1. 3 . The passage to the limit remains similar.
When k i and k e are piecewise C 1 in space, the formula in Theorem 2 persists, replacing k i and k e by k i (x) and k e (x). When taking limits in Theorems 3 and 4, we expand k(x+εξ) = k(x)+εr(x), r being a bounded function. Similar results hold replacing k i and k e by k i (x) and k e (x) again, revisiting the arguments in [8]. 3 When β = 1, similar arguments show that the formula for the topological derivative inside Ω becomes 3 Re − k 2 i (k 2 i −k 2 e β −1 ) (k 2 e β −1 +2k 2 i ) E(x) · P(x) + 1−β −1 1+2β −1 curl E(x) · curl P(x) .

C Spherical harmonic expansions for spheres
In this Appendix, we obtain the series expansions for the forward and adjoint fields employed to calculate the topological derivative in Appendix B.3. We consider the transmission problems (38) when Ω = B R = B(0, R) is a sphere centered at (0, 0, 0) with radius R > 0. The boundary ∂Ω = ∂B R is the surface |x| = R, with normal vectorn =x = x |x| . Both problems take the form: on ∂B R , βx × curl W tr −x × curl W sc =x × curl W inc on ∂B R , lim |x|→∞ |x| curl W sc ×x − ık e W sc = 0, (57) for specific choices of W inc . We set S 2 = ∂B 1 .
Any solution of (57) admits a series expansion in terms of spherical harmonic functions [3,11]. Different choices for this basis coexist in the literature. Initial calculations of Mie series for the scattering of plane waves by spheres used functions of the form P m n (cos(θ)) cos(mψ), P m n (cos(θ)) sin(mψ), m = 0, 1, ..., n = m, ..., where P m n are associated Legendre polynomials [3]. For many computations it is useful to select a basis that is invariant by complex conjugation, such that Y m n = Y −m n . We will work with [11,49]: where r > 0, θ ∈ [0, φ], ψ ∈ [0, 2φ] are the spherical coordinates of a point x ∈ R 3 and P n,m for exterior problems outside. More precisely, the unique solution of (57) is given by [35]: with coefficients a n,m = α n,m a n , b n,m = β n,m b n , c n,m = α n,m c n , d n,m = β n,m c n , a n = − jn(kiR)[jn(keR)+keRj n (keR)]−βjn(keR)[jn(kiR)+kiRj n (kiR)] jn(kiR)[h (1) n (keR)+keR(h These transfer coefficients are the same for the spherical harmonics used in [3], with a change of sign in a n and b n because of a sign difference in the coefficients employed in [3] for the expansion of the scattered waves. They are obtained as follows. We take the curl of the series (61)-(62) and use curl M (j) = ıkN (j) , curl N (j) = −ıkM (j) , j = 1, 3 to express them again in terms of the basis functions. We then impose the transmission conditions (57) on |x| = R computing the cross product with the normal vectors. Notice that on the surface of a sphere |x| = R, M (1) n,m (k, Rχ) = j n (kR)curl S 2 Y m n (χ), N (1) n,m (k, Rχ) = χ ıkR n(n+1)j n (kR)Y m n (χ)+ 1 ıkR [j n (kR)+kRj n (kR)]∇ S 2 Y m n (χ), where curl S 2 and ∇ S 2 represent surface curl and gradients on the sphere |χ| = 1. Similar identities hold for M (3) and N (3) replacing j n by h (1) n . We observe that, in the transmission conditions, the terms involving χY m n (χ) vanish. The functions curl S 2 Y m n and ∇ S 2 Y m n form an orthogonal basis in L 2 t (S 2 ) (tangent fields), satisfyingn × ∇ S 2 Y m n = −curl S 2 Y m n andn × curl S 2 Y m n = ∇ S 2 Y m n . Setting the coefficients of the resulting expansions equal to zero, we obtain the expressions (63), where a n , b n , c n , d n are the solutions of the systems of equations: c n j n (k i R) − a n h (1) n (k e R) = j n (k e R), c n β[j n (k i R)+k i Rj n (k i R)]−a n [h (1) n (k e R)+k e R(h (1) n ) (k e R)] = j n (k e R)+k e Rj n (k e R), n (k e R)+k e R(h (1) n ) (k e R)] = k −1 e [j n (k e R)+k e Rj n (k e R)], d n k i βj n (k i R) − b n k e h (1) n (k e R) = k e j n (k e R).
Thus, to obtain explicit expressions for the forward and adjoint fields in the presence of spheres we only need to determine the coefficients α n,m and β n,m of the series expansion (64) of E inc and of P inc given by (12).

C.1 Series expansion of forward fields for spheres
For a plane wave advancing in the direction of the axis z and polarized along the axis x, that is, E inc (x) = (e ıkez , 0, 0), the Mie series expansion for E inc is obtained from the expansion in [3]  With these coefficients we obtain the corresponding Mie solution (61)-(64). The above formulas apply to spheres centered at (0, 0, 0). If the sphere is centered at a point y, the formulas must be conveniently shifted.

C.2 Series expansion of adjoint fields for spheres
The field P inc given by (12) involves terms of the form where d j = 2(I meas (x j )−|E(x j )| 2 )E(x j ), where E is the solution to (11). When the incident wave is a plane wave, the coefficients (64) are given in C.1. The Mie expansion of the functions (66) is given in [11], page 222 4 . Summing over j: With these coefficients we obtain the corresponding Mie solution (61)-(64). Such formulas apply to spheres centered at (0, 0, 0). When the sphere is centered at a point y, we replace everywhere the functions M n,m (x j − y). The resulting formula holds when |x j − y| > |x − y|, for j = 1, ..., N . An alternative derivation follows [10,42].