6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/draw_order.hpp"
10#include "../components/image_buffer.hpp"
11#include "../components/image_format.hpp"
12#include "../components/opacity.hpp"
13#include "../image_utils.hpp"
14#include "../indicator_component.hpp"
15#include "../result.hpp"
84 std::optional<rerun::components::Opacity>
opacity;
92 static constexpr const char IndicatorComponentName[] =
93 "rerun.components.SegmentationImageIndicator";
105 template <
typename TElement>
108 reinterpret_cast<const uint8_t*>(pixels), resolution, get_datatype(pixels)} {}
117 template <
typename TElement>
119 :
SegmentationImage{pixels.to_uint8(), resolution, get_datatype(pixels.data())} {}
147 :
buffer{bytes},
format{datatypes::ImageFormat{resolution, datatype}} {
150 ErrorCode::InvalidTensorDimension,
151 "SegmentationImage buffer has the wrong size. Got " +
152 std::to_string(
buffer.
size()) +
" bytes, expected " +
171 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(
return std::move(*
this);)
180 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(
return std::move(*
this);)
188 template <
typename T>
193 struct AsComponents<archetypes::SegmentationImage> {
195 static Result<std::vector<ComponentBatch>> serialize(
196 const archetypes::SegmentationImage& archetype
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
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:76
ChannelDatatype
Datatype: 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:22
Collection< TElement > borrow(const TElement *data, size_t num_instances=1)
Borrows binary data into a Collection from a pointer.
Definition collection.hpp:461
The width and height of an image.
Definition image_utils.hpp:13
Archetype: An image made up of integer components::ClassIds.
Definition segmentation_image.hpp:74
std::optional< rerun::components::DrawOrder > draw_order
An optional floating point value that specifies the 2D drawing order.
Definition segmentation_image.hpp:89
SegmentationImage(Collection< uint8_t > bytes, WidthHeight resolution, datatypes::ChannelDatatype datatype)
Constructs image from pixel data + resolution + datatype.
Definition segmentation_image.hpp:144
SegmentationImage(Collection< TElement > pixels, WidthHeight resolution)
Constructs image from pixel data + resolution with datatype inferred from the passed collection.
Definition segmentation_image.hpp:118
SegmentationImage with_opacity(rerun::components::Opacity _opacity) &&
Opacity of the image, useful for layering the segmentation image on top of another image.
Definition segmentation_image.hpp:168
SegmentationImage(const TElement *pixels, WidthHeight resolution)
Constructs image from pointer + resolution, inferring the datatype from the pointer type.
Definition segmentation_image.hpp:106
std::optional< rerun::components::Opacity > opacity
Opacity of the image, useful for layering the segmentation image on top of another image.
Definition segmentation_image.hpp:84
SegmentationImage(const void *bytes, WidthHeight resolution, datatypes::ChannelDatatype datatype)
Constructs image from pixel data + resolution with explicit datatype.
Definition segmentation_image.hpp:128
SegmentationImage with_draw_order(rerun::components::DrawOrder _draw_order) &&
An optional floating point value that specifies the 2D drawing order.
Definition segmentation_image.hpp:177
rerun::components::ImageBuffer buffer
The raw image data.
Definition segmentation_image.hpp:76
rerun::components::ImageFormat format
The format of the image.
Definition segmentation_image.hpp:79
Component: Draw order of 2D elements.
Definition draw_order.hpp:19
Component: A buffer that is known to store image data.
Definition image_buffer.hpp:18
size_t size() const
Number of bytes.
Definition image_buffer.hpp:23
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30
Component: Degree of transparency ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
Definition opacity.hpp:17