pyAPIC.core.reconstructor module

pyAPIC.core.reconstructor.directed_hilbert_transform_stack(Re_stack: ndarray, freqXY_stack: ndarray) ndarray[source]

Perform the directed Hilbert transform on a stack of real-valued images. Returns the imaginary part stack.

pyAPIC.core.reconstructor.fft2c(x: ndarray) ndarray[source]

Compute a centered 2-D Fourier transform.

fft2 is applied and the result is shifted so that the zero-frequency component appears at the center of the last two axes.

pyAPIC.core.reconstructor.ifft2c(x: ndarray) ndarray[source]

Inverse transform corresponding to fft2c().

The input is shifted back with ifftshift before applying ifft2 so that arrays transformed with fft2c() are perfectly inverted.

pyAPIC.core.reconstructor.pupil_mask_stack(shape: tuple, freqXY_stack: ndarray, NA_pix: float) ndarray[source]

Generate pupil masks for each LED frame. shape: (N, H, W) freqXY_stack: (2, N)

pyAPIC.core.reconstructor.reconstruct(data: ImagingData, params: ReconParams) dict[source]
Perform the full reconstruction pipeline:
  1. Compute real part: 0.5*log(I)

  2. Directed Hilbert transform -> imaginary part

  3. Exponentiate to get complex field stack

  4. Optionally reconstruct aberration via get_ctf

Returns a result dict containing:
  • ‘E_stack’: complex field stack (N, H, W)

  • ‘aberration’: CTF array if computed

pyAPIC.core.reconstructor.stitch(data: ImagingData, E_reconstructed: ndarray, CTF: ndarray | None = None, method: str = 'nearest')[source]

Combine the reconstructed field stack into a single complex field.

Parameters:
  • data (ImagingData) – Acquisition parameters used for pupil positioning.

  • E_reconstructed (np.ndarray) – Complex field stack of shape (N, H, W).

  • CTF (np.ndarray | None, optional) – Aberration transfer function. If provided it will be shifted to each LED position and multiplied with the pupil functions.

  • method (str, optional) – How to combine the Fourier patches. Options are "average" and "nearest". "nearest" selects the patch whose illumination center is closest to each Fourier pixel while "average" performs an overlap average. "nearest" is the default.

Returns:

(E_reconstructed, pupil_masks, effective_pupil, E_stitched)

Return type:

tuple