Skip to main content

SyntheticObject

Struct SyntheticObject 

Source
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

Source

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.

Source

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.

Source

pub fn amplitude_only(amplitude: Array2<f64>) -> Result<Self>

Creates a zero-phase object from owned finite non-negative amplitude transmission.

Source

pub fn phase_only(phase: Array2<f64>) -> Result<Self>

Creates a unit-amplitude object from owned finite phase values in radians.

Source

pub fn from_amplitude_image(path: impl AsRef<Path>) -> Result<Self>

Loads a grayscale image normalized to [0, 1] as amplitude transmission.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn resolution_target(shape: (usize, usize)) -> Result<Self>

Creates deterministic horizontal and vertical binary-amplitude bar groups.

Source

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.

Source

pub fn particle_field( shape: (usize, usize), particles: usize, seed: u64, ) -> Result<Self>

Creates a unit-amplitude field with seeded dark single-pixel particles.

Source

pub fn mixed_test_pattern(shape: (usize, usize)) -> Result<Self>

A deterministic mixed amplitude/phase target useful for smoke tests.

Source

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.

Source

pub fn shape(&self) -> (usize, usize)

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

Source

pub fn field(&self) -> ArrayView2<'_, Complex64>

Borrows the (row, column) complex field without copying.

Source

pub fn field_mut(&mut self) -> ArrayViewMut2<'_, Complex64>

Mutably borrows field elements without permitting shape changes.

Source

pub fn label(&self) -> Option<&str>

Borrows the optional human-readable object label.

Source

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

Source§

fn clone(&self) -> SyntheticObject

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 SyntheticObject

Source§

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

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

impl TryFrom<ArrayBase<OwnedRepr<Complex<f64>>, Dim<[usize; 2]>>> for SyntheticObject

Source§

type Error = Error

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

fn try_from(field: Array2<Complex64>) -> Result<Self>

Performs the conversion.

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,