Program Listing for File holoviz.hpp

Return to documentation for file (include/holoscan/operators/holoviz/holoviz.hpp)


/* * SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HOLOSCAN_OPERATORS_HOLOVIZ_HOLOVIZ_HPP #define HOLOSCAN_OPERATORS_HOLOVIZ_HOLOVIZ_HPP #include <memory> #include <string> #include <vector> #include "holoscan/core/gxf/gxf_operator.hpp" #include "holoscan/utils/cuda_stream_handler.hpp" namespace holoscan::ops { class HolovizOp : public Operator { public: HOLOSCAN_OPERATOR_FORWARD_ARGS(HolovizOp) HolovizOp() = default; void setup(OperatorSpec& spec) override; void initialize() override; void start() override; void compute(InputContext& op_input, OutputContext& op_output, ExecutionContext& context) override; void stop() override; enum class InputType { UNKNOWN, COLOR, COLOR_LUT, POINTS, LINES, LINE_STRIP, TRIANGLES, CROSSES, RECTANGLES, OVALS, TEXT, DEPTH_MAP, DEPTH_MAP_COLOR }; enum class DepthMapRenderMode { POINTS, LINES, TRIANGLES }; struct InputSpec { InputSpec() = default; InputSpec(const std::string tensor_name, InputType type) : tensor_name_(tensor_name), type_(type) {} explicit operator bool() const noexcept { return !tensor_name_.empty(); } std::string tensor_name_; InputType type_ = InputType::UNKNOWN; float opacity_ = 1.f; int32_t priority_ = 0; std::vector<float> color_{1.f, 1.f, 1.f, 1.f}; float line_width_ = 1.f; float point_size_ = 1.f; std::vector<std::string> text_; DepthMapRenderMode depth_map_render_mode_ = DepthMapRenderMode::POINTS; }; private: void enable_conditional_port(const std::string& name); bool check_port_enabled(const std::string& name); Parameter<std::vector<holoscan::IOSpec*>> receivers_; Parameter<holoscan::IOSpec*> render_buffer_input_; Parameter<holoscan::IOSpec*> render_buffer_output_; Parameter<std::vector<InputSpec>> tensors_; Parameter<std::vector<std::vector<float>>> color_lut_; Parameter<std::string> window_title_; Parameter<std::string> display_name_; Parameter<uint32_t> width_; Parameter<uint32_t> height_; Parameter<float> framerate_; Parameter<bool> use_exclusive_display_; Parameter<bool> fullscreen_; Parameter<bool> headless_; Parameter<std::shared_ptr<BooleanCondition>> window_close_scheduling_term_; Parameter<std::shared_ptr<Allocator>> allocator_; Parameter<std::string> font_path_; // internal state std::vector<float> lut_; std::vector<InputSpec> input_spec_; CudaStreamHandler cuda_stream_handler_; bool render_buffer_input_enabled_; bool render_buffer_output_enabled_; bool is_first_tick_ = true; }; } // namespace holoscan::ops #endif/* HOLOSCAN_OPERATORS_HOLOVIZ_HOLOVIZ_HPP */

© Copyright 2022-2023, NVIDIA. Last updated on Apr 27, 2023.