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