↰ Return to documentation for file (include/holoscan/operators/holoviz/holoviz.hpp
)
/*
* SPDX-FileCopyrightText: Copyright (c) 2022 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 "../../core/gxf/gxf_operator.hpp"
namespace holoscan::ops {
class HolovizOp : public holoscan::ops::GXFOperator {
public:
HOLOSCAN_OPERATOR_FORWARD_ARGS_SUPER(HolovizOp, holoscan::ops::GXFOperator)
HolovizOp() = default;
const char* gxf_typename() const override { return "nvidia::holoscan::Holoviz"; }
void setup(OperatorSpec& spec) override;
void initialize() override;
enum class InputType {
UNKNOWN,
COLOR,
COLOR_LUT,
POINTS,
LINES,
LINE_STRIP,
TRIANGLES,
CROSSES,
RECTANGLES,
OVALS,
TEXT
};
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_;
};
private:
void enable_conditional_port(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<uint32_t> framerate_;
Parameter<bool> use_exclusive_display_;
Parameter<bool> fullscreen_;
Parameter<bool> headless_;
Parameter<std::shared_ptr<Condition>> window_close_scheduling_term_;
Parameter<std::shared_ptr<Allocator>> allocator_;
};
} // namespace holoscan::ops
#endif/* HOLOSCAN_OPERATORS_HOLOVIZ_HOLOVIZ_HPP */