Skip to main content

SyntheticWavelengthUnwrapper

Struct SyntheticWavelengthUnwrapper 

Source
pub struct SyntheticWavelengthUnwrapper {
    pub opd_range_m: (f64, f64),
    pub minimum_amplitude: f64,
    pub max_phase_residual_rad: Option<f64>,
}
Expand description

Combines registered complex fields into one nondispersive OPD map.

For transmission phase φ_i = wrap(2π d / λ_i), subtracting the phase of the longer wavelength from that of the shorter produces period Λ = λ_short λ_long / (λ_long - λ_short). The longest such period selects the coarse branch in an explicit half-open OPD interval. All remaining shorter difference periods and original wavelengths refine integer orders by rounding; a final equal-phase-weight least-squares fit uses every original channel. This is post-reconstruction phase mixing, not optical interference between colors or a joint intensity/OPD optimizer.

Inputs must have matching spatial registration, resolution, phase reference, and negligible OPD dispersion. No spatial continuity is required, so jumps exceeding an original wavelength can be recovered. Noise in a coarse OPD estimate must remain below half the next ladder period for correct rounding. This implementation uses an explicit interval instead of spatially unwrapping the longest synthetic phase and does not use phase-sum synthetic wavelengths.

§Example

use fpm_rs::{Complex64, reconstruction::{PhaseReference, SyntheticWavelengthUnwrapper}};
use ndarray::Array2;
let wavelengths = [500e-9, 550e-9];
let fields: Vec<_> = wavelengths.iter().map(|&wavelength| {
    Array2::from_elem((2, 3), Complex64::from_polar(1.0,
        std::f64::consts::TAU * 2.1e-6 / wavelength))
}).collect();
let views: Vec<_> = fields.iter().map(|field| field.view()).collect();
let result = SyntheticWavelengthUnwrapper::new((0.0, 4e-6))?
    .unwrap_fields(&views, &wavelengths, &PhaseReference::Offsets(vec![0.0; 2]), None)?;
assert!((result.opd_m[(0, 0)] - 2.1e-6).abs() < 1e-18);

§References

S. K. Mirsky and N. T. Shaked, “Six-pack holography for dynamic profiling of thick and extended objects by simultaneous three-wavelength phase unwrapping with doubled field of view”, Scientific Reports 13, article 19293 (2023), synthetic-wavelength and hierarchical phase-unwrapping sections. Here their phase-difference hierarchy is applied to already reconstructed FPM fields, without their holographic optics.

Fields§

§opd_range_m: (f64, f64)

Half-open allowed absolute OPD interval [minimum, maximum) in metres. Its width must not exceed the longest difference synthetic wavelength.

§minimum_amplitude: f64

All channel amplitudes must strictly exceed this finite nonnegative value.

§max_phase_residual_rad: Option<f64>

Optional maximum RMS phase residual in radians, in (0, π]. None retains all otherwise valid pixels and still reports residuals.

Implementations§

Source§

impl SyntheticWavelengthUnwrapper

Source

pub fn new(opd_range_m: (f64, f64)) -> Result<Self>

Creates a validated interval configuration with no residual cutoff and zero amplitude floor.

Source

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

Checks finite ordered bounds, amplitude floor, and optional residual tolerance.

Source

pub fn unwrap_fields( &self, fields: &[ArrayView2<'_, Complex64>], wavelengths_vacuum_m: &[f64], reference: &PhaseReference, mask: Option<ArrayView2<'_, u8>>, ) -> Result<OpticalPathDifferenceResult>

Recovers OPD from at least two finite C-contiguous fields on one nonempty grid.

reference explicitly supplies pistons or a constant-known-OPD reference mask. mask, when present, is a common-grid uint8 validity mask (zero excludes a pixel). Zero/below-floor amplitudes in any channel invalidate that pixel. Reference means use only pixels valid in every channel. Undefined reference means, numerically ill-conditioned beat periods, and malformed shapes/layout/values return errors; individual range/residual failures are represented in the returned mask. Wavelengths are vacuum wavelengths in metres in the same order as fields.

Trait Implementations§

Source§

impl Clone for SyntheticWavelengthUnwrapper

Source§

fn clone(&self) -> SyntheticWavelengthUnwrapper

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 SyntheticWavelengthUnwrapper

Source§

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

Formats the value using the given formatter. 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,

§

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