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.
22 ///
23 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
24 ///
26 /// Filter used when zooming in on the tensor.
27 ///
28 /// Note that the filter is applied to the scalar values *before* they are mapped to color.
29 std::optional<ComponentBatch> mag_filter;
30
31 /// How scalar values map to colors.
32 std::optional<ComponentBatch> colormap;
33
34 /// Gamma exponent applied to normalized values before mapping to color.
35 ///
36 /// Raises the normalized values to the power of this value before mapping to color.
37 /// Acts like an inverse brightness. Defaults to 1.0.
38 ///
39 /// The final value for display is set as:
40 /// `colormap( ((value - data_display_range.min) / (data_display_range.max - data_display_range.min)) ** gamma )`
41 std::optional<ComponentBatch> gamma;
42
43 public:
44 static constexpr const char IndicatorComponentName[] =
45 "rerun.blueprint.components.TensorScalarMappingIndicator";
46
47 /// Indicator component, used to identify the archetype when converting to a list of components.
49 /// The name of the archetype as used in `ComponentDescriptor`s.
50 static constexpr const char ArchetypeName[] =
51 "rerun.blueprint.archetypes.TensorScalarMapping";
52
53 /// `ComponentDescriptor` for the `mag_filter` field.
55 ArchetypeName, "mag_filter",
57 );
58 /// `ComponentDescriptor` for the `colormap` field.
60 ArchetypeName, "colormap",
62 );
63 /// `ComponentDescriptor` for the `gamma` field.
64 static constexpr auto Descriptor_gamma = ComponentDescriptor(
65 ArchetypeName, "gamma",
67 );
68
69 public:
70 TensorScalarMapping() = default;
72 TensorScalarMapping(const TensorScalarMapping& other) = default;
73 TensorScalarMapping& operator=(const TensorScalarMapping& other) = default;
74 TensorScalarMapping& operator=(TensorScalarMapping&& other) = default;
75
76 /// Update only some specific fields of a `TensorScalarMapping`.
78 return TensorScalarMapping();
79 }
80
81 /// Clear all the fields of a `TensorScalarMapping`.
83
84 /// Filter used when zooming in on the tensor.
85 ///
86 /// Note that the filter is applied to the scalar values *before* they are mapped to color.
89 ) && {
91 ComponentBatch::from_loggable(_mag_filter, Descriptor_mag_filter).value_or_throw();
92 return std::move(*this);
93 }
94
95 /// How scalar values map to colors.
97 colormap =
98 ComponentBatch::from_loggable(_colormap, Descriptor_colormap).value_or_throw();
99 return std::move(*this);
100 }
101
102 /// Gamma exponent applied to normalized values before mapping to color.
103 ///
104 /// Raises the normalized values to the power of this value before mapping to color.
105 /// Acts like an inverse brightness. Defaults to 1.0.
106 ///
107 /// The final value for display is set as:
108 /// `colormap( ((value - data_display_range.min) / (data_display_range.max - data_display_range.min)) ** gamma )`
110 gamma = ComponentBatch::from_loggable(_gamma, Descriptor_gamma).value_or_throw();
111 return std::move(*this);
112 }
113
114 /// Partitions the component data into multiple sub-batches.
115 ///
116 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
117 /// instead, via `ComponentBatch::partitioned`.
118 ///
119 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
120 ///
121 /// The specified `lengths` must sum to the total length of the component batch.
123
124 /// Partitions the component data into unit-length sub-batches.
125 ///
126 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
127 /// where `n` is automatically guessed.
129 };
130
131} // namespace rerun::blueprint::archetypes
132
133namespace rerun {
134 /// \private
135 template <typename T>
136 struct AsComponents;
137
138 /// \private
139 template <>
140 struct AsComponents<blueprint::archetypes::TensorScalarMapping> {
141 /// Serialize all set component batches.
142 static Result<Collection<ComponentBatch>> as_batches(
144 );
145 };
146} // 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:25
TensorScalarMapping with_colormap(const rerun::components::Colormap &_colormap) &&
How scalar values map to colors.
Definition tensor_scalar_mapping.hpp:96
TensorScalarMapping with_gamma(const rerun::components::GammaCorrection &_gamma) &&
Gamma exponent applied to normalized values before mapping to color.
Definition tensor_scalar_mapping.hpp:109
std::optional< ComponentBatch > gamma
Gamma exponent applied to normalized values before mapping to color.
Definition tensor_scalar_mapping.hpp:41
TensorScalarMapping with_mag_filter(const rerun::components::MagnificationFilter &_mag_filter) &&
Filter used when zooming in on the tensor.
Definition tensor_scalar_mapping.hpp:87
static constexpr auto Descriptor_colormap
ComponentDescriptor for the colormap field.
Definition tensor_scalar_mapping.hpp:59
static constexpr auto Descriptor_gamma
ComponentDescriptor for the gamma field.
Definition tensor_scalar_mapping.hpp:64
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition tensor_scalar_mapping.hpp:50
static constexpr auto Descriptor_mag_filter
ComponentDescriptor for the mag_filter field.
Definition tensor_scalar_mapping.hpp:54
static TensorScalarMapping update_fields()
Update only some specific fields of a TensorScalarMapping.
Definition tensor_scalar_mapping.hpp:77
std::optional< ComponentBatch > mag_filter
Filter used when zooming in on the tensor.
Definition tensor_scalar_mapping.hpp:29
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:32
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