Figure 2 shows phase images of MgO cubes obtained using the conventional iterative flux-preserving in-line holography reconstruction algorithm21 (Fig. 2a), the same flux-preserving approximation with gradient flipping applied (Fig. 2b) and off-axis holography (Fig. 2c). The phase obtained using the conventional in-line reconstruction algorithm varies over the range -2 to 6 rad, which is ~ 50% lower than that recovered using off-axis holography. The rapid decrease in phase for iterative reconstruction just outside the MgO cube (Fig. 2a and the red profile in Fig. 2d) results from missing low spatial frequencies. Figure 2b and the corresponding line scan in Fig. 2d show that gradient flipping prevents artifacts at the edges of the MgO cube and results in a homogeneous background. The agreement between Figs. 2b and 2c is satisfying. The remaining difference of ~20% between the GF-FRWR and off-axis results may be attributed partially to imperfect energy filtering during the acquisition of the focal series. It should be noted that off-axis electron holography inherently filters out inelastic scattering26,27, whereas in-line electron holography has to rely on the use of an energy filter. In order to reduce the influence of inelastic scattering, the imaging model used here calculates and subtracts the inelastic contribution to first order.

The power spectra are shown in Fig. 2e highlight the differences in information transfer between the three methods. The phase resolutions obtained using in-line and off-axis electron holography are 0.34 nm and 1.2 nm, respectively. (The fields of view are identical, but a reciprocal space mask was applied during the reconstruction of the wave function from the off-axis data in order to achieve a reasonable signal to noise ratio). The power spectra show that the GF-FRWR algorithm recovers information reliably over distances of up to ~80 nm, whereas the FRWR reconstruction is only reliable over distances of up to ~30 nm.

Although the GF-FRWR algorithm did not recover phase differences reliably over distances larger than ~80 nm, the present example showed an improvement over the conventional reconstruction algorithm, with dramatically reduced artifacts at the edges of the particles originating from missing low spatial frequencies. The reconstructed phase images look much closer to results obtained using off-axis holography while retaining the superior spatial resolution of focal series reconstruction. This approach may help in the measurement of quantities such as variations in mean inner potential across short distances.

In the second example, results obtained from Fe-filled C nanospheres provide similar conclusions to those obtained from MgO cubes. Phase images obtained using conventional in-line (FRWR) reconstruction, GF-FRWR, and off-axis electron holography are shown in Figs. 3a, 3b, and 3c, respectively. Conventional FRWR recovers phase differences up to π radians, whereas off-axis reconstruction shows that the phase spans a range of 4.12 ± 0.144 radians. The discrepancy is reduced to ~80% of the off-axis phase when GF-FRWR is applied. The large phase variations at the edges, which are associated with missing low spatial frequencies, are prominent in the conventional FRWR reconstruction in Fig. 3d (red line), but are significantly reduced when using gradient flipping. In Fig. 3e, power spectra are shown for the three reconstruction schemes, confirming that low spatial frequency information obtained using the GF-FRWR algorithm is much closer to that obtained using off-axis holography than FRWR.

We now discuss the effect of the parameter *r*c in Eq. (SI1) in the SI. This parameter determines the real space resolution above which gradient flipping is applied. Phase information for distances below *r*c is determined by the iterative FRWR reconstruction algorithm, with GF only affecting relative phases across greater distances. Figure 4 shows phase images and profiles reconstructed using different values of *r*c for the Fe-filled C nanospheres. Increasing *r*c initially improves the contrast in the phase. Figures 4a to 4d show that the lowest contrast is obtained for *r*c = 5 nm. The highest contrast is obtained with *r*c set to 25 nm (Fig. 4g). Increasing *r*c further does not improve the contrast.

If *r**c* is set to be much higher than the lateral coherence length of the incident electron wave function, then reconstruction proceeds as if no gradient flipping had been applied since the exponential in Eq. (SI1) only includes very low spatial frequencies. For this reason, dark features appear around the particle in Fig. 4f when the threshold value is too high.

The *M* value defined in Eq. (2), which measures the mismatch between experimental and simulated images during reconstruction, is also smallest at *r*c = 25 nm (Fig. 4g). Figure 4h shows the dependence of *M* on *r*c. The minimum value is obtained when the contrast is maximized at *r**c* = 25 nm, indicating that *M* is likely to be a suitable figure of merit for optimizing *r**c*.

The profile taken from the GF-FRWR reconstruction shows an offset in phase between vacuum regions on opposite sides of the core-shell particle (Fig. 4i). This problem arises because the vacuum regions are not connected. Ideally, both sides of the particle should have the same phase shift. We again observe minimum phase offset differences for minimum *M* and highest contrast, *i.e.*, where *r*c is 25 nm.

FIG. 5 Phase images of Fe-filled C nanospheres reconstructed using phase prediction thresholds of a) 0.01, b) 0.05, c) 0.1, d) 0.25, e) 0.31, f) 0.4, g ) 0.5, h) 1.0 and i) 0.20 rad. j) Phase prediction threshold *vs* M value (mismatch between simulated and experimental images) and phase contrast. k) Magnified version of j). l) Line profiles extracted from the region marked in a) for phase images a) to i).

When the PPT value was set to 0.4 or 0.5 rad (Figs. 5f-5g), reconstruction artifacts became obvious. For the more extreme case of PPT = 1 rad, the phase could no longer be reconstructed (Fig. 5h). For both this data set and PPT = 0.31 rad, the reconstruction diverged when the number of iterations exceeded 2500. For PPT = 0.20 rad, the algorithm diverged when it was run for more than 4000 iterations. This behavior seems to be related to the way in which the phase is treated in the padded area outside the field of view, where experimental intensity data are available. Since it is not practical to use such large numbers of iterations, this is not a limitation for the application of the algorithm. After determination of the ideal values for *r**c* and PPT using a small number of iterations, the iteration number was increased to obtain a minimum value of the mismatch *M*, which was closest to the actual object wave.

The individual and combined effects of phase prediction and gradient flipping are shown in Fig. 6. The comparison shows that phase prediction increases the contrast significantly and can recover much lower spatial frequencies in the phase than the iterative nonlinear flux-preserving focal series reconstruction algorithm alone, even when gradient flipping is turned on. Figure 6a and the red line profile in Fig. 6d show that phase prediction results in extended contrast. The same figures show significant edge artifacts associated with missing low spatial frequencies when gradient flipping is not used. Gradient flipping corrects for the missing low spatial frequency information by finding a phase image that is consistent with the experimental data and sparse in its gradient. The blue profile in Fig. 6d shows a constant phase profile in the vacuum region, where no phase variations are expected. Although both gradient flipping and phase prediction individually have strong effects on the reconstructed phase, the most significant improvement results from the use of gradient flipping and phase prediction together. Figure 6c and the green profile in Fig. 6d show how edge artifacts are then significantly reduced.