6#include "../archetype_utils.hpp"
7#include "../collection.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/colormap.hpp"
11#include "../components/depth_meter.hpp"
12#include "../components/draw_order.hpp"
13#include "../components/fill_ratio.hpp"
14#include "../components/image_buffer.hpp"
15#include "../components/image_format.hpp"
16#include "../components/magnification_filter.hpp"
17#include "../components/value_range.hpp"
18#include "../image_utils.hpp"
19#include "../result.hpp"
88 std::optional<ComponentBatch>
buffer;
91 std::optional<ComponentBatch>
format;
102 std::optional<ComponentBatch>
meter;
146 static constexpr const char ArchetypeName[] =
"rerun.archetypes.DepthImage";
196 template <
typename TElement>
199 reinterpret_cast<const uint8_t*>(pixels), resolution, get_datatype(pixels)
209 template <
typename TElement>
211 :
DepthImage{pixels.to_uint8(), resolution, get_datatype(pixels.data())} {}
239 if (bytes.
size() != image_format.num_bytes()) {
241 ErrorCode::InvalidTensorDimension,
242 "DepthImage buffer has the wrong size. Got " + std::to_string(bytes.
size()) +
243 " bytes, expected " + std::to_string(image_format.num_bytes())
247 *
this = std::move(*this).with_buffer(bytes).with_format(image_format);
270 return std::move(*
this);
279 return std::move(*
this);
285 return std::move(*
this);
294 return std::move(*
this);
308 return std::move(*
this);
317 return std::move(*
this);
326 return std::move(*
this);
336 return std::move(*
this);
353 return std::move(*
this);
365 return std::move(*
this);
379 return std::move(*
this);
392 return std::move(*
this);
402 return std::move(*
this);
413 return std::move(*
this);
425 _magnification_filter,
429 return std::move(*
this);
440 _magnification_filter,
444 return std::move(*
this);
456 return detail::partition_batches(
475 return detail::partition_batches_of_unit_length({&
buffer,
491 template <
typename T>
496 struct AsComponents<archetypes::DepthImage> {
498 static Result<Collection<ComponentBatch>> as_batches(
const archetypes::DepthImage& archetype
500 return detail::collect_batches(
505 &archetype.depth_range,
506 &archetype.point_fill_ratio,
507 &archetype.draw_order,
508 &archetype.magnification_filter}
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
size_t size() const
Returns the number of instances in this collection.
Definition collection.hpp:295
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:104
void handle() const
Handle this error based on the set log handler.
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:90
Colormap
Component: Colormap for mapping scalar values within a given range to a color.
Definition colormap.hpp:28
MagnificationFilter
Component: Filter used when a single texel/pixel of an image is displayed larger than a single screen...
Definition magnification_filter.hpp:27
ChannelDatatype
Encoding: The innermost datatype of an image.
Definition channel_datatype.hpp:26
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
Collection< TElement > borrow(const TElement *data, size_t num_instances=1)
Borrows binary data into a Collection from a pointer.
Definition collection.hpp:453
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
The width and height of an image.
Definition image_utils.hpp:13
Archetype: A depth image, i.e.
Definition depth_image.hpp:86
DepthImage with_colormap(const rerun::components::Colormap &_colormap) &&
Colormap to use for rendering the depth image.
Definition depth_image.hpp:323
DepthImage with_meter(const rerun::components::DepthMeter &_meter) &&
An optional floating point value that specifies how long a meter is in the native depth units.
Definition depth_image.hpp:306
std::optional< ComponentBatch > format
The format of the image.
Definition depth_image.hpp:91
static constexpr auto Descriptor_depth_range
ComponentDescriptor for the depth_range field.
Definition depth_image.hpp:169
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition depth_image.hpp:146
DepthImage with_many_magnification_filter(const Collection< rerun::components::MagnificationFilter > &_magnification_filter) &&
This method makes it possible to pack multiple magnification_filter in a single component batch.
Definition depth_image.hpp:436
DepthImage with_magnification_filter(const rerun::components::MagnificationFilter &_magnification_filter) &&
Optional filter used when a texel is magnified (displayed larger than a screen pixel) in 2D views.
Definition depth_image.hpp:421
DepthImage with_point_fill_ratio(const rerun::components::FillRatio &_point_fill_ratio) &&
Scale the radii of the points in the point cloud generated from this image.
Definition depth_image.hpp:375
static constexpr auto Descriptor_point_fill_ratio
ComponentDescriptor for the point_fill_ratio field.
Definition depth_image.hpp:174
std::optional< ComponentBatch > magnification_filter
Optional filter used when a texel is magnified (displayed larger than a screen pixel) in 2D views.
Definition depth_image.hpp:142
DepthImage with_many_draw_order(const Collection< rerun::components::DrawOrder > &_draw_order) &&
This method makes it possible to pack multiple draw_order in a single component batch.
Definition depth_image.hpp:409
static DepthImage update_fields()
Update only some specific fields of a DepthImage.
Definition depth_image.hpp:260
std::optional< ComponentBatch > colormap
Colormap to use for rendering the depth image.
Definition depth_image.hpp:107
std::optional< ComponentBatch > depth_range
The expected range of depth values.
Definition depth_image.hpp:120
static constexpr auto Descriptor_format
ComponentDescriptor for the format field.
Definition depth_image.hpp:154
DepthImage with_depth_range(const rerun::components::ValueRange &_depth_range) &&
The expected range of depth values.
Definition depth_image.hpp:350
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition depth_image.hpp:455
static constexpr auto Descriptor_colormap
ComponentDescriptor for the colormap field.
Definition depth_image.hpp:164
std::optional< ComponentBatch > meter
An optional floating point value that specifies how long a meter is in the native depth units.
Definition depth_image.hpp:102
DepthImage(Collection< TElement > pixels, WidthHeight resolution)
Constructs image from pixel data + resolution with datatype inferred from the passed collection.
Definition depth_image.hpp:210
std::optional< ComponentBatch > draw_order
An optional floating point value that specifies the 2D drawing order, used only if the depth image is...
Definition depth_image.hpp:135
static constexpr auto Descriptor_draw_order
ComponentDescriptor for the draw_order field.
Definition depth_image.hpp:179
DepthImage with_many_point_fill_ratio(const Collection< rerun::components::FillRatio > &_point_fill_ratio) &&
This method makes it possible to pack multiple point_fill_ratio in a single component batch.
Definition depth_image.hpp:386
static constexpr auto Descriptor_buffer
ComponentDescriptor for the buffer field.
Definition depth_image.hpp:149
DepthImage(Collection< uint8_t > bytes, WidthHeight resolution, encodings::ChannelDatatype datatype)
Constructs image from pixel data + resolution + datatype.
Definition depth_image.hpp:235
DepthImage with_many_colormap(const Collection< rerun::components::Colormap > &_colormap) &&
This method makes it possible to pack multiple colormap in a single component batch.
Definition depth_image.hpp:333
DepthImage(const TElement *pixels, WidthHeight resolution)
Constructs image from pointer + resolution, inferring the datatype from the pointer type.
Definition depth_image.hpp:197
DepthImage with_many_meter(const Collection< rerun::components::DepthMeter > &_meter) &&
This method makes it possible to pack multiple meter in a single component batch.
Definition depth_image.hpp:315
std::optional< ComponentBatch > point_fill_ratio
Scale the radii of the points in the point cloud generated from this image.
Definition depth_image.hpp:129
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition depth_image.hpp:474
DepthImage with_format(const rerun::components::ImageFormat &_format) &&
The format of the image.
Definition depth_image.hpp:283
DepthImage with_many_depth_range(const Collection< rerun::components::ValueRange > &_depth_range) &&
This method makes it possible to pack multiple depth_range in a single component batch.
Definition depth_image.hpp:360
DepthImage with_buffer(const rerun::components::ImageBuffer &_buffer) &&
The raw depth image data.
Definition depth_image.hpp:268
DepthImage with_many_format(const Collection< rerun::components::ImageFormat > &_format) &&
This method makes it possible to pack multiple format in a single component batch.
Definition depth_image.hpp:292
DepthImage with_draw_order(const rerun::components::DrawOrder &_draw_order) &&
An optional floating point value that specifies the 2D drawing order, used only if the depth image is...
Definition depth_image.hpp:399
static constexpr auto Descriptor_magnification_filter
ComponentDescriptor for the magnification_filter field.
Definition depth_image.hpp:184
static DepthImage clear_fields()
Clear all the fields of a DepthImage.
DepthImage with_many_buffer(const Collection< rerun::components::ImageBuffer > &_buffer) &&
This method makes it possible to pack multiple buffer in a single component batch.
Definition depth_image.hpp:277
DepthImage(const void *bytes, WidthHeight resolution, encodings::ChannelDatatype datatype)
Constructs image from pixel data + resolution with explicit datatype.
Definition depth_image.hpp:220
static constexpr auto Descriptor_meter
ComponentDescriptor for the meter field.
Definition depth_image.hpp:159
std::optional< ComponentBatch > buffer
The raw depth image data.
Definition depth_image.hpp:88
Component: The world->depth map scaling factor.
Definition depth_meter.hpp:24
Component: Draw order of 2D elements.
Definition draw_order.hpp:30
Component: How much a primitive fills out the available space.
Definition fill_ratio.hpp:19
Component: A buffer that is known to store image data.
Definition image_buffer.hpp:18
Component: Range of expected or valid values, specifying a lower and upper bound.
Definition value_range.hpp:18