pub struct SyntheticObject { /* private fields */ }Expand description
Owned high-resolution complex sample field used as simulation ground truth.
The array is shaped (height, width), indexed (row, column), and stored in
standard row-major order. Magnitude is amplitude transmission and argument is phase
delay in radians.
§Example
use fpm_rs::simulation::SyntheticObject;
let object = SyntheticObject::phase_disk((32, 48), 6.0, 0.4)?
.with_label("phase target");
assert_eq!(object.shape(), (32, 48));
assert_eq!(object.label(), Some("phase target"));
assert_eq!(object.field().dim(), object.shape());Implementations§
Source§impl SyntheticObject
impl SyntheticObject
Sourcepub fn new(field: Array2<Complex64>) -> Result<Self>
pub fn new(field: Array2<Complex64>) -> Result<Self>
Stores a finite complex field without copying its elements.
The field must be non-empty and C-contiguous standard row-major layout.
Sourcepub fn from_amplitude_phase(
amplitude: ArrayView2<'_, f64>,
phase: ArrayView2<'_, f64>,
) -> Result<Self>
pub fn from_amplitude_phase( amplitude: ArrayView2<'_, f64>, phase: ArrayView2<'_, f64>, ) -> Result<Self>
Allocates a complex field from matching borrowed amplitude and phase arrays.
Amplitude must be finite and non-negative; phase is in radians and must be finite.
Sourcepub fn amplitude_only(amplitude: Array2<f64>) -> Result<Self>
pub fn amplitude_only(amplitude: Array2<f64>) -> Result<Self>
Creates a zero-phase object from owned finite non-negative amplitude transmission.
Sourcepub fn phase_only(phase: Array2<f64>) -> Result<Self>
pub fn phase_only(phase: Array2<f64>) -> Result<Self>
Creates a unit-amplitude object from owned finite phase values in radians.
Sourcepub fn from_amplitude_image(path: impl AsRef<Path>) -> Result<Self>
pub fn from_amplitude_image(path: impl AsRef<Path>) -> Result<Self>
Loads a grayscale image normalized to [0, 1] as amplitude transmission.
Sourcepub fn from_amplitude_phase_images(
amplitude_path: impl AsRef<Path>,
phase_path: impl AsRef<Path>,
phase_extent: f64,
) -> Result<Self>
pub fn from_amplitude_phase_images( amplitude_path: impl AsRef<Path>, phase_path: impl AsRef<Path>, phase_extent: f64, ) -> Result<Self>
Loads normalized grayscale amplitude and phase images. Phase values map
linearly from black/white to -phase_extent/+phase_extent radians.
Sourcepub fn constant(
shape: (usize, usize),
amplitude: f64,
phase: f64,
) -> Result<Self>
pub fn constant( shape: (usize, usize), amplitude: f64, phase: f64, ) -> Result<Self>
Creates a constant (height, width) field from non-negative amplitude and radian phase.
Sourcepub fn phase_disk(
shape: (usize, usize),
radius_pixels: f64,
phase_shift: f64,
) -> Result<Self>
pub fn phase_disk( shape: (usize, usize), radius_pixels: f64, phase_shift: f64, ) -> Result<Self>
Creates a unit-amplitude centered disk with phase phase_shift radians.
Radius is measured from pixel centers in pixels; pixels outside the disk have zero phase.
Sourcepub fn siemens_star(shape: (usize, usize), spokes: usize) -> Result<Self>
pub fn siemens_star(shape: (usize, usize), spokes: usize) -> Result<Self>
Creates a centered binary-amplitude Siemens-star test target with at least two spokes.
Sourcepub fn resolution_target(shape: (usize, usize)) -> Result<Self>
pub fn resolution_target(shape: (usize, usize)) -> Result<Self>
Creates deterministic horizontal and vertical binary-amplitude bar groups.
Sourcepub fn random_phase(
shape: (usize, usize),
standard_deviation: f64,
seed: u64,
) -> Result<Self>
pub fn random_phase( shape: (usize, usize), standard_deviation: f64, seed: u64, ) -> Result<Self>
Creates unit amplitude with independent zero-mean Gaussian phase in radians.
Sourcepub fn particle_field(
shape: (usize, usize),
particles: usize,
seed: u64,
) -> Result<Self>
pub fn particle_field( shape: (usize, usize), particles: usize, seed: u64, ) -> Result<Self>
Creates a unit-amplitude field with seeded dark single-pixel particles.
Sourcepub fn mixed_test_pattern(shape: (usize, usize)) -> Result<Self>
pub fn mixed_test_pattern(shape: (usize, usize)) -> Result<Self>
A deterministic mixed amplitude/phase target useful for smoke tests.
Sourcepub fn biological_like(
shape: (usize, usize),
features: usize,
seed: u64,
) -> Result<Self>
pub fn biological_like( shape: (usize, usize), features: usize, seed: u64, ) -> Result<Self>
Smooth random phase and absorption blobs approximating a weak biological specimen. This is a test object, not a tissue-specific physical model.
Sourcepub fn shape(&self) -> (usize, usize)
pub fn shape(&self) -> (usize, usize)
Returns the high-resolution object shape as (height, width).
Sourcepub fn field(&self) -> ArrayView2<'_, Complex64>
pub fn field(&self) -> ArrayView2<'_, Complex64>
Borrows the (row, column) complex field without copying.
Sourcepub fn field_mut(&mut self) -> ArrayViewMut2<'_, Complex64>
pub fn field_mut(&mut self) -> ArrayViewMut2<'_, Complex64>
Mutably borrows field elements without permitting shape changes.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Assigns a human-readable label without changing field values.
Trait Implementations§
Source§impl Clone for SyntheticObject
impl Clone for SyntheticObject
Source§fn clone(&self) -> SyntheticObject
fn clone(&self) -> SyntheticObject
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyntheticObject
impl Debug for SyntheticObject
Auto Trait Implementations§
impl Freeze for SyntheticObject
impl RefUnwindSafe for SyntheticObject
impl Send for SyntheticObject
impl Sync for SyntheticObject
impl Unpin for SyntheticObject
impl UnsafeUnpin for SyntheticObject
impl UnwindSafe for SyntheticObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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