Skip to main content

MeasurementStack

Struct MeasurementStack 

Source
pub struct MeasurementStack {
    pub frame_metadata: Vec<FrameMetadata>,
    pub dark_frame: Option<Vec<f64>>,
    pub flat_field: Option<Vec<f64>>,
    pub background: Option<Vec<f64>>,
    pub masks: Option<Vec<u8>>,
    pub preprocessing: PreprocessingConfig,
    /* private fields */
}
Expand description

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

Fields§

§frame_metadata: Vec<FrameMetadata>§dark_frame: Option<Vec<f64>>§flat_field: Option<Vec<f64>>§background: Option<Vec<f64>>§masks: Option<Vec<u8>>§preprocessing: PreprocessingConfig

Implementations§

Source§

impl MeasurementStack

Source

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

Source

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

Source

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

Loads an in-memory stack from single-channel PNG or TIFF images while preserving native 8-bit or 16-bit detector counts.

Source

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

Loads every page of a grayscale 8-bit or 16-bit TIFF as one frame.

Source

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

Loads a JSON manifest. Relative image paths are resolved against the manifest’s parent directory. Declared preprocessing is configured but is not applied until Self::apply_preprocessing is called.

Source

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

Source

pub fn frame_count(&self) -> usize

Source

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

Source

pub fn frame_len(&self) -> usize

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Returns the mask for a frame. Zero-valued mask entries are excluded. A single-frame mask is broadcast to every measurement frame.

Source

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

Source

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

Source

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

Source

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

Source

pub fn normalize_exposure(self) -> Self

Source

pub fn clamp_negative(self) -> Self

Source

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

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

Source§

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

Source§

fn frame_len(&self) -> usize

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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> 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> 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,