Struct FrameSequence

Source
pub struct FrameSequence<T> {
    pub state: FrameSequenceState,
    pub buffer_limit: Option<u32>,
    pub chunk_rows: usize,
    /* private fields */
}
Expand description

A sequence of frames, each of which is a 3D array of FrameValues

Fields§

§state: FrameSequenceState

The state of the frame sequence

§buffer_limit: Option<u32>§chunk_rows: usize

Number of rows per chunk (per thread)

Implementations§

Source§

impl<T: Clone + Default + FrameValue<Output = T> + Serialize> FrameSequence<T>

Source

pub fn get_frames_len(&self) -> usize

Get the number of frames queue’d up to be written

Source

pub fn get_frame_chunks_num(&self) -> usize

Get the number of chunks in a frame

Source

pub fn px_at_current( &self, y: usize, x: usize, c: usize, ) -> Result<&Option<T>, FrameSequenceError>

Get the reference for the pixel at the given coordinates

§Arguments
  • y - The y coordinate of the pixel
  • x - The x coordinate of the pixel
  • c - The channel of the pixel
§Returns
  • Option<&T> - The reference to the pixel value
§Errors
  • If the frame has not been initialized
Source

pub fn px_at_frame( &self, y: usize, x: usize, c: usize, frame_idx: usize, ) -> Result<&Option<T>, FrameSequenceError>

Get the reference for the pixel at the given coordinates and frame index

§Arguments
  • y - The y coordinate of the pixel
  • x - The x coordinate of the pixel
  • c - The channel of the pixel
  • frame_idx - The index of the frame to get the pixel from
§Returns
  • Option<&T> - The reference to the pixel value
§Errors
  • If the frame at the given index has not been initialized
Source

pub fn is_frame_filled( &self, frame_idx: usize, ) -> Result<bool, FrameSequenceError>

Get whether or not the frame at the given index is “filled” (i.e., all pixels have been written to)

§Arguments
  • frame_idx - The index of the frame to check
§Returns
  • bool - Whether or not the frame is filled
§Errors
  • If the frame at the given index has not been initialized
  • If the frame index is out of bounds
  • If the frame is not aligned with the chunk division
Source

pub fn is_frame_0_filled(&self) -> bool

Get whether or not the next frame is “filled” (i.e., all pixels have been written to)

Source

pub fn get_running_intensities(&self) -> &Array3<u8>

Get the instantaneous intensity for each pixel

Source

pub fn pop_features(&mut self) -> Option<FeatureInterval>

Get the features detected for the next frame, and pop that off the feature vec

Source

pub fn pop_next_frame(&mut self) -> Option<Vec<Array3<Option<T>>>>

Pop the next frame for all chunks

returns: the frame

Source

pub fn pop_next_frame_for_chunk( &mut self, chunk_num: usize, ) -> Option<Array3<Option<T>>>

Pop the next frame from the given chunk

§Arguments
  • chunk_num: the y-index of the chunk to pop the frame from

returns: the chunk of frame values

Source

pub fn write_frame_bytes( &mut self, writer: &mut BufWriter<File>, ) -> Result<(), Box<dyn Error>>

Write out the next frame to the given writer

§Arguments
  • writer - The writer to write the frame to
§Returns
  • Result<(), FrameSequenceError> - Whether or not the write was successful
§Errors
  • If the frame chunk has not been initialized
  • If the data cannot be written
Source

pub fn write_multi_frame_bytes( &mut self, writer: &mut BufWriter<File>, ) -> Result<i32, Box<dyn Error>>

Write out next frames to the given writer so long as the frame is filled

§Arguments
  • writer - The writer to write the frames to
§Returns
  • Result<(), FrameSequenceError> - Whether or not the write was successful
§Errors
  • If a frame could not be written

Trait Implementations§

Source§

impl<T: Clone + Default + FrameValue<Output = T> + Copy + Serialize + Send + Sync + Zero + Into<f64>> Framer for FrameSequence<T>

Source§

fn ingest_event(&mut self, event: &mut Event, last_event: Option<Event>) -> bool

§Examples

let mut frame_sequence: FrameSequence<u8> =
FramerBuilder::new(
            PlaneSize::new(10,10,3).unwrap(), 64)
            .codec_version(1, TimeMode::DeltaT)
            .time_parameters(50000, 1000, 1000, Some(50.0))
            .mode(INSTANTANEOUS)
            .source(U8, FramedU8)
            .finish();
let mut event: Event = Event {
        coord: Coord {
            x: 5,
            y: 5,
            c: Some(1)
        },
        d: 5,
        t: 1000
    };
frame_sequence.ingest_event(&mut event, None);
let elem = frame_sequence.px_at_current(5, 5, 1).unwrap();
assert_eq!(*elem, Some(32));
Source§

fn flush_frame_buffer(&mut self) -> bool

For all frames left that we haven’t written out yet, for any None pixels, set them to the last recorded intensity for that pixel.

Returns true if there are frames now ready to write out

Source§

type Output = T

The type of the output frame.
Source§

fn new(builder: FramerBuilder) -> Self

Create a new Framer with the given FramerBuilder.
Source§

fn detect_features(&mut self, detect_features: bool)

Source§

fn ingest_events_events(&mut self, events: Vec<Vec<Event>>) -> bool

Ingest a vector of a vector of ADΔER events.

Auto Trait Implementations§

§

impl<T> Freeze for FrameSequence<T>

§

impl<T> RefUnwindSafe for FrameSequence<T>
where T: RefUnwindSafe,

§

impl<T> Send for FrameSequence<T>
where T: Send,

§

impl<T> Sync for FrameSequence<T>
where T: Sync,

§

impl<T> Unpin for FrameSequence<T>

§

impl<T> UnwindSafe for FrameSequence<T>
where T: RefUnwindSafe,

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

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> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ErasedDestructor for T
where T: 'static,