Coherent Diffractive Imaging Using Randomly Coded Masks

Coherent diffractive imaging (CDI) provides new opportunities for high resolution X-ray imaging with simultaneous amplitude and phase contrast. Extensions to CDI broaden the scope of the technique for use in a wide variety of experimental geometries and physical systems. Here, we experimentally demonstrate a new extension to CDI that encodes additional information through the use of a series of randomly coded masks. The information gained from the few additional diffraction measurements removes the need for typical object-domain constraints; the algorithm uses prior information about the masks instead. The experiment is performed using a laser diode at 532.2 nm, enabling rapid prototyping for future X-ray synchrotron and even free electron laser experiments. Diffraction patterns are collected with up to 15 different masks placed between a CCD detector and a single sample. Phase retrieval is performed using a convex relaxation routine known as"PhaseCut"followed by a variation on Fienup's input-output algorithm. The reconstruction quality is judged via calculation of phase retrieval transfer functions as well as by an object-space comparison between reconstructions and a lens-based image of the sample. The results of this analysis indicate that with enough masks (in this case 3 or 4) the diffraction phases converge reliably, implying stability and uniqueness of the retrieved solution.

removes the need for typical object-domain constraints; the algorithm uses prior information about the masks instead. The experiment is performed using a laser diode at 532.2 nm, enabling rapid prototyping for future X-ray synchrotron and even free electron laser experiments. Diffraction patterns are collected with up to 15 different masks placed between a CCD detector and a single sample. Phase retrieval is performed using a convex relaxation routine known as "PhaseCut" followed by a variation on Fienup's input-output algorithm. The reconstruction quality is judged via calculation of phase retrieval transfer functions as well as by an object-space comparison between reconstructions and a lens-based image of the sample. The results of this analysis indicate that with enough masks (in this case 3 or 4) the diffraction phases converge reliably, implying stability and uniqueness of the retrieved solution.

I. INTRODUCTION
The first demonstration of X-ray coherent diffractive imaging (CDI), predicted in 1952 1 but not realized until 1999 2 , has sparked a revolution in X-ray imaging techniques. Since the initial demonstration, numerous variations and extensions to the basic technique have resulted in a wide variety of materials science and biological applications 3,4 . CDI replaces imaging optics with an iterative phase retrieval algorithm that solves for the missing phase of the measured diffraction intensity, resulting in an aberration-free imaging system capable of producing diffraction-limited images. In addition, because CDI retrieves the complex exit surface wave due to the interaction of light with an object, this technique offers simultaneous, quantitative amplitude and phase contrast. Because of these attractive qualities, CDI is a promising technique for ultrafast imaging studies of functional materials at X-ray free electron lasers (FELs).
Despite the advantages of CDI, the basic technique suffers from limitations due to the constraints required to ensure that the algorithm will converge. Constraints are commonly enforced on the phase and support of the object to improve convergence, restricting the thickness and transverse extent of the object, respectively. Thus new techniques are needed to enable widespread use of CDI at X-ray FELs. Ptychography, a recent enhancement to CDI, removes these constraints and enables imaging of extended objects with no phase limitations 5,6 . It involves collecting many diffraction patterns as the object is scanned across the beam; enforcing object consistency in the overlapping regions of adjacent scan positions replacing the usual object-domain constraints. The result is a very powerful technique enabling the high quality image reconstruction of a wide variety of objects in transmission 7,8 , reflection 9,10 , and 3D modalities 11,12 . However, its application to FELs especially for ultrafast imaging, remains a significant challenge and different methods are needed to take full advantage of the coherent properties of these types of sources.
Here we present an experimental demonstration of a new technique that, similar to ptychography, removes the need for phase and support constraints . This method is based on recent convex relaxation algorithms that encode observations differently [13][14][15][16] . It is an extension to CDI that utilizes a series of known, randomly coded masks to encode additional information into the measured diffraction patterns. The experiments are performed in the visible region of the spectrum. Based on the findings here, this new technique is expected to be well suited for use in the X-ray region at free electron laser (FEL) sources due to the small number of measurements required for retrieving high quality images.

II. EXPERIMENT
The experiment was performed using a laser diode at 532.2 nm wavelength. This visiblelight configuration enables rapid prototyping of the technique and allows for refinements, both numerically and regarding instrumentation. A schematic of the experiment is shown in Fig. 1. The laser is first sent through a 25 µm diameter aperture to spatially filter the laser beam. Following the aperture, a 10 cm focal length lens is placed 10 cm downstream of the aperture in order to collimate the transmitted light. The resulting beam has an approximate diameter of 2 mm. The sample is placed downstream of the collimating lens so that it is illuminated with a planar wavefront. The sample consists of a common test image patterned on a grayscale, 35 mm projector film (Gamma Tech). A lens-based image of the sample is shown in Fig. 2(a). A variety of random masks, also patterned on 35 mm projector film (see Fig. 2(b) for an example), are placed 1 mm downstream of the sample. Each square mask occupies an area of 1 mm 2 , with 4 mm of opaque film separating adjacent masks, so that only one mask is illuminated by the beam at a time. Finally, a CCD detector (Allied Vision Manta G-201) collects the scattered light 132 mm downstream of the masks. The oversampling ratio, Ω, in this case is Ω > 12, so that the diffraction pattern meets the Shannon sampling criterion 17 . Due to this geometry, the diffraction pattern is measured in the near field, and is characterized by a Fresnel number of 18. The Fresnel number is defined as D 2 /λz, where D is the diameter of the object, λ is the wavelength, and z is the distance between the mask and the detector. The numerical aperture of the system is 0.017 and supports a resolution of 15 µm, which is well below the minimum feature size of the masks (141 µm).  Fig. 2(c). Prior to phase retrieval, the patterns are binned by a factor of 4 (so that Ω ≈ 3) in order to increase the speed of the algorithm. A reconstruction using all 15 masks is shown in Fig. 3(a). This reconstruction was performed using the "PhaseCut" algorithm 14 , refined by Fienup's input-output algorithm 18 . Although the PhaseCut algorithm was designed to be used in the far field, the near-field diffraction measurement does not seem to present a problem as long as the quadratic phase from the Fresnel diffraction integral is used to initialize the phase in the sample plane 19 . Explicitly, the phase at the sample plane, φ(ρ), is initialized to be φ(ρ) = πρ 2 /λz, where ρ refers to the radial coordinate in the sample plane and z is the distance between the sample and detector. Uniformly distributed random numbers in the range [−π/2, π/2] are added to this initial guess, and the magnitude in the sample is initialized to unity. The input-output algorithm is found to reliably converge on its own as well, likely due to the increased strength of the Fourier modulus constraint in the near field 20 .
For this dataset, all 15 masks were centered in the same physical location, resulting in the square-shaped artifacts seen in the reconstruction. To remedy this, known random shifts to the mask positions were introduced for a subsequent dataset, with the result shown in Fig. 3(b). Since in this case the squares making up the masks were no longer aligned to each other, this technique removes the unwanted artifacts to a large extent. It should be mentioned that the mask structure and how it interacts with the illumination wavelength must be accurately known to length scales on the order of the desired resolution. However, since these masks can consist of simple, well-understood patterns this is not foreseen to be a problem.

III. ANALYSIS
A common way to judge reconstruction quality in CDI is through the use of the phase retrieval transfer function, analogous to the modulation transfer function (MTF) that can be measured in more traditional imaging systems 21,22 . This curve is a measure of how reliably the phase of the diffraction pattern is reconstructed as a function of spatial frequency 23 .
Here we calculate the PRTF as a function of integer number of masks, n, used in the reconstruction, ranging from one to fifteen. In order to calculate the PRTF for a given value of n, we perform 50 independent reconstructions from random starting guesses, with the average of these reconstructions considered to be the final reconstructed image. Each independent reconstruction is performed using the input-output algorithm. The algorithm is run until the mean square error (MSE) of the Fourier transform of the object relative to the measured diffraction pattern changes by less than one part in 10 6 from one iteration to the next. The results of the PRTF calculation are shown in Fig. 4(a). As can be seen from the In order to make an object-space error calculation, the lens-based image is first registered 6 to the 15-mask reconstruction shown in Fig. 3(b) using a least-square fit. The adjustable (global) parameters include coordinate scaling, translation, rotation, and image brightness level. After this image registration, the relative difference between images is calculated between the lens-based image and representative image reconstructions with 1 ≤ n ≤ 15; the resulting curve is shown in Fig. 4(b). To ensure consistency, the relative difference between reconstructions with 1 ≤ n ≤ 14 and the 15-mask reconstruction is also shown in Fig. 4(b). Both curves imply that the image quality improves with the number of masks used in the reconstruction. Visual inspection of Figs. 4(a) and (b) indicates that at high spatial frequencies the PRTF agrees well with the more objective error measurement, implying that in cases where lensless imaging techniques are the only available option this calculation can be trusted to provide a good measure of image quality.

IV. CONCLUSIONS
The technique demonstrated here takes advantage of randomly coded masks to, in the case of enough masks (typically 3 or 4), guarantee the convergence of phase retrieval algorithms. This is promising for future X-ray application, particularly at X-ray FELs 24 . The technique offers similar advantages over basic CDI to those obtained using ptychography. Specifically, there is no need for object-space phase constraints or support constraints. Beyond this, we expect that this technique will be useful for FEL wavefront characterization, as currently available methods either do not provide phase information 25 or require averaging over many laser shots 26 . This technique may also enhance current methods capable of sub-wavelength imaging of terahertz fields with biomedical and metamaterial applications 27 .
Further development and study of this technique will include investigation into mask position determination using, for instance, a gradient-based search or other methods. This type of position refinement has been shown to be successful in ptychography 28,29 , and would obviate the need for precise alignment of the masks during data acquisition. This type of search is easily parallelizable, meaning reconstruction times should not increase significantly given the proper computer hardware. Additionally, further study on the required number of masks is necessary, given that for dynamic studies at FELs the ideal technique would offer single-shot imaging capability.