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 FrameValue
s
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>
impl<T: Clone + Default + FrameValue<Output = T> + Serialize> FrameSequence<T>
Sourcepub fn get_frames_len(&self) -> usize
pub fn get_frames_len(&self) -> usize
Get the number of frames queue’d up to be written
Sourcepub fn get_frame_chunks_num(&self) -> usize
pub fn get_frame_chunks_num(&self) -> usize
Get the number of chunks in a frame
Sourcepub fn px_at_current(
&self,
y: usize,
x: usize,
c: usize,
) -> Result<&Option<T>, FrameSequenceError>
pub fn px_at_current( &self, y: usize, x: usize, c: usize, ) -> Result<&Option<T>, FrameSequenceError>
Sourcepub fn px_at_frame(
&self,
y: usize,
x: usize,
c: usize,
frame_idx: usize,
) -> Result<&Option<T>, FrameSequenceError>
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 pixelx
- The x coordinate of the pixelc
- The channel of the pixelframe_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
Sourcepub fn is_frame_filled(
&self,
frame_idx: usize,
) -> Result<bool, FrameSequenceError>
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
Sourcepub fn is_frame_0_filled(&self) -> bool
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)
Sourcepub fn get_running_intensities(&self) -> &Array3<u8>
pub fn get_running_intensities(&self) -> &Array3<u8>
Get the instantaneous intensity for each pixel
Sourcepub fn pop_features(&mut self) -> Option<FeatureInterval>
pub fn pop_features(&mut self) -> Option<FeatureInterval>
Get the features detected for the next frame, and pop that off the feature vec
Sourcepub fn pop_next_frame(&mut self) -> Option<Vec<Array3<Option<T>>>>
pub fn pop_next_frame(&mut self) -> Option<Vec<Array3<Option<T>>>>
Pop the next frame for all chunks
returns: the frame
Sourcepub fn pop_next_frame_for_chunk(
&mut self,
chunk_num: usize,
) -> Option<Array3<Option<T>>>
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
Sourcepub fn write_frame_bytes(
&mut self,
writer: &mut BufWriter<File>,
) -> Result<(), Box<dyn Error>>
pub fn write_frame_bytes( &mut self, writer: &mut BufWriter<File>, ) -> Result<(), Box<dyn Error>>
Trait Implementations§
Source§impl<T: Clone + Default + FrameValue<Output = T> + Copy + Serialize + Send + Sync + Zero + Into<f64>> Framer for FrameSequence<T>
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
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
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§fn new(builder: FramerBuilder) -> Self
fn new(builder: FramerBuilder) -> Self
Framer
with the given FramerBuilder
.fn detect_features(&mut self, detect_features: bool)
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> 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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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