NVIDIA Holoscan SDK v2.4.0
v2.4.0

Holoscan API

page index

Holoviz composites real time streams of frames with multiple different other layers like segmentation mask layers, geometry layers and GUI layers.

For maximum performance Holoviz makes use of Vulkan, which is already installed as part of the Nvidia driver.

Concepts

Holoviz uses the concept of the immediate mode design pattern for its API, inspired by the Dear ImGui library. The difference to the retained mode, for which most APIs are designed for, is, that there are no objects created and stored by the application. This makes it easy to quickly build and change an Holoviz app.

Instance

The Holoviz module uses a thread-local instance object to store its internal state. The instance object is created when calling the Holoviz module is first called from a thread. All Holoviz module functions called from that thread use this instance.

When calling into the Holoviz module from other threads other than the thread from which the Holoviz module functions were first called, make sure to call {func}viz::GetCurrent() and {func}viz::SetCurrent() in the respective threads.

There are usage cases where multiple instances are needed, for example, to open multiple windows. Instances can be created by calling {func}viz::Create(). Call {func}viz::SetCurrent() to make the instance current before calling the Holoviz module function to be executed for the window the instance belongs to.

Usage

The code below creates a window and displays an image. First Holoviz needs to be initialized. This is done by calling holoscan::viz::Init().

The elements to display are defined in the render loop, termination of the loop is checked with holoscan::viz::WindowShouldClose().

The definition of the displayed content starts with holoscan::viz::Begin() and ends with holoscan::viz::End(). holoscan::viz::End() starts the rendering and displays the rendered result.

Finally Holoviz is shutdown with viz::Shutdown().

Copy
Copied!
            

namespace viz = holoscan::viz; viz::Init("Holoviz Example"); while (!viz::WindowShouldClose()) { viz::Begin(); viz::BeginImageLayer(); viz::ImageHost(width, height, viz::ImageFormat::R8G8B8A8_UNORM, image_data); viz::EndLayer(); viz::End(); } viz::Shutdown();

Page Hierarchy

Full API

Namespaces

Classes and Structs

Enums

Functions

Variables

Defines

Typedefs

Previous Holoscan C++ API
Next Namespace AppDriverService
© Copyright 2022-2024, NVIDIA. Last updated on Oct 1, 2024.