Rerun C++ SDK
Loading...
Searching...
No Matches
tensor_scalar_mapping.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/blueprint/archetypes/tensor_scalar_mapping.fbs".
3
4#pragma once
5
6#include "../../collection.hpp"
7#include "../../component_batch.hpp"
8#include "../../component_column.hpp"
9#include "../../components/colormap.hpp"
10#include "../../components/gamma_correction.hpp"
11#include "../../components/magnification_filter.hpp"
12#include "../../indicator_component.hpp"
13#include "../../result.hpp"
14
15#include <cstdint>
16#include <optional>
17#include <utility>
18#include <vector>
19
20namespace rerun::blueprint::archetypes {
21 /// **Archetype**: Configures how tensor scalars are mapped to color.
23 /// Filter used when zooming in on the tensor.
24 ///
25 /// Note that the filter is applied to the scalar values *before* they are mapped to color.
26 std::optional<ComponentBatch> mag_filter;
27
28 /// How scalar values map to colors.
29 std::optional<ComponentBatch> colormap;
30
31 /// Gamma exponent applied to normalized values before mapping to color.
32 ///
33 /// Raises the normalized values to the power of this value before mapping to color.
34 /// Acts like an inverse brightness. Defaults to 1.0.
35 ///
36 /// The final value for display is set as:
37 /// `colormap( ((value - data_display_range.min) / (data_display_range.max - data_display_range.min)) ** gamma )`
38 std::optional<ComponentBatch> gamma;
39
40 public:
41 static constexpr const char IndicatorComponentName[] =
42 "rerun.blueprint.components.TensorScalarMappingIndicator";
43
44 /// Indicator component, used to identify the archetype when converting to a list of components.
46 /// The name of the archetype as used in `ComponentDescriptor`s.
47 static constexpr const char ArchetypeName[] =
48 "rerun.blueprint.archetypes.TensorScalarMapping";
49
50 /// `ComponentDescriptor` for the `mag_filter` field.
52 ArchetypeName, "mag_filter",
54 );
55 /// `ComponentDescriptor` for the `colormap` field.
57 ArchetypeName, "colormap",
59 );
60 /// `ComponentDescriptor` for the `gamma` field.
61 static constexpr auto Descriptor_gamma = ComponentDescriptor(
62 ArchetypeName, "gamma",
64 );
65
66 public:
67 TensorScalarMapping() = default;
69 TensorScalarMapping(const TensorScalarMapping& other) = default;
70 TensorScalarMapping& operator=(const TensorScalarMapping& other) = default;
71 TensorScalarMapping& operator=(TensorScalarMapping&& other) = default;
72
73 /// Update only some specific fields of a `TensorScalarMapping`.
75 return TensorScalarMapping();
76 }
77
78 /// Clear all the fields of a `TensorScalarMapping`.
80
81 /// Filter used when zooming in on the tensor.
82 ///
83 /// Note that the filter is applied to the scalar values *before* they are mapped to color.
86 ) && {
88 ComponentBatch::from_loggable(_mag_filter, Descriptor_mag_filter).value_or_throw();
89 return std::move(*this);
90 }
91
92 /// How scalar values map to colors.
94 colormap =
95 ComponentBatch::from_loggable(_colormap, Descriptor_colormap).value_or_throw();
96 return std::move(*this);
97 }
98
99 /// Gamma exponent applied to normalized values before mapping to color.
100 ///
101 /// Raises the normalized values to the power of this value before mapping to color.
102 /// Acts like an inverse brightness. Defaults to 1.0.
103 ///
104 /// The final value for display is set as:
105 /// `colormap( ((value - data_display_range.min) / (data_display_range.max - data_display_range.min)) ** gamma )`
107 gamma = ComponentBatch::from_loggable(_gamma, Descriptor_gamma).value_or_throw();
108 return std::move(*this);
109 }
110
111 /// Partitions the component data into multiple sub-batches.
112 ///
113 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
114 /// instead, via `ComponentBatch::partitioned`.
115 ///
116 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
117 ///
118 /// The specified `lengths` must sum to the total length of the component batch.
120
121 /// Partitions the component data into unit-length sub-batches.
122 ///
123 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
124 /// where `n` is automatically guessed.
126 };
127
128} // namespace rerun::blueprint::archetypes
129
130namespace rerun {
131 /// \private
132 template <typename T>
133 struct AsComponents;
134
135 /// \private
136 template <>
137 struct AsComponents<blueprint::archetypes::TensorScalarMapping> {
138 /// Serialize all set component batches.
139 static Result<Collection<ComponentBatch>> as_batches(
141 );
142 };
143} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
Colormap
Component: Colormap for mapping scalar values within a given range to a color.
Definition colormap.hpp:29
MagnificationFilter
Component: Filter used when magnifying an image/texture such that a single pixel/texel is displayed a...
Definition magnification_filter.hpp:25
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor=rerun::Loggable< T >::Descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:14
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Configures how tensor scalars are mapped to color.
Definition tensor_scalar_mapping.hpp:22
TensorScalarMapping with_colormap(const rerun::components::Colormap &_colormap) &&
How scalar values map to colors.
Definition tensor_scalar_mapping.hpp:93
TensorScalarMapping with_gamma(const rerun::components::GammaCorrection &_gamma) &&
Gamma exponent applied to normalized values before mapping to color.
Definition tensor_scalar_mapping.hpp:106
std::optional< ComponentBatch > gamma
Gamma exponent applied to normalized values before mapping to color.
Definition tensor_scalar_mapping.hpp:38
TensorScalarMapping with_mag_filter(const rerun::components::MagnificationFilter &_mag_filter) &&
Filter used when zooming in on the tensor.
Definition tensor_scalar_mapping.hpp:84
static constexpr auto Descriptor_colormap
ComponentDescriptor for the colormap field.
Definition tensor_scalar_mapping.hpp:56
static constexpr auto Descriptor_gamma
ComponentDescriptor for the gamma field.
Definition tensor_scalar_mapping.hpp:61
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition tensor_scalar_mapping.hpp:47
static constexpr auto Descriptor_mag_filter
ComponentDescriptor for the mag_filter field.
Definition tensor_scalar_mapping.hpp:51
static TensorScalarMapping update_fields()
Update only some specific fields of a TensorScalarMapping.
Definition tensor_scalar_mapping.hpp:74
std::optional< ComponentBatch > mag_filter
Filter used when zooming in on the tensor.
Definition tensor_scalar_mapping.hpp:26
static TensorScalarMapping clear_fields()
Clear all the fields of a TensorScalarMapping.
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
std::optional< ComponentBatch > colormap
How scalar values map to colors.
Definition tensor_scalar_mapping.hpp:29
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Component: A gamma correction value to be used with a scalar value or color.
Definition gamma_correction.hpp:21
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32