FresnelPropagation#
- class deepinv.physics.FresnelPropagation(img_size, wavelength, distance, pixel_size, dtype=torch.cfloat, device='cpu', **kwargs)[source]#
Bases:
AngularSpectrumPropagationFresnel (paraxial angular-spectrum) propagation of a complex wave field.
For wavelength \(\lambda\), propagation distance \(z\), and spatial frequencies \((f_x, f_y)\), this class uses
\[H(f_x, f_y) = \exp\left[-\mathrm{i}\pi\lambda z (f_x^2 + f_y^2)\right].\]This transfer function assumes a coherent plane wave illumination and paraxial approximation. It is used in the near-field case where the propagation distance \(z \ll a^2/\lambda\), with \(a\) being the feature size of the object (or pixel size).
Note
To model in-line holography, compose this physics with
deepinv.physics.PhaseRetrievaland a transmission function. To model propagation-based phase-contrast CT, additionally compose withdeepinv.physics.Tomographyordeepinv.physics.TomographyWithAstra.Hint
Holography geometries are often described in terms of the Fresnel number. The Fresnel number is defined from the physical parameter as
\[a_F = \frac{a^2}{\lambda z},\]with \(a\) being the characteristic size of the object, typically the pixel size, \(\lambda\) the wavelength, and \(z\) the propagation distance.
- Parameters:
img_size (tuple[int, ...]) – Shape of an unbatched input. The final two entries are
(height, width).wavelength (float) – Wavelength in the same length unit as
distanceandpixel_size.distance (float) – Propagation distance.
pixel_size (float, tuple[float, float]) – Sampling pitch
dy, dx. Iffloat, thendy, dy, default 1.dtype (torch.dtype) – Complex dtype of the transfer function. Default:
torch.cfloat.device (torch.device, str) – Device on which the operator is created.
- Examples:
Using FresnelPropagation for phase retrieval
>>> import torch >>> from deepinv.physics import FresnelPropagation, PhaseRetrieval >>> B = FresnelPropagation( ... img_size=(1, 64, 64), ... wavelength=500e-9, ... distance=0.1, ... pixel_size=5e-6, ... ) >>> physics = PhaseRetrieval(B=B) >>> transmission = torch.randn(2, 1, 64, 64, dtype=torch.cfloat) >>> physics(transmission).dtype torch.float32 >>> physics(transmission).size() torch.Size([2, 1, 64, 64])
If a transmission function should be added, proceed like:
>>> from deepinv.physics import Physics, compose >>> k = 2 * torch.pi / 500e-9 >>> transmission_model = Physics( ... A=lambda x: torch.exp(-1j * k * x[:, 0:1] - k * x[:, 1:2]) ... ) >>> physics = compose(transmission_model, physics)