Skip to main content

MeasurementStack

Struct MeasurementStack 

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

An in-memory stack of image-plane intensity measurements.

Data are owned as a C-contiguous ndarray with dimension order (frame, row, column). Public ndarray views borrow this allocation without copying. The super::MeasurementRead boundary continues to expose flat frame slices for reconstruction and lazy-stack parity.

Implementations§

Source§

impl MeasurementStack

Source

pub fn from_vec( data: Vec<f64>, image_shape: (usize, usize), frame_metadata: Vec<FrameMetadata>, ) -> Result<Self>

Stores an owned row-major (frame, row, column) buffer with image shape (height, width), deriving default metadata when frame_metadata is empty.

Source

pub fn new( data: Array3<f64>, frame_metadata: Vec<FrameMetadata>, ) -> Result<Self>

Stores an owned standard-layout (frame,row,column) array without a copy.

Source

pub fn from_frames( frames: &[Vec<f64>], image_shape: (usize, usize), ) -> Result<Self>

Copies equally shaped row-major intensity frames into one resident stack.

Source

pub fn from_image_files<P: AsRef<Path>>( paths: &[P], frame_metadata: Vec<FrameMetadata>, ) -> Result<Self>

Loads grayscale image files in acquisition order, converting native pixel values to f64.

Source

pub fn from_tiff_stack( path: impl AsRef<Path>, frame_metadata: Vec<FrameMetadata>, ) -> Result<Self>

Loads every page of a same-shaped grayscale TIFF as one acquisition frame.

Source

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

Loads a JSON MeasurementSpec and all referenced images.

Source

pub fn from_manifest_definition( manifest: MeasurementSpec, base_directory: impl AsRef<Path>, ) -> Result<Self>

Loads a manifest value, resolving relative paths beneath base_directory.

Source

pub fn data(&self) -> ArrayView3<'_, f64>

Borrows intensity data as (frame, row, column) without allocating or copying.

Source

pub fn frame_view(&self, index: usize) -> Result<ArrayView2<'_, f64>>

Borrows one (row, column) intensity frame without copying.

Source

pub fn frame_view_mut(&mut self, index: usize) -> Result<ArrayViewMut2<'_, f64>>

Mutably borrows one (row, column) intensity frame without copying.

Source

pub fn frame_count(&self) -> usize

Returns the acquisition-frame count.

Source

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

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

Source

pub fn frame_len(&self) -> usize

Returns the row-major element count of one frame.

Source

pub fn as_slice(&self) -> &[f64]

Borrows the complete standard-layout (frame, row, column) stack as a flat slice.

Source

pub fn frame_metadata(&self) -> &[FrameMetadata]

Borrows metadata in acquisition-frame order.

Source

pub fn set_frame_weight(&mut self, index: usize, weight: f64) -> Result<()>

Sets a frame’s reconstruction weight after validating it.

Source

pub fn preprocessing(&self) -> &PreprocessingConfig

Borrows the correction flags associated with this stack.

Source

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

Checks non-empty consistent shapes and counts, standard layout, finite intensities, metadata indices/exposures/weights, correction arrays, and binary masks.

Source

pub fn frame(&self, index: usize) -> Result<&[f64]>

Borrows one row-major intensity frame by acquisition index.

Source

pub fn frame_mut(&mut self, index: usize) -> Result<&mut [f64]>

Mutably borrows one row-major intensity frame by acquisition index.

Source

pub fn frame_weight(&self, index: usize) -> Result<f64>

Returns a frame’s non-negative reconstruction weight.

Source

pub fn frame_mask(&self, index: usize) -> Result<Option<&[u8]>>

Borrows a frame’s row-major binary validity mask, including a broadcast mask.

Source

pub fn with_dark_frame(self, dark: Array2<f64>) -> Result<Self>

Stores a finite same-shaped detector dark image and enables dark subtraction.

Source

pub fn with_flat_field(self, flat: Array2<f64>) -> Result<Self>

Stores a positive finite same-shaped flat field and enables division by it.

Source

pub fn with_background(self, background: Array2<f64>) -> Result<Self>

Stores one finite background image broadcast to every frame and enables subtraction.

Source

pub fn with_per_frame_background(self, background: Array3<f64>) -> Result<Self>

Stores a finite (frame, row, column) background stack and enables subtraction.

Source

pub fn with_masks(self, masks: Array2<u8>) -> Result<Self>

Stores one same-shaped binary mask broadcast to every frame.

Source

pub fn with_per_frame_masks(self, masks: Array3<u8>) -> Result<Self>

Stores binary validity masks shaped (frame, row, column).

Source

pub fn normalize_exposure(self) -> Self

Enables division by each frame’s positive exposure time during preprocessing.

Source

pub fn clamp_negative(self) -> Self

Enables clamping corrected negative intensities to zero.

Source

pub fn with_preprocessing( self, preprocessing: PreprocessingConfig, ) -> Result<Self>

Replaces correction flags, requiring every enabled correction array to be present.

Source

pub fn apply_preprocessing(self) -> Result<Self>

Applies configured corrections in place and returns the owned stack.

Order is dark subtraction, flat-field division, exposure normalization, background subtraction, then optional non-negative clamping.

Trait Implementations§

Source§

impl Clone for MeasurementStack

Source§

fn clone(&self) -> MeasurementStack

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 MeasurementStack

Source§

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

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

impl<'de> Deserialize<'de> for MeasurementStack

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 MeasurementRead for MeasurementStack

Source§

fn frame_count(&self) -> usize

Returns the number of acquisition frames.
Source§

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

Returns low-resolution image shape as (height, width).
Source§

fn frame_len(&self) -> usize

Returns height * width, the row-major element count of one frame.
Source§

fn frame(&self, index: usize) -> Result<impl Deref<Target = [f64]> + '_>

Borrows or shares a row-major intensity frame by zero-based acquisition index.
Source§

fn frame_weight(&self, index: usize) -> Result<f64>

Returns a frame’s non-negative reconstruction weight.
Source§

fn frame_mask(&self, index: usize) -> Result<Option<&[u8]>>

Borrows an optional row-major binary validity mask for one frame.
Source§

fn frame_metadata(&self) -> &[FrameMetadata]

Borrows metadata in acquisition-frame order.
Source§

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

Checks shapes, counts, finite intensities, metadata, weights, and masks.
Source§

impl Serialize for MeasurementStack

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,