Skip to main content

ImagePlaneModel

Struct ImagePlaneModel 

Source
pub struct ImagePlaneModel { /* private fields */ }
Expand description

Algorithm-facing image-plane FPM model. It contains no LED or camera geometry.

Source-indexed vectors, crops, and optional subpixel offsets describe individual illuminations. Acquisition-frame-indexed gains, background, and multiplexing describe measured frames. Shapes are (height, width) and stored arrays own their data.

Implementations§

Source§

impl ImagePlaneModel

Source

pub fn new( k_vectors: Vec<KVector>, pupil: Pupil, crop_indices: CropIndices, sampling: Sampling, image_shape: (usize, usize), reconstruction_shape: (usize, usize), ) -> Result<Self>

Builds and validates a non-multiplexed model from explicitly compiled components.

k_vectors and crop_indices must have equal non-zero source counts. pupil and each crop must have image_shape; sampling and reconstruction_shape must be mutually consistent.

Source

pub fn from_experiment( optics: &Optics, illumination: &Illumination, image_shape: (usize, usize), reconstruction_shape: ReconstructionShape, ) -> Result<Self>

Compiles an experiment using an explicit or automatically selected reconstruction shape.

Source

pub fn suggest_reconstruction_shape( optics: &Optics, illumination: &Illumination, image_shape: (usize, usize), reconstruction_shape: ReconstructionShape, ) -> Result<(usize, usize)>

Resolves an explicit shape or suggests an automatic reconstruction grid from the actual illumination wave vectors.

Source

pub fn compile( optics: &Optics, illumination: &ResolvedIllumination, image_shape: (usize, usize), reconstruction_shape: ReconstructionShape, ) -> Result<Self>

Compiles already resolved illumination into algorithm-facing numerical state.

Geometry positions and poses are intentionally not retained. Sparse frame weights are multiplied by stable source powers during compilation.

Source

pub fn source_count(&self) -> usize

Returns the number of individual illumination sources.

Source

pub fn frame_count(&self) -> usize

Returns the acquisition-frame count, which can differ when sources are multiplexed.

Source

pub fn is_multiplexed(&self) -> bool

Returns whether acquisition frames contain incoherent combinations of sources.

Source

pub fn k_vectors(&self) -> &[KVector]

Borrows transverse wave vectors in source order, in radians per metre.

Source

pub fn pupil(&self) -> &Pupil

Borrows the low-resolution complex pupil and binary support.

Source

pub fn pupil_mut(&mut self) -> &mut Pupil

Mutably borrows the pupil; callers must preserve its shape and support invariants.

Source

pub fn crop_indices(&self) -> &CropIndices

Borrows integer Fourier crops in individual source order.

Source

pub fn subpixel_offsets(&self) -> Option<&[FourierOffset]>

Borrows optional fractional (row, column) offsets in source order.

Source

pub const fn sampling(&self) -> &Sampling

Borrows real- and Fourier-space sampling metadata.

Source

pub const fn image_shape(&self) -> (usize, usize)

Returns low-resolution detector shape as (height, width).

Source

pub const fn reconstruction_shape(&self) -> (usize, usize)

Returns high-resolution object shape as (height, width).

Source

pub fn frame_gains(&self) -> Option<&[f64]>

Borrows optional non-negative multiplicative gains in acquisition-frame order.

Source

pub fn background(&self) -> Option<&[f64]>

Borrows optional non-negative optical intensity background.

Length is one low-resolution frame (broadcast) or a complete row-major (frame, row, column) stack.

Source

pub fn multiplexing_matrix(&self) -> Option<&MultiplexingMatrix>

Borrows optional acquisition-frame rows of non-negative source weights.

Source

pub fn with_frame_gains(self, values: Option<Vec<f64>>) -> Result<Self>

Replaces gains, requiring one finite non-negative value per acquisition frame.

Source

pub fn update_intensity_calibration( &mut self, source_power: &[f64], acquisition: &AcquisitionPlan, ) -> Result<()>

Refreshes only source powers, sparse acquisition weights, and frame gains.

Physical positions, propagation vectors, Fourier crops, subpixel offsets, pupil samples, sampling metadata, and reconstruction shapes are retained. This is the intensity-only update boundary used by physical illumination calibration.

Source

pub fn update_illumination_geometry( &mut self, optics: &Optics, illumination: &Illumination, ) -> Result<()>

Recompiles illumination-dependent geometry into the existing numerical grid.

The low- and high-resolution shapes, optical sampling, pupil values, background, and other static model state are retained. A geometry that would move a crop outside the existing reconstruction grid is rejected.

Source

pub fn replace_k_vectors(&mut self, values: Vec<KVector>) -> Result<()>

Replaces the source wave vectors while preserving the compiled crops.

This is intended for calibrated models whose replacement vectors use the same Fourier sampling and source ordering. The full model invariant set is revalidated before the replacement is committed.

Source

pub fn with_background(self, values: Option<Vec<f64>>) -> Result<Self>

Replaces optical intensity background with a broadcast frame, full stack, or None.

Source

pub fn with_multiplexing(self, matrix: MultiplexingMatrix) -> Result<Self>

Sets compiled sparse acquisition with one non-empty non-negative row per frame.

Source

pub fn with_subpixel_offsets(self, offsets: Vec<FourierOffset>) -> Result<Self>

Sets one finite fractional Fourier-grid offset per individual source.

Source

pub fn source_offset(&self, source: usize) -> Result<FourierOffset>

Returns a source’s fractional Fourier-grid offset, or zero when absent.

Source

pub fn extract_patch( &self, object_spectrum: ArrayView2<'_, Complex64>, source: usize, destination: &mut [Complex64], ) -> Result<()>

Extracts one source patch from a standard-layout high-resolution object spectrum.

destination has image_shape.0 * image_shape.1 row-major complex values. Fractional offsets use bilinear Fourier-grid interpolation.

Source

pub fn insert_patch_adjoint( &self, destination: ArrayViewMut2<'_, Complex64>, source: usize, update: &[Complex64], scale: f64, ) -> Result<()>

Adds an update into a high-resolution spectrum through the adjoint crop operator.

Source

pub fn validate_source_offset( &self, source: usize, offset: FourierOffset, ) -> Result<()>

Checks that source exists and the interpolation stencil for offset is in bounds.

Source

pub fn frame_gain(&self, frame: usize) -> Result<f64>

Returns a frame’s positive gain, defaulting to 1.0 when gains are absent.

Source

pub fn background_value(&self, frame: usize, pixel: usize) -> Result<f64>

Returns background intensity for a frame and row-major pixel index.

Returns zero when background is absent and handles broadcast backgrounds.

Source

pub fn validate(&self) -> Result<()>

Validates source/crop counts, shapes, pupil, sampling, vectors, interpolation bounds, gains, background, and optional multiplexing rows.

Trait Implementations§

Source§

impl Clone for ImagePlaneModel

Source§

fn clone(&self) -> ImagePlaneModel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImagePlaneModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ImagePlaneModel

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ImagePlaneModel

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Key for T
where T: Clone,

§

fn align() -> usize

The alignment necessary for the key. Must return a power of two.
§

fn size(&self) -> usize

The size of the key in bytes.
§

unsafe fn init(&self, ptr: *mut u8)

Initialize the key in the given memory location. Read more
§

unsafe fn get<'a>(ptr: *const u8) -> &'a T

Get a reference to the key from the given memory location. Read more
§

unsafe fn drop_in_place(ptr: *mut u8)

Drop the key in place. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,