Abstract
Computing wave propagation is of the utmost importance in computational optics, especially three-dimensional optical imaging and computer-generated hologram. The angular spectrum method, based on fast Fourier transforms, is one of the efficient approaches; however, it induces sampling issues. We report a Hybrid Taylor Rayleigh-Sommerfeld diffraction (HTRSD) that achieves more accurate and faster wave propagation than the widely used angular spectrum method.
© 2022 Optica Publishing Group under the terms of the Optica Open Access Publishing Agreement
1. Introduction
As Joseph W. Goodman says, “The phenomenon known as diffraction plays a role of utmost importance in the branches of physics and engineering that deal with wave propagation [1].” The wave equation describes the propagation of light through most media, and leads us to regard optical imaging as a specific mapping of object light into image light distributions. Advanced computational techniques along with the developed digital devices have promoted the contemporary computational imaging [2], which demands precise and high-speed numerical wave propagation that can work over a wide range of, distances, especially in situations that require numerous wave propagations, or where the target fields consist of a large amount of data, such as three-dimensional (3D) imaging, which requires volume diffraction [3,4] or multiple-slice beam propagation methods [5–8], computer-generated holograms (CGH) [9–11] for 3D [12] AR/VR [13] display and imaging with inverse problem solving [4,7,14].
Fast-Fourier-transform (FFT) convolution approach is widely used to implement the diffraction formulas for its speed. However, it induces sampling issues that affect the numerical accuracy of computing diffraction [15,16]. A lot of efforts have been made to achieve accurate propagation in a wide range of distances [17], such as intermediate plane techniques [18], band-limit angular spectrum method (ASM) to avoid aliasing [19], padding to expand the band-width [17,20,21], adaptive-sampling to utilize the space-bandwidth product while reducing the computational complexity [22], non-uniform FFT to achieve fast calculating [22,23]. Most methods focus on sampling issues [24–26].
This paper improves the Rayleigh-Sommerfeld diffraction computation without concentrating on the sampling issue. Instead, by Taylor expanding the exponential term in the diffraction convolution kernel, the angular spectrum diffraction formula can be approximated such that a similar numerical accuracy is attainable with fewer bits formats, e.g., single-precision floating-point data type. This cuts off the required computational memory by half compared to the usual double-precision floating-point data types, and significantly reducing run-time consequentially.
2. Theory
We consider free-space propagation of a fully coherent monochromatic scalar wave field, in the spatial domain. Let $\lambda$ be the wavelength of the scalar field, and $k = 2\pi /\lambda$ be the wavenumber. In a 3D Cartesian coordinate system $(x, y, z)$, we consider wave propagation along the $z$-axis, and the transverse 2D plane $\boldsymbol {r}_{\perp } = (x, y)$ is of our interest. $|\cdot |$ denotes vector lengths in $\ell _2$. We are interested in how an unbounded initial field $u(\boldsymbol {r}_{\perp }, 0)$ evolves into a new field $u(\boldsymbol {r}_{\perp }, z)$ [1], after a propagation distance of $z$:
Except for the sampling issues in the numerical diffraction implementation, we found that accuracy depends on floating-point precision. Because the visible light’s wavelength is hundreds of nano-meter and the sensor pixel pitch is at the micro-meter scale, the terms $\sqrt {1-\lambda ^{2}|\boldsymbol {\rho }_{\perp }|^{2}}$ in Eq. (4) and $\exp (\text {j} k \boldsymbol {r})$ in Eq. (3) cannot be accurately represented by a single-precision floating point number, i.e., the conventional numerical diffraction requires double-precision representations. This limitation is demonstrated in Fig. 1. This limitation presents an obstacle in particular for implementations on graphics processing units (GPUs), which have both limited memory resources, and are significantly faster at processing single vs. double precision numbers. Single precision arithmetic is commonly used in deep learning frameworks [29] and physics-based neural network training [3], but naïvely using single precision for diffraction simulations leads to inaccurate results due to numerical errors in the phase terms.
In the following, we show the proposed Hybrid Taylor Rayleigh-Sommerfeld diffraction (HTRSD) method. With a proper Taylor expansion and hybrid FFT-DI and ASM, we can achieve precise numerical wave propagation with a single-precision float number. We also show the time and memory efficiency. For convenience, we name ASM-single and ASM-double as the conventional band-limited ASM [19] method work in single- and double-precision float format, respectively.
For the PSF in Eq. (3), direct sampling may lead to severe numerical rounding errors caused by $\exp (\text {j} k \boldsymbol {r})$, in a general setting when $k \gg 1/z$, we can approximate $r$ using Taylor series, that is valid when $|\boldsymbol {r}_{\perp }| < z$:
As mentioned in previous paragraph, the double-precision float number requirement leads to significant time and memory consumption, thus limiting the numerical diffraction’s applications. Here we show that with the Taylor expansion, we can eliminate the double-precision float number requirement in the Rayleigh-Sommerfeld diffraction. Figure 1 demonstrates the limitations when computing the PSF and CTF naïvely and with the Taylor expansion in single-precision float number. Figure 1(a) shows the real parts of $\exp (\text {j} (k\boldsymbol {r} - kz) )$ with respect to $|\boldsymbol {r}_{\perp }|/z$, and Fig. 1(b) shows the real parts of $\exp \small (\text {j} kz (\sqrt {1 - \lambda ^{2} |\boldsymbol {\rho }_{\perp }|^{2}} - 1) \small )$ with respect to $\lambda |\boldsymbol {\rho }_{\perp }|$. The difference (red lines) between the naïve and the Taylor expansion show that numerical precision could decrease when using single floating points for computing the PSF and CTF via Eq. (3) and Eq. (4). A naïve approach suffers from severe numerical rounding errors (first rows). In contrast, using Taylor series and by approximating the phase terms, converges to the ground truths computed using double precision accuracy (second rows). Approximation accuracy further increases when adding more terms (third rows). As for the IEEE floating point standard, for single precision the smallest spacing is $1.1921 \times 10^{-7}$ and for double precision it is up to $2.2204 \times 10^{-16}$ [30]. The accuracy could not beyond this.
Since the ASM is not suitable for long distance propagation [26,31], combine the ASM and FFT-DI with the conditions of the Taylor expansion, the finial diffraction formula is:
3. Numerical verification
Following the band-limited ASM, in the implementation, we pad the original field with zeros for two times and crop the field to the original size after propagation, as shown in Fig. 2. We implemented the code with PyTorch 1.10 [29]. For generalization, we set the input field as a volume of size $N_x \times N_y \times N_z$. The CTF or PSF are the same size as the input field. This can be easily applied to both 2D and 3D wave propagation by setting $N_z=1$ or $N_z > 1$. We set the Taylor expansion order as $n=10$. The following numerical experiments were conducted on a workstation with two Intel Xeon E5-2690 2.60GHz CPUs.
The proposed method is verified on circular and square apertures with analytical expressions. For a circular aperture of radius $a$, at different propagation distance $z$, under normal uniform plane-wave illumination [1], the on-axis scalar fields on the optical axis can be expressed exactly [32,33]:
The on-axis field can not reflect the performance of the whole field propagation since we usually detect the 2D fields perpendicular to the optical axis in practice. Here we perform the comparison of circular and rectangle apertures. In the following, we set the pixel size of the original field as $N_x = N_y = 255$, the width and length are $L_x = L_y = {0.5}\;\textrm {m}$, $a=0.125$, and $\lambda ={500}\;\textrm {nm}$ (same parameters as in Chapter 5 of Ref. [31]). We measured the diffracted fields at $z=\{1000,2000,4000,20000\}\textrm {m}$ respectively, which correspond to Fresnel number $N_f =\frac {a^{2}}{\lambda z} = \{31.25,15.625,7.813,1.562\}$. This setting ensures that the measured diffraction images are within the Fresnel region. Figure 4 shows the comparison of circular aperture diffraction. From both the 2D images in Fig. 4(a) and the plots of the crossed center line in Fig. 4(b), we can observe that ASM-single method doesn’t work at all, and on the contrary, ASM-double and the HTRSD-single work well. The diffraction images of a rectangle aperture in Fig. 5 shows the similar results as in the circular aperture diffraction case. In this case, we also provide the plot of the RS calculation with numerical integral (RSI) method in Fig. 5(b). The proposed HTRSD method shows a comparable results to both the RSI and ASM with double precision. From both the tests on circular and rectangle apertures, we can say that the proposed HTRSD-single can achieve comparable results as the conventional ASM.
The previous paragraphs show that the proposed HTRSD can achieve even better accuracy in a single-precision float number format than the conventional band-limited ASM method with a double-precision float number. Here we show the time and memory cost comparison. To compare the time cost, we propagate a 2D complex field of pixel size $1024 \times 1024$ for various times with the ASM in double float precision and the proposed method in single float precision. Figure 6(a) shows the time cost with respect to the propagation numbers. It shows that the time cost is linearly proportional to the propagation number in both cases, while the conventional method costs 1.5 times over the proposed method. This is not surprising since both GPU and CPU can compute higher number operations if numbers have less precision. Notably, calculation of the Fourier transform of the PSF in HTRSD-single was included in the comparison. Even so, the speed of HTRSD-single is still much faster than the conventional ASM in double precision. For the memory costs, the target object is a volume with the same lateral size as in the speed test but with varying depth numbers. Similar to the time cost, the memory cost is also linearly proportional to the target volume size, while the conventional method costs double memory to the proposed method. This is because the double float is a 64-bit point number, and the single float is 32-bit, so a single float number uses half of the memory as the same size double float number uses. It should be noted that the HTRSD might perform more accurately if double float precision is used, however this may come at the expense of speed and memory usage.
4. Conclusion
We present a numerical diffraction technique, HTRSD, that can achieve more accurate Rayleigh-Sommerfeld diffraction at a much higher speed but consume dramatically less computational resources as well as memory. This could promote the development of contemporary computational optics, especially computational imaging that includes optimization-based inverse imaging and extensive volume diffraction calculation in both optical imaging and displays. This work could also help computational imaging techniques that employ GPUs due to the power of GPU computing on single-precision floating points [34].
Funding
King Abdullah University of Science and Technology.
Disclosures
The authors declare no conflicts of interest.
Data availability
Data underlying the results presented in this paper are not publicly available at this time but may be obtained from the authors upon reasonable request.
References
1. J. W. Goodman, Introduction to Fourier Optics (W. H. Freeman and Company, 2017).
2. J. N. Mait, G. W. Euliss, and R. A. Athale, “Computational imaging,” Adv. Opt. Photonics 10(2), 409 (2018). [CrossRef]
3. N. Chen, C. Wang, and W. Heidrich, “Holographic 3D particle imaging with model-based deep network,” IEEE Trans. Comput. Imaging 7, 288–296 (2021). [CrossRef]
4. N. Chen, C. Wang, and W. Heidrich, “Snapshot space–time holographic 3D particle tracking velocimetry,” Laser Photonics Rev. 15(8), 2100008 (2021). [CrossRef]
5. J. M. Cowley and A. F. Moodie, “The scattering of electrons by atoms and crystals. I. A new theoretical approach,” Acta Crystallogr. 10(10), 609–619 (1957). [CrossRef]
6. A. M. Maiden, M. J. Humphry, and J. M. Rodenburg, “Ptychographic transmission microscopy in three dimensions using a multi-slice approach,” J. Opt. Soc. Am. A 29(8), 1606 (2012). [CrossRef]
7. H. Wang, W. Tahir, J. Zhu, and L. Tian, “Large-scale holographic particle 3d imaging with the beam propagation model,” Opt. Express 29(11), 17159 (2021). [CrossRef]
8. N. Chen, J. Yeom, K. Hong, G. Li, and B. Lee, “Fast-converging algorithm for wavefront reconstruction based on a sequence of diffracted intensity images,” J. Opt. Soc. Korea 18(3), 217–224 (2014). [CrossRef]
9. E. Sahin, E. Stoykova, J. Mäkinen, and A. Gotchev, “Computer-generated holograms for 3D imaging,” ACM Comput. Surv. 53(2), 1–35 (2021). [CrossRef]
10. Y. Li, J. Wang, C. Chen, B. Li, R. Yang, and N. Chen, “Occlusion culling for computer-generated cylindrical holograms based on a horizontal optical-path-limit function,” Opt. Express 28(12), 18516–18528 (2020). [CrossRef]
11. N. Chen, C. Wang, and W. Heidrich, “Compact computational holographic display (invited article),” Front. Photon. 3, 1 (2022). [CrossRef]
12. J. Hong, Y. Kim, H.-J. Choi, J. Hahn, J.-H. Park, H. Kim, S.-W. Min, N. Chen, and B. Lee, “Three-dimensional display technologies of recent interest: principles, status, and issues [invited],” Appl. Opt. 50(34), H87–H115 (2011). [CrossRef]
13. C. P. Chen, Y. Cui, Y. Chen, S. Meng, Y. Sun, C. Mao, and Q. Chu, “Near-eye display with a triple-channel waveguide for metaverse,” Opt. Express 30(17), 31256–31266 (2022). [CrossRef]
14. N. Chen, E. Y. Lam, T.-C. Poon, and B. Lee, “Sectional hologram reconstruction through complex deconvolution,” Opt. Lasers Eng. 127, 105945 (2020). [CrossRef]
15. F. Shen and A. Wang, “Fast-fourier-transform based numerical integration method for the rayleigh-sommerfeld diffraction formula,” Appl. Opt. 45(6), 1102 (2006). [CrossRef]
16. W. Zhang, H. Zhang, and G. Jin, “Single-fourier transform based full-bandwidth fresnel diffraction,” J. Opt. 23(3), 035604 (2021). [CrossRef]
17. X. Yu, T. Xiahui, Q. Y. Xiong, P. Hao, and W. Wei, “Wide-window angular spectrum method for diffraction propagation in far and near field,” Opt. Lett. 37(23), 4943 (2012). [CrossRef]
18. C. Chen, K. Chang, C. Liu, J. Wang, and Q. Wang, “Fast hologram generation using intermediate angular-spectrum method for high-quality compact on-axis holographic display,” Opt. Express 27(20), 29401 (2019). [CrossRef]
19. K. Matsushima and T. Shimobaba, “Band-limited angular spectrum method for numerical simulation of free-space propagation in far and near fields,” Opt. Express 17(22), 19662 (2009). [CrossRef]
20. N. Chacko, M. Liebling, and T. Blu, “Discretization of continuous convolution operators for accurate modeling of wave propagation in digital holography,” J. Opt. Soc. Am. A 30(10), 2012 (2013). [CrossRef]
21. W. Zhang, H. Zhang, and G. Jin, “Band-extended angular spectrum method for accurate diffraction calculation in a wide propagation range,” Opt. Lett. 45(6), 1543 (2020). [CrossRef]
22. W. Zhang, H. Zhang, and G. Jin, “Adaptive-sampling angular spectrum method with full utilization of space-bandwidth product,” Opt. Lett. 45(16), 4416 (2020). [CrossRef]
23. Y.-H. Kim, C.-W. Byun, H. Oh, J. Lee, J.-E. Pi, G. H. Kim, M.-L. Lee, H. Ryu, H.-Y. Chu, and C.-S. Hwang, “Non-uniform sampling and wide range angular spectrum method,” J. Opt. 16(12), 125710 (2014). [CrossRef]
24. É. Lalor, “Conditions for the validity of the angular spectrum of plane waves,” J. Opt. Soc. Am. 58(9), 1235 (1968). [CrossRef]
25. C. Buitrago-Duque and J. Garcia-Sucerquia, “Non-approximated rayleigh–sommerfeld diffraction integral: advantages and disadvantages in the propagation of complex wave fields,” Appl. Opt. 58(34), G11 (2019). [CrossRef]
26. S. Mehrabkhani and T. Schneider, “Is the rayleigh-sommerfeld diffraction always an exact reference for high speed diffraction algorithms?” Opt. Express 25(24), 30229 (2017). [CrossRef]
27. M. R. Teague, “Deterministic phase retrieval: a green’s function solution,” J. Opt. Soc. Am. 73(11), 1434–1441 (1983). [CrossRef]
28. H. Weyl, “Ausbreitung elektromagnetischer wellen über einem ebenen leiter,” Ann. Phys. 365(21), 481–500 (1919). [CrossRef]
29. A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Köpf, E. Z. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala, “Pytorch: An imperative style, high-performance deep learning library,” in Annual Conference on Neural Information Processing Systems 2019, H. M. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché-Buc, E. B. Fox, and R. Garnett, eds. (Vancouver, BC, Canada, 2019), pp. 8024–8035.
30. “Ieee standard for floating-point arithmetic,” IEEE Std 754-2019 (Revision of IEEE 754-2008) pp. 1–84 (2019).
31. D. G. Voelz, Computational Fourier Optics: A MATLAB Tutorial (SPIE, 2011).
32. A. Dubra and J. A. Ferrari, “Diffracted field by an arbitrary aperture,” Am. J. Phys. 67(1), 87–92 (1999). [CrossRef]
33. S. J. Orfanidis, Electromagnetic Waves and Antennas (Rutgers University, 2016).
34. Wikipedia, “Geforce 20 series,” https://en.wikipedia.org/wiki/GeForce_20_series (2010 (accessed September 20, 2022)).