Free Matlab Source Codes for the semi implicit relaxed Douglas-Rachford (sDR)

I. Overview

This page describes an iterative Ptychography reconstruction algorithm, termed semi-implicit relaxed Douglas-Rachford (sDR), which has been developed to improve the robustness and the convergence of sequential extended Ptychographic iteartive engine (ePIE). Our proposal algorithm sDR incorporates two techniques: semi-implicit or Proximal Mapping and relaxed Douglas-Rachford. The first technique is used to improve the robustness of object update. The second technique, which is a generalized version of Difference Map (DM) and relaxed averaged alternating reflections (RAAR), is an accelerated method applied on the exit wave Ψ = PO to improve the accelration [see M. Pham, A. Rana, J. Miao, and S. Osher, A semi-implicit relaxed Douglas-Rachford algorithm (sDR) for Ptychograhpy. in detail].

Beside memory efficiency, another exceptional ability of stochastic sequential updating method is the power to escape local minima due to its stochasticity which plays a crucial role in non-convex optimization. One drawback of sequential ePIE is that it requires small updating step size for stable convergence. Limiting the convergence speed, the step size restriction may cause divergence if violated. Furthermore as the overlap reduces (less overlap), ePIE and rPIE fail to converge or suffer slow convergence which makes ePIE and rPIE reconstructions infeasible in term of computational time. The incorporation of relaxed Douglas-Rachford and semi-implicit method in sDR allows a faster convergence and robustness in reconstructions.

II. Implementation

a. Algorithm

The algorithm is developed based on sequential extended Ptychographic iterative engine (ePIE). Beside the simplicity and memory efficency, the stochastic gradient descents play a crucial part in non-convex optimization due to its ability to escape local minima. In ePIE, objects O and probes P are updated sequentially everytime a single gradient is computed. To accelerate the convergence, we introducing exit wave variable Ψ = PO, and apply relaxed Douglas-Racford algorithm

where σ ∈ [0,1] is the relaxed momentum parameter. Note that we use a (generalized) Proximal Mapping on the Fourier modulus constraint function f and overlap constraint function g instead of using directly the constraints. Next we improve the object update by semi implit method

Combing the two optimization tehcniques, we propose the semi-implicit relaxed-Douglas Rachford sDR algorithm as follow

where ρ is the the relaxed Fourier modulus parameter. βO and βP are the updating step size of the object and the probe.

b. Experiments

We simulate a a complex object of size 128 x 128 pixels with the amplitude being a camera man image and the phase being a pepper image. The probs is a simple unique circle of radius 50. The scan step size is 50 pixels which corresponds to 39.1% overlap. Poisson noise is added to the diffraction intensity with Noise Level at 5%

Figure 1: The amplitude (camera man) and the phase (pepper) of the simulated object.

We then reconstruct the image with ePIE, rPIE and sDR algorithms

Figure 2: The ePIE, rPIE and sDR reconstructions with (a-c) the amplitudes and (d-f) the phase respectively. Having capability to escape local minima, sDR performs well with low overlap while ePIE and rPIE fail. In addition, ePIE and rPIE results show a confusion between the amplitude and the phase.

III. The Matlab Source Codes of the OSS Algorithm :

The OSS Matlab source codes are freely available. Please click here to download the Matlab code and Code Instruction, and here to access to the zenodo website for the data used in this paper.

If you use these codes for your publications and/or presentations, we request you cite our paper: M. Pham, A. Rana, J. Miao, and S. Osher, A semi-implicit relaxed Douglas-Rachford algorithm (sDR) for Ptychograhpy.

For any further questions, comments and/or suggestions, please contact Minh Pham ( or Arjun Rana (