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
impl MeasurementStack
Sourcepub fn from_vec(
data: Vec<f64>,
image_shape: (usize, usize),
frame_metadata: Vec<FrameMetadata>,
) -> Result<Self>
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.
Sourcepub fn new(
data: Array3<f64>,
frame_metadata: Vec<FrameMetadata>,
) -> Result<Self>
pub fn new( data: Array3<f64>, frame_metadata: Vec<FrameMetadata>, ) -> Result<Self>
Stores an owned standard-layout (frame,row,column) array without a copy.
Sourcepub fn from_frames(
frames: &[Vec<f64>],
image_shape: (usize, usize),
) -> Result<Self>
pub fn from_frames( frames: &[Vec<f64>], image_shape: (usize, usize), ) -> Result<Self>
Copies equally shaped row-major intensity frames into one resident stack.
Sourcepub fn from_image_files<P: AsRef<Path>>(
paths: &[P],
frame_metadata: Vec<FrameMetadata>,
) -> Result<Self>
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.
Sourcepub fn from_tiff_stack(
path: impl AsRef<Path>,
frame_metadata: Vec<FrameMetadata>,
) -> Result<Self>
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.
Sourcepub fn from_manifest(path: impl AsRef<Path>) -> Result<Self>
pub fn from_manifest(path: impl AsRef<Path>) -> Result<Self>
Loads a JSON MeasurementSpec and all referenced images.
Sourcepub fn from_manifest_definition(
manifest: MeasurementSpec,
base_directory: impl AsRef<Path>,
) -> Result<Self>
pub fn from_manifest_definition( manifest: MeasurementSpec, base_directory: impl AsRef<Path>, ) -> Result<Self>
Loads a manifest value, resolving relative paths beneath base_directory.
Sourcepub fn data(&self) -> ArrayView3<'_, f64>
pub fn data(&self) -> ArrayView3<'_, f64>
Borrows intensity data as (frame, row, column) without allocating or copying.
Sourcepub fn frame_view(&self, index: usize) -> Result<ArrayView2<'_, f64>>
pub fn frame_view(&self, index: usize) -> Result<ArrayView2<'_, f64>>
Borrows one (row, column) intensity frame without copying.
Sourcepub fn frame_view_mut(&mut self, index: usize) -> Result<ArrayViewMut2<'_, f64>>
pub fn frame_view_mut(&mut self, index: usize) -> Result<ArrayViewMut2<'_, f64>>
Mutably borrows one (row, column) intensity frame without copying.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Returns the acquisition-frame count.
Sourcepub fn image_shape(&self) -> (usize, usize)
pub fn image_shape(&self) -> (usize, usize)
Returns low-resolution frame shape as (height, width).
Sourcepub fn as_slice(&self) -> &[f64]
pub fn as_slice(&self) -> &[f64]
Borrows the complete standard-layout (frame, row, column) stack as a flat slice.
Sourcepub fn frame_metadata(&self) -> &[FrameMetadata]
pub fn frame_metadata(&self) -> &[FrameMetadata]
Borrows metadata in acquisition-frame order.
Sourcepub fn set_frame_weight(&mut self, index: usize, weight: f64) -> Result<()>
pub fn set_frame_weight(&mut self, index: usize, weight: f64) -> Result<()>
Sets a frame’s reconstruction weight after validating it.
Sourcepub fn preprocessing(&self) -> &PreprocessingConfig
pub fn preprocessing(&self) -> &PreprocessingConfig
Borrows the correction flags associated with this stack.
Sourcepub fn validate(&self) -> Result<()>
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.
Sourcepub fn frame(&self, index: usize) -> Result<&[f64]>
pub fn frame(&self, index: usize) -> Result<&[f64]>
Borrows one row-major intensity frame by acquisition index.
Sourcepub fn frame_mut(&mut self, index: usize) -> Result<&mut [f64]>
pub fn frame_mut(&mut self, index: usize) -> Result<&mut [f64]>
Mutably borrows one row-major intensity frame by acquisition index.
Sourcepub fn frame_weight(&self, index: usize) -> Result<f64>
pub fn frame_weight(&self, index: usize) -> Result<f64>
Returns a frame’s non-negative reconstruction weight.
Sourcepub fn frame_mask(&self, index: usize) -> Result<Option<&[u8]>>
pub fn frame_mask(&self, index: usize) -> Result<Option<&[u8]>>
Borrows a frame’s row-major binary validity mask, including a broadcast mask.
Sourcepub fn with_dark_frame(self, dark: Array2<f64>) -> Result<Self>
pub fn with_dark_frame(self, dark: Array2<f64>) -> Result<Self>
Stores a finite same-shaped detector dark image and enables dark subtraction.
Sourcepub fn with_flat_field(self, flat: Array2<f64>) -> Result<Self>
pub fn with_flat_field(self, flat: Array2<f64>) -> Result<Self>
Stores a positive finite same-shaped flat field and enables division by it.
Sourcepub fn with_background(self, background: Array2<f64>) -> Result<Self>
pub fn with_background(self, background: Array2<f64>) -> Result<Self>
Stores one finite background image broadcast to every frame and enables subtraction.
Sourcepub fn with_per_frame_background(self, background: Array3<f64>) -> Result<Self>
pub fn with_per_frame_background(self, background: Array3<f64>) -> Result<Self>
Stores a finite (frame, row, column) background stack and enables subtraction.
Sourcepub fn with_masks(self, masks: Array2<u8>) -> Result<Self>
pub fn with_masks(self, masks: Array2<u8>) -> Result<Self>
Stores one same-shaped binary mask broadcast to every frame.
Sourcepub fn with_per_frame_masks(self, masks: Array3<u8>) -> Result<Self>
pub fn with_per_frame_masks(self, masks: Array3<u8>) -> Result<Self>
Stores binary validity masks shaped (frame, row, column).
Sourcepub fn normalize_exposure(self) -> Self
pub fn normalize_exposure(self) -> Self
Enables division by each frame’s positive exposure time during preprocessing.
Sourcepub fn clamp_negative(self) -> Self
pub fn clamp_negative(self) -> Self
Enables clamping corrected negative intensities to zero.
Sourcepub fn with_preprocessing(
self,
preprocessing: PreprocessingConfig,
) -> Result<Self>
pub fn with_preprocessing( self, preprocessing: PreprocessingConfig, ) -> Result<Self>
Replaces correction flags, requiring every enabled correction array to be present.
Sourcepub fn apply_preprocessing(self) -> Result<Self>
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
impl Clone for MeasurementStack
Source§fn clone(&self) -> MeasurementStack
fn clone(&self) -> MeasurementStack
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 MeasurementStack
impl Debug for MeasurementStack
Source§impl<'de> Deserialize<'de> for MeasurementStack
impl<'de> Deserialize<'de> for MeasurementStack
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl MeasurementRead for MeasurementStack
impl MeasurementRead for MeasurementStack
Source§fn frame_count(&self) -> usize
fn frame_count(&self) -> usize
Source§fn image_shape(&self) -> (usize, usize)
fn image_shape(&self) -> (usize, usize)
(height, width).Source§fn frame_len(&self) -> usize
fn frame_len(&self) -> usize
height * width, the row-major element count of one frame.Source§fn frame(&self, index: usize) -> Result<impl Deref<Target = [f64]> + '_>
fn frame(&self, index: usize) -> Result<impl Deref<Target = [f64]> + '_>
Source§fn frame_weight(&self, index: usize) -> Result<f64>
fn frame_weight(&self, index: usize) -> Result<f64>
Source§fn frame_mask(&self, index: usize) -> Result<Option<&[u8]>>
fn frame_mask(&self, index: usize) -> Result<Option<&[u8]>>
Source§fn frame_metadata(&self) -> &[FrameMetadata]
fn frame_metadata(&self) -> &[FrameMetadata]
Auto Trait Implementations§
impl Freeze for MeasurementStack
impl RefUnwindSafe for MeasurementStack
impl Send for MeasurementStack
impl Sync for MeasurementStack
impl Unpin for MeasurementStack
impl UnsafeUnpin for MeasurementStack
impl UnwindSafe for MeasurementStack
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