pub struct Mask {
pub width: u32,
pub height: u32,
pub data: Vec<u16>,
}Expand description
A per-pixel label plane — std/vision/v1/Mask, row-major.
Fields§
§width: u32The plane’s width in pixels.
height: u32The plane’s height in pixels.
data: Vec<u16>width * height labels, row-major.
Implementations§
Source§impl Mask
impl Mask
Sourcepub fn new(width: u32, height: u32, data: Vec<u16>) -> Result<Self>
pub fn new(width: u32, height: u32, data: Vec<u16>) -> Result<Self>
A mask whose data length matches its dimensions.
§Errors
DataError::ChildLengthMismatch when data.len() != width * height.
Sourcepub fn label_at(&self, x: u32, y: u32) -> Option<u16>
pub fn label_at(&self, x: u32, y: u32) -> Option<u16>
The label at (x, y), or None outside the plane.
Sourcepub fn check_dimensions(&self) -> Result<()>
pub fn check_dimensions(&self) -> Result<()>
Checks that the data length matches the declared dimensions.
§Errors
Trait Implementations§
Source§impl AstrsMessage for Mask
impl AstrsMessage for Mask
Source§const URN: &'static str = "std/vision/v1/Mask"
const URN: &'static str = "std/vision/v1/Mask"
The type URN this message’s columnar layout is declared against
(blueprint §24.3), e.g.
"std/vision/v1/Detections".Source§fn data_type() -> DataType
fn data_type() -> DataType
The columnar layout
AstrsMessage::to_record_batch produces and
AstrsMessage::from_record_batch expects.Source§fn to_record_batch(&self) -> Result<RecordBatch>
fn to_record_batch(&self) -> Result<RecordBatch>
Encodes one message into a one-row
RecordBatch (blueprint §6.1’s
“one record batch per message”). Read moreSource§fn from_record_batch(batch: &RecordBatch) -> Result<Self>
fn from_record_batch(batch: &RecordBatch) -> Result<Self>
Decodes one message from a one-row
RecordBatch. Read moreSource§fn schema() -> Schema
fn schema() -> Schema
The single-column
Schema wrapping AstrsMessage::data_type
under crate::DATA_COLUMN (blueprint §6.1).Source§fn type_urn() -> Result<TypeUrn, TypeUrnError>
fn type_urn() -> Result<TypeUrn, TypeUrnError>
Parses
AstrsMessage::URN. Read moreimpl Eq for Mask
Source§impl FromPayload for Mask
impl FromPayload for Mask
Source§fn from_batch(batch: &RecordBatch) -> Result<Self>
fn from_batch(batch: &RecordBatch) -> Result<Self>
Reads the value from a decoded payload batch. Read more
impl StructuralPartialEq for Mask
Auto Trait Implementations§
impl Freeze for Mask
impl RefUnwindSafe for Mask
impl Send for Mask
impl Sync for Mask
impl Unpin for Mask
impl UnsafeUnpin for Mask
impl UnwindSafe for Mask
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more