Skip to main content

Crate fpm_rs

Crate fpm_rs 

Source
Expand description

Image-plane Fourier ptychographic microscopy (FPM) reconstruction and simulation.

The crate separates experimental geometry from numerical reconstruction. A typical workflow is:

  1. describe the microscope with experiment::Optics and an illumination source such as experiment::PlanarLedArray, plus calibration and acquisition;
  2. compile that description into an algorithm-facing model::ImagePlaneModel;
  3. pair the model with resident or lazy measurements in a reconstruction::ReconstructionProblem;
  4. select an algorithms implementation and run it directly or through a reconstruction::Runner;
  5. inspect the complex object, amplitude, phase, pupil, trace, and diagnostics in the resulting reconstruction::ReconstructionResult; and
  6. optionally create controlled data with simulation, calculate metrics, or persist result and benchmark bundles through reconstruction::ResultBundle and benchmark.

Experimental coordinates and detector arrays use explicit conventions documented on their types. Two-dimensional arrays are generally indexed (row, column) and shaped (height, width); transverse wave vectors are (kx, ky) in radians per metre.

§Example

use fpm_rs::{
    algorithms::{AlternatingProjection, ReconstructionAlgorithm},
    experiment::{ArrayPose, Illumination, Optics, PlanarLedArray},
    measurements::{FrameMetadata, MeasurementStack},
    model::{ImagePlaneModel, ReconstructionShape},
    reconstruction::ReconstructionProblem,
};
use ndarray::Array3;

let optics = Optics {
    wavelength_vacuum_m: 532e-9,
    objective_na: 0.1,
    magnification: 4.0,
    camera_pixel_size: 6.5e-6,
    illumination_refractive_index: 1.0,
    objective_medium_refractive_index: 1.0,
    defocus_distance: None,
    pupil_aberration: None,
};
let illumination = Illumination::from_geometry(PlanarLedArray::new(
    (1, 1),
    (4e-3, 4e-3),
    (0.0, 0.0),
    ArrayPose::from_translation([0.0, 0.0, -90e-3]),
))?;
let model = ImagePlaneModel::from_experiment(
    &optics,
    &illumination,
    (4, 4),
    ReconstructionShape::Exact((4, 4)),
)?;
let measurements = MeasurementStack::new(
    Array3::from_elem((1, 4, 4), 1.0),
    vec![FrameMetadata::new(0)],
)?;
let problem = ReconstructionProblem::new(measurements, model)?;
let result = AlternatingProjection::default().iterations(1).run(&problem)?;
assert_eq!(result.object.dim(), (4, 4));

Re-exports§

pub use benchmark_bundle::BenchmarkBundle;
pub use benchmark_bundle::read_benchmark_bundle;
pub use error::Error;
pub use error::Result;
pub use reconstruction::ResultBundle;
pub use reconstruction::read_bundle;

Modules§

algorithms
Reconstruction algorithms and their shared execution contract. Iterative reconstruction algorithms for compiled image-plane models.
backend
CPU execution and the interfaces used by future resident-buffer backends. Execution backends and resident-buffer abstractions.
benchmark
Reproducible single-case reconstruction benchmarks.
benchmark_bundle
Normalized benchmark comparison bundles.
callbacks
Iteration callbacks for progress, checkpoints, diagnostics, and image output. Hooks that observe or control iterative reconstruction.
complex
Utilities for complex fields, amplitude, and wrapped phase. Allocation-aware helpers for two-dimensional complex sample fields.
configuration
Versioned experiment and simulation configuration.
datasets
Loading, discovery, caching, and subsetting for converted dataset bundles.
diagnostics
Structured iteration and per-frame reconstruction diagnostics. Structured convergence, coverage, and per-frame reconstruction diagnostics.
error
Error categories and the crate-wide error::Result alias. Error categories returned by validation, numerical, I/O, and bundle operations.
evaluation
Composed evaluation of a reconstruction against reference data.
experiment
Physical optics and illumination geometry compiled into numerical models. Physical optics and illumination descriptions for an image-plane experiment.
illumination_calibration
Bounded physical planar-array calibration configuration, state, and diagnostics. Bounded physical calibration of planar LED-array illumination.
illumination_initialization
Bright-field circle initialization for bounded physical planar arrays. Bright-field circle initialization for physical planar LED arrays.
measurements
Resident and lazy low-resolution intensity measurement stacks. Low-resolution measured-intensity stacks and acquisition metadata.
metrics
Reusable numerical metrics, organized by the meaning of their inputs.
model
Compiled image-plane models, Fourier crops, pupils, and forward propagation. Compiled image-plane forward model used by simulation and reconstruction.
reconstruction
Reconstruction problems, state, schedules, runners, results, and checkpoints. Reconstruction inputs, execution state, schedules, checkpoints, and results.
simulation
Synthetic objects, camera response, acquisition effects, and simulation. Controlled synthetic acquisition for image-plane Fourier ptychography.
tabular
On-demand Polars conversions for reconstruction and benchmark records.

Type Aliases§

Complex64
Alias for a Complex<f64>