Rerun C++ SDK
Loading...
Searching...
No Matches
annotation_context.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/archetypes/annotation_context.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../components/annotation_context.hpp"
9#include "../indicator_component.hpp"
10#include "../result.hpp"
11
12#include <cstdint>
13#include <utility>
14#include <vector>
15
16namespace rerun::archetypes {
17 /// **Archetype**: The annotation context provides additional information on how to display entities.
18 ///
19 /// Entities can use `components::ClassId`s and `components::KeypointId`s to provide annotations, and
20 /// the labels and colors will be looked up in the appropriate
21 /// annotation context. We use the *first* annotation context we find in the
22 /// path-hierarchy when searching up through the ancestors of a given entity
23 /// path.
24 ///
25 /// See also `datatypes::ClassDescription`.
26 ///
27 /// ## Example
28 ///
29 /// ### Segmentation
30 /// ![image](https://static.rerun.io/annotation_context_segmentation/6c9e88fc9d44a08031cadd444c2e58a985cc1208/full.png)
31 ///
32 /// ```cpp
33 /// #include <rerun.hpp>
34 ///
35 /// #include <algorithm> // fill_n
36 /// #include <vector>
37 ///
38 /// int main() {
39 /// const auto rec = rerun::RecordingStream("rerun_example_annotation_context_segmentation");
40 /// rec.spawn().exit_on_failure();
41 ///
42 /// // create an annotation context to describe the classes
43 /// rec.log_static(
44 /// "segmentation",
45 /// rerun::AnnotationContext({
46 /// rerun::AnnotationInfo(1, "red", rerun::Rgba32(255, 0, 0)),
47 /// rerun::AnnotationInfo(2, "green", rerun::Rgba32(0, 255, 0)),
48 /// })
49 /// );
50 ///
51 /// // create a segmentation image
52 /// const int HEIGHT = 200;
53 /// const int WIDTH = 300;
54 /// std::vector<uint8_t> data(WIDTH * HEIGHT, 0);
55 /// for (auto y = 50; y <100; ++y) {
56 /// std::fill_n(data.begin() + y * WIDTH + 50, 70, static_cast<uint8_t>(1));
57 /// }
58 /// for (auto y = 100; y <180; ++y) {
59 /// std::fill_n(data.begin() + y * WIDTH + 130, 150, static_cast<uint8_t>(2));
60 /// }
61 ///
62 /// rec.log("segmentation/image", rerun::SegmentationImage(data.data(), {WIDTH, HEIGHT}));
63 /// }
64 /// ```
66 /// List of class descriptions, mapping class indices to class names, colors etc.
68
69 public:
70 static constexpr const char IndicatorComponentName[] =
71 "rerun.components.AnnotationContextIndicator";
72
73 /// Indicator component, used to identify the archetype when converting to a list of components.
75
76 public:
77 AnnotationContext() = default;
78 AnnotationContext(AnnotationContext&& other) = default;
79
81 : context(std::move(_context)) {}
82 };
83
84} // namespace rerun::archetypes
85
86namespace rerun {
87 /// \private
88 template <typename T>
89 struct AsComponents;
90
91 /// \private
92 template <>
93 struct AsComponents<archetypes::AnnotationContext> {
94 /// Serialize all set component batches.
95 static Result<std::vector<ComponentBatch>> serialize(
96 const archetypes::AnnotationContext& archetype
97 );
98 };
99} // namespace rerun
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Archetype: The annotation context provides additional information on how to display entities.
Definition annotation_context.hpp:65
rerun::components::AnnotationContext context
List of class descriptions, mapping class indices to class names, colors etc.
Definition annotation_context.hpp:67
Component: The annotation context provides additional information on how to display entities.
Definition annotation_context.hpp:29
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30