pub struct FrameSequence<T> {
    pub state: FrameSequenceState,
    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

§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

§

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 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> 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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 Twhere 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.

§

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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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