Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::AnnotationContext Struct Reference

Archetype: The annotation context provides additional information on how to display entities. More...

#include <rerun/archetypes/annotation_context.hpp>

Public Types

using IndicatorComponent = rerun::components::IndicatorComponent< IndicatorComponentName >
 Indicator component, used to identify the archetype when converting to a list of components.
 

Public Member Functions

 AnnotationContext (AnnotationContext &&other)=default
 
 AnnotationContext (const AnnotationContext &other)=default
 
AnnotationContextoperator= (const AnnotationContext &other)=default
 
AnnotationContextoperator= (AnnotationContext &&other)=default
 
 AnnotationContext (rerun::components::AnnotationContext _context)
 
AnnotationContext with_context (const rerun::components::AnnotationContext &_context) &&
 List of class descriptions, mapping class indices to class names, colors etc.
 
AnnotationContext with_many_context (const Collection< rerun::components::AnnotationContext > &_context) &&
 This method makes it possible to pack multiple context in a single component batch.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static AnnotationContext update_fields ()
 Update only some specific fields of a AnnotationContext.
 
static AnnotationContext clear_fields ()
 Clear all the fields of a AnnotationContext.
 

Public Attributes

std::optional< ComponentBatchcontext
 List of class descriptions, mapping class indices to class names, colors etc.
 

Static Public Attributes

static constexpr const char IndicatorComponentName []
 
static constexpr const char ArchetypeName [] = "rerun.archetypes.AnnotationContext"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_context
 ComponentDescriptor for the context field.
 

Detailed Description

Archetype: The annotation context provides additional information on how to display entities.

Entities can use components::ClassIds and components::KeypointIds to provide annotations, and the labels and colors will be looked up in the appropriate annotation context. We use the first annotation context we find in the path-hierarchy when searching up through the ancestors of a given entity path.

See also datatypes::ClassDescription.

Example

Segmentation

image

#include <rerun.hpp>
#include <algorithm> // fill_n
#include <vector>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_annotation_context_segmentation");
rec.spawn().exit_on_failure();
// create an annotation context to describe the classes
rec.log_static(
"segmentation",
rerun::AnnotationInfo(1, "red", rerun::Rgba32(255, 0, 0)),
rerun::AnnotationInfo(2, "green", rerun::Rgba32(0, 255, 0)),
})
);
// create a segmentation image
const int HEIGHT = 200;
const int WIDTH = 300;
std::vector<uint8_t> data(WIDTH * HEIGHT, 0);
for (auto y = 50; y <100; ++y) {
std::fill_n(data.begin() + y * WIDTH + 50, 70, static_cast<uint8_t>(1));
}
for (auto y = 100; y <180; ++y) {
std::fill_n(data.begin() + y * WIDTH + 130, 150, static_cast<uint8_t>(2));
}
rec.log("segmentation/image", rerun::SegmentationImage(data.data(), {WIDTH, HEIGHT}));
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:60
Archetype: The annotation context provides additional information on how to display entities.
Definition annotation_context.hpp:67
Archetype: An image made up of integer components::ClassIds.
Definition segmentation_image.hpp:74
Datatype: Annotation info annotating a class id or key-point id.
Definition annotation_info.hpp:26
Datatype: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition rgba32.hpp:28

Member Function Documentation

◆ with_many_context()

AnnotationContext rerun::archetypes::AnnotationContext::with_many_context ( const Collection< rerun::components::AnnotationContext > &  _context) &&
inline

This method makes it possible to pack multiple context in a single component batch.

This only makes sense when used in conjunction with columns. with_context should be used when logging a single row's worth of data.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::AnnotationContext::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::AnnotationContext::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ IndicatorComponentName

constexpr const char rerun::archetypes::AnnotationContext::IndicatorComponentName[]
staticconstexpr
Initial value:
=
"rerun.components.AnnotationContextIndicator"

◆ Descriptor_context

constexpr auto rerun::archetypes::AnnotationContext::Descriptor_context
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "context",
Loggable<rerun::components::AnnotationContext>::Descriptor.component_name
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition annotation_context.hpp:78

ComponentDescriptor for the context field.


The documentation for this struct was generated from the following file: