Fourier Domain Pipeline

Since version 0.7.0, OffAxisHologram.run_pipeline() accepts an output_domain keyword argument. By default (output_domain="spatial") the pipeline returns the reconstructed complex field as usual. When output_domain="fourier" is set, the inverse FFT is skipped and a FourierFieldData is returned instead.

The FourierFieldData holds the filtered Fourier data and all the metadata needed to reconstruct the spatial field. Calling its finalize() method performs the inverse FFT and returns the spatial field identically to the default path.

Spatial Output (Default)

import numpy as np
import qpretrieve

edata = np.load("examples/data/hologram_cell.npz")
oah = qpretrieve.OffAxisHologram(edata["data"])
field = oah.run_pipeline()      # returns complex spatial field
print(type(field))              # numpy.ndarray
print(field.shape)              # (1, H, W)

Fourier Output (skipping the inverse FFT)

This is useful when combined with field propagation, see the Note above.

import numpy as np
import qpretrieve

edata = np.load("examples/data/hologram_cell.npz")
oah = qpretrieve.OffAxisHologram(edata["data"])
fourier_data = oah.run_pipeline(output_domain="fourier")

# The fourier_data carries the filtered Fourier data.
# Call finalize() to recover the spatial field when needed.
field = fourier_data.finalize()
print(field.shape)              # (1, H, W) — identical to the default path

Combining qpretrieve and nrefocus pipelines

The Fourier output is most useful when the result is passed directly to a wave propagation library such as nrefocus, which can consume the FourierFieldData object and skip its own forward FFT. This avoids a redundant iFFT + FFT pair at the qpretrieve/nrefocus boundary. For an nrefocus-integrated working example see the Examples.

Comparing Spatial vs. Fourier Pipeline

For unpadded, square spatial input data, the default spatial domain pipeline and the fourier domain pipeline are identical. There is only floating point imprecision. For padded pipelines, the pipelines are not identical due to padding and unpadding causing inconsistencies at the boundary of the images.