Skip to main content

SemanticScene

Struct SemanticScene 

Source
pub struct SemanticScene<ObjectCategory, RegionCategory> { /* private fields */ }
Expand description

Scene containing semantically annotated levels, regions, and objects.

A scene owns its levels, levels own their regions, and regions own their objects. Category payloads are dataset-specific generic types.

Implementations§

Source§

impl<ObjectCategory, RegionCategory> SemanticScene<ObjectCategory, RegionCategory>

Source

pub fn from_parts( name: impl Into<String>, label: impl Into<String>, counts: HashMap<&'static str, usize>, aabb: Option<Aabb>, levels: Vec<SemanticLevel<ObjectCategory, RegionCategory>>, ) -> Self

Creates a scene from its nested model parts.

The levels vector owns the full nested scene graph: levels contain regions, and regions contain objects. counts stores descriptor header counts by their dataset-specific names.

Source

pub fn name(&self) -> &str

Returns the scene name from the descriptor header.

Source

pub fn label(&self) -> &str

Returns the scene label from the descriptor header.

Source

pub const fn aabb(&self) -> Option<&Aabb>

Returns the scene axis-aligned bounding box.

This is optional because a malformed or partially built scene may not have a parsed header.

Source

pub fn levels(&self) -> &[SemanticLevel<ObjectCategory, RegionCategory>]

Returns all levels in the scene.

Source

pub fn regions( &self, ) -> impl Iterator<Item = &SemanticRegion<ObjectCategory, RegionCategory>>

Returns all regions in the scene.

Source

pub fn objects(&self) -> impl Iterator<Item = &SemanticObject<ObjectCategory>>

Returns all semantic objects in the scene.

Source§

impl SemanticScene<(), ()>

Source

pub fn load<D: Dataset>( path: impl AsRef<Path>, options: D::Options, ) -> Result<SemanticScene<D::ObjectCategory, D::RegionCategory>, D::Error>
where D::Error: From<Error>,

Loads a scene from a path using a dataset implementation.

§Errors

Returns I/O errors from opening the file or dataset-specific parse and validation failures.

Source

pub fn from_reader<D: Dataset, R: BufRead>( reader: R, options: D::Options, ) -> Result<SemanticScene<D::ObjectCategory, D::RegionCategory>, D::Error>

Loads a scene from any buffered reader using a dataset implementation.

§Errors

Returns dataset-specific I/O, parse, and validation failures.

Source

pub fn from_str<D: Dataset>( input: &str, options: D::Options, ) -> Result<SemanticScene<D::ObjectCategory, D::RegionCategory>, D::Error>

Loads a scene from an in-memory string using a dataset implementation.

§Errors

Returns dataset-specific parse and validation failures.

Trait Implementations§

Source§

impl<ObjectCategory: Clone, RegionCategory: Clone> Clone for SemanticScene<ObjectCategory, RegionCategory>

Source§

fn clone(&self) -> SemanticScene<ObjectCategory, RegionCategory>

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<ObjectCategory: Debug, RegionCategory: Debug> Debug for SemanticScene<ObjectCategory, RegionCategory>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<ObjectCategory, RegionCategory> Default for SemanticScene<ObjectCategory, RegionCategory>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<ObjectCategory, RegionCategory> Display for SemanticScene<ObjectCategory, RegionCategory>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<ObjectCategory, RegionCategory> Freeze for SemanticScene<ObjectCategory, RegionCategory>

§

impl<ObjectCategory, RegionCategory> RefUnwindSafe for SemanticScene<ObjectCategory, RegionCategory>
where RegionCategory: RefUnwindSafe, ObjectCategory: RefUnwindSafe,

§

impl<ObjectCategory, RegionCategory> Send for SemanticScene<ObjectCategory, RegionCategory>
where RegionCategory: Send, ObjectCategory: Send,

§

impl<ObjectCategory, RegionCategory> Sync for SemanticScene<ObjectCategory, RegionCategory>
where RegionCategory: Sync, ObjectCategory: Sync,

§

impl<ObjectCategory, RegionCategory> Unpin for SemanticScene<ObjectCategory, RegionCategory>
where RegionCategory: Unpin, ObjectCategory: Unpin,

§

impl<ObjectCategory, RegionCategory> UnsafeUnpin for SemanticScene<ObjectCategory, RegionCategory>

§

impl<ObjectCategory, RegionCategory> UnwindSafe for SemanticScene<ObjectCategory, RegionCategory>
where RegionCategory: UnwindSafe, ObjectCategory: UnwindSafe,

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.