> This page is for version 5.1 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 5.1 (Latest) (default): https://docs.nvidia.com/holoscan/sdk-user-guide/5-1-latest/llms.txt
> - ltsb-2.0: https://docs.nvidia.com/holoscan/sdk-user-guide/ltsb-2-0/llms.txt
> - 5.0: https://docs.nvidia.com/holoscan/sdk-user-guide/5-0/llms.txt
> - 4.6: https://docs.nvidia.com/holoscan/sdk-user-guide/4-6/llms.txt
> - 4.5: https://docs.nvidia.com/holoscan/sdk-user-guide/4-5/llms.txt
> - 4.4: https://docs.nvidia.com/holoscan/sdk-user-guide/4-4/llms.txt
> - 4.3: https://docs.nvidia.com/holoscan/sdk-user-guide/4-3/llms.txt
> - Archives: https://docs.nvidia.com/holoscan/sdk-user-guide/archives/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sdk-user-guide/llms.txt.

In Holoscan SDK 4.x, one `HolovizOp` did everything. You listed tensor names in
its `tensors` parameter, connected producers to its `receivers` port, and the
operator found each named tensor, guessed or read its type, and drew it as a
layer. The same operator owned the window, the camera, the input callbacks,
headless capture, and an immediate-mode `viz::` library for custom drawing.

In Holoscan SDK 5.x, you declare everything the operator draws before the graph
compiles. A `LayerStack` lists typed layers, and each layer has its own typed
input port. A sink descriptor says where frames go. A trigger and a freshness
bound say when a frame is drawn. Small operators such as `WindowDisplayOp`,
`ImGuiOp`, and `CompositorOp` cover the cases that once needed the full
operator. Invalid declarations fail at construction or graph compilation. The
runtime also checks delivered tensors, and the renderer validates frame contents.

This page describes the Visualization module in Holoscan SDK 5.1. It maps every
4.x Holoviz parameter, port, input type, and library call to its 5.1
replacement, and lists the 4.x features that have no 5.1 equivalent yet. If you
already ported to 5.0, also read
[Moving from 5.0 to 5.1](/holoscan/sdk-user-guide/introduction/migrating-from-50). For the
5.x operators themselves, see
[Visualization](/holoscan/sdk-user-guide/modules/visualization). For the rest
of the runtime, see the
[shared migration map](/holoscan/sdk-user-guide/introduction/migrating-from-4x)
and the
[Python migration guide](/holoscan/sdk-user-guide/introduction/migrating-python-from-4x).

> **You will learn**
>
> * How each 4.x `HolovizOp` parameter, port, and input type maps to 5.x
> * How to port image, LUT, 2D geometry, and text layers
> * How the window, display, and headless outputs changed
> * Which 4.x features have no 5.x equivalent, and what to do instead

## Concept map

| Holoscan SDK 4.x                                                                             | Holoscan SDK 5.x                                                                       | What changes for you                                                                                                                                                |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| One `HolovizOp` with string-keyed parameters                                                 | `HolovizOp(LayerStack, SinkDesc, HolovizOpOptions)`                                    | Declare layers, sink, trigger, and freshness bound as typed values. The constructor validates them and names the bad field.                                         |
| `tensors` list of `InputSpec`, matched by tensor name                                        | `LayerStack::add_image_layer`, `add_geometry_layer`, `add_text_layer`, `add_lut_layer` | Each call declares one layer and one input port, and returns a typed `LayerHandle`.                                                                                 |
| `receivers` multi-receiver port                                                              | One typed input port per layer                                                         | Connect each producer to its layer's port with `add_flow`. A producer that fed several layers now connects to each port.                                            |
| `InputType::UNKNOWN` auto-detection                                                          | None                                                                                   | Declare every layer's kind and format.                                                                                                                              |
| `input_specs` port for runtime changes                                                       | None                                                                                   | The layer stack is fixed when the operator is constructed.                                                                                                          |
| `priority`                                                                                   | Declaration order                                                                      | Layer 0 is at the back. Each later layer composites over the earlier ones.                                                                                          |
| `InputSpec::opacity_` (`opacity` in Python)                                                  | Each layer descriptor's `opacity`                                                      | Set it on each layer. It multiplies the per-pixel or per-primitive alpha.                                                                                           |
| `InputSpec::views`                                                                           | `ImageLayerDesc::view`, `LUTLayerDesc::view`                                           | One view transform for each image or LUT layer.                                                                                                                     |
| `width`, `height`, `window_title`, `fullscreen`, `display_name`, `vsync`, `framebuffer_srgb` | `WindowSinkDesc`                                                                       | Set the window fields on the sink. `vsync` becomes `present_mode`.                                                                                                  |
| `use_exclusive_display`, `framerate`                                                         | `ExclusiveDisplaySinkDesc` or `DirectDisplayOp`                                        | DRM only. No X server or Wayland compositor may hold the GPU.                                                                                                       |
| `headless`, `enable_render_buffer_output`                                                    | `CudaSinkDesc` and the `output` port                                                   | Frames arrive as `schema::ImageT` from a runtime pool.                                                                                                              |
| 3D geometry, depth maps, and the 3D camera                                                   | None                                                                                   | 5.1 has no 3D layers. See the features with no equivalent below.                                                                                                    |
| Conditions and the scheduler decide when `compute()` runs                                    | `LayerTrigger` or `ClockTrigger`, and `max_input_age`                                  | You state which layer drives frames and how old the other layers may be.                                                                                            |
| `window_close_condition`, `interrupt_app_on_window_close`                                    | Built in                                                                               | A window-close event requests a cooperative session stop when an activation observes it. See [Window events and user interface](#window-events-and-user-interface). |
| Key, mouse, scroll, window, and layer callbacks                                              | None in `HolovizOp`; `ImGuiOp` for UI                                                  | See the window events section below.                                                                                                                                |
| `viz::` immediate-mode library                                                               | No public equivalent                                                                   | Use the operators. See the `viz::` library section below.                                                                                                           |

## Declare layers instead of tensor names

A 4.x application listed `InputSpec` entries and connected every producer to
`receivers`:

```cpp
// Holoscan SDK 4.x
std::vector<ops::HolovizOp::InputSpec> specs;
specs.emplace_back("", ops::HolovizOp::InputType::COLOR);
auto& boxes = specs.emplace_back("boxes", ops::HolovizOp::InputType::RECTANGLES);
boxes.color_ = {1.0f, 0.0f, 1.0f, 0.5f};
boxes.line_width_ = 2.0f;

auto visualizer = make_operator<ops::HolovizOp>(
    "holoviz", Arg("width", 854U), Arg("height", 480U), Arg("tensors", specs));
add_flow(source, visualizer, {{"output", "receivers"}});
add_flow(detector, visualizer, {{"outputs", "receivers"}});
```

In 5.x, declare the same layers on a `LayerStack` and connect each producer to
its own port. Set the maximum size of every layer, because the renderer sizes
its memory from these values once:

```cpp
// Holoscan SDK 5.x
#include <holoscan/visualization/holoviz_op.hpp>

namespace viz = holoscan::visualization;

viz::LayerStack layers;
viz::ImageLayerHandle video = layers.add_image_layer("video", viz::ImageLayerDesc{
    .format = viz::ImageFormat::kR8G8B8A8Unorm,
    .max_width = 854,
    .max_height = 480,
});
viz::TensorLayerHandle boxes = layers.add_geometry_layer("boxes", viz::GeometryLayerDesc{
    .topologies = {viz::GeometryTopology::kRectangleList},
    .max_primitives = 64,
    .default_line_width = 2.0f,
    .color = {1.0f, 0.0f, 1.0f, 0.5f},
});

auto holoviz = graph.op<viz::HolovizOp>(
    "holoviz", std::move(layers),
    viz::WindowSinkDesc{.title = "Holoviz", .width = 854, .height = 480});
// source->frame is an Output<schema::ImageT>; detector->boxes is an Output<Tensor>.
const holoscan::ConnectionOptions mailbox{.queue_policy = holoscan::QueuePolicy::kDropOldest,
                                         .queue_depth = 1U};
graph.add_flow(source->frame, holoviz->image_layer_input(video), mailbox);
graph.add_flow(detector->boxes, holoviz->tensor_layer_input(boxes), mailbox);
graph.partition("holoviz").add(holoviz);
```

The listing shows graph wiring; it assumes `graph`, `source`, and `detector`
already exist. The detector must emit a contiguous host `float32` tensor of
shape `(4N,)` for `N` rectangles, ordered as `x0, y0, x1, y1` per rectangle.
Declare its output rank as 1. Propagate the source image's acquisition time
with `EmitOptions::capture_time` on the derived boxes, using a clock domain
admitted by the graph. Without a capture timestamp, boxes are ineligible for
the side input's capture-time selector, even if they were just computed. See
[Emitting outputs](/holoscan/sdk-user-guide/building-operators/operator-anatomy#emitting-outputs)
for the emission contract.

Keep these rules in mind:

* One operator holds at most `kMaxLayerPorts` (8) layers of any kind. For a
  larger stack, render the lower layers to an RGBA8 `CudaSinkDesc`. Connect
  that output as the first image layer of the next `HolovizOp`, with up to
  seven additional layers above it. Repeat this chain as needed. Separate
  overlay-only renders clear untouched pixels to opaque black, so blending
  them over the camera with `CompositorOp` can hide the underlying image.
  The shipped `cuda_sink_example` in `modules/visualization/examples/operators`
  demonstrates chaining two `HolovizOp` instances.
* Layer names are port names. They must be non-empty and unique, and they must
  not collide with the fixed `output` port or with a `<name>_color_lut` port
  that a LUT layer binds.
* In 4.x one tensor could feed several layers, for example the same `boxes`
  tensor drawn as rectangles and as a line strip. In 5.x, declare one layer per
  drawing and call `add_flow` from the producer to each layer's port.
* An image producer must emit `schema::ImageT`. The 4.x operator also accepted a
  plain `Tensor` or a GXF `VideoBuffer` and inferred the image format; 5.x reads
  the encoding, size, color space, and plane layout from the `ImageT` and checks
  them against the layer.
* Each image layer declares the element type and rank that its format reads. A
  producer that promises an incompatible tensor fails graph compilation, and a
  delivered tensor that violates the requirement fails the run.
* The operator must be added to a partition explicitly.

For the full layer and port reference, see
[HolovizOp](/holoscan/sdk-user-guide/modules/visualization#holovizop).

## Image layers

The 4.x `color` input type becomes an `ImageLayerDesc` layer. The 4.x operator
picked a format from the tensor shape or used `image_format`; 5.x requires
`ImageLayerDesc::format`, and the frame's encoding must match it.

| 4.x `ImageFormat`                                                                                                | 5.x `ImageFormat`                                                    |
| ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `R8_UNORM`                                                                                                       | `kR8Unorm`                                                           |
| `R16_UNORM`                                                                                                      | `kR16Unorm`                                                          |
| `R8G8B8_UNORM`                                                                                                   | `kR8G8B8Unorm`                                                       |
| `R8G8B8A8_UNORM`                                                                                                 | `kR8G8B8A8Unorm`                                                     |
| `R8G8B8A8_SRGB`                                                                                                  | `kR8G8B8A8Unorm` with `ColorSpace::kSRGBNonlinear`                   |
| `B8G8R8A8_UNORM`                                                                                                 | `kB8G8R8A8Unorm`                                                     |
| `B8G8R8A8_SRGB`                                                                                                  | `kB8G8R8A8Unorm` with `ColorSpace::kSRGBNonlinear`                   |
| `R16G16B16A16_UNORM`                                                                                             | `kR16G16B16A16Unorm`                                                 |
| `Y8_U8V8_2PLANE_420_UNORM`                                                                                       | `kNV12`                                                              |
| `Y8U8Y8V8_422_UNORM`                                                                                             | `kYUYV422`                                                           |
| `R8_SRGB`, `R8G8B8_SRGB`                                                                                         | No equivalent                                                        |
| `R8_UINT`, `R16_UINT`, `R32_UINT` and the signed integer formats                                                 | Use a LUT layer for index images; no equivalent for direct display   |
| `*_SNORM` formats                                                                                                | No equivalent                                                        |
| `R16_SFLOAT`, `R32_SFLOAT`, `R16G16B16_SFLOAT`, `R16G16B16A16_SFLOAT`, `R32G32B32_SFLOAT`, `R32G32B32A32_SFLOAT` | No equivalent. Convert to a supported UNORM format before the layer. |
| `R16G16B16_UNORM`                                                                                                | No equivalent; use `kR16G16B16A16Unorm`                              |
| `A2B10G10R10_UNORM_PACK32`, `A2R10G10B10_UNORM_PACK32`, `A8B8G8R8_UNORM_PACK32`, `A8B8G8R8_SRGB_PACK32`          | No equivalent                                                        |
| `U8Y8V8Y8_422_UNORM` (UYVY), the 3-plane and 4:2:2 2-plane YUV formats, and all 16-bit YUV formats               | No equivalent. Convert to NV12 or YUYV first.                        |
| `D16_UNORM`, `X8_D24_UNORM`, `D32_SFLOAT`                                                                        | No equivalent as an image layer                                      |

The [Pixel and Color Conversion](/holoscan/sdk-user-guide/modules/vision/pixel-color-conversion)
operators can convert a frame to a supported format inside the graph.

Color handling is stricter:

* Each image layer declares the color space of its source in `color_space`:
  `kPassThrough` (the default), `kSRGBNonlinear`, or `kBT709Linear`. A frame
  labeled with another color space is dropped, so a mislabeled source shows
  nothing instead of wrong colors.
* For `kNV12` and `kYUYV422`, `yuv_model` and `yuv_range` are required. 4.x
  defaulted to BT.601 and full range when you did not set them.
* 4.x `x_chroma_location` and `y_chroma_location` have no equivalent. 5.x
  reconstructs chroma at the sample center. A 4.x layer that used the default
  `COSITED_EVEN` can show a half-pixel chroma shift after the port.
* The 4.x image `views` list becomes one optional `view` (`ViewTransform`:
  offset and scale in normalized framebuffer units). An image layer cannot be
  drawn several times or with a 3D matrix.

5.x image layers accept host or CUDA memory, padded rows, and NV12 planes at any
offset. Frames may be any size up to `max_width` and `max_height`, subject to
chroma alignment: `kNV12` needs an even width and height, and `kYUYV422` needs
an even width but allows an odd height. The declared maximums follow the same
rules. For example, NV12 rejects 640 x 479 and YUYV422 rejects 639 x 479.

## Color lookup tables

The 4.x `color_lut` input type and the operator-wide `color_lut` parameter
become a `LUTLayerDesc` with its own table:

```cpp
layers.add_lut_layer("mask", viz::LUTLayerDesc{
    .max_width = 1920,
    .max_height = 1080,
    .color_lut = {{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 1.0f}},
});
```

* Each LUT layer has its own table of up to `kMaxLUTSize` (65536) entries. In
  4.x, every `color_lut` layer shared one table.
* The index tensor must be in CUDA device or managed memory. Host masks that
  4.x accepted must be copied to the device first.
* Index elements can be `uint8`, `uint16`, `uint32`, `int8`, `int16`, `int32`,
  or `float32`. An integer is the index, and a float is rounded down. Indexes
  below 0 or past the end clamp to the first or last entry.
* Set `color_lut_input = true` to replace the table at run time from the graph.
  4.x had no way to change the table after initialization.

## 2D geometry

The 4.x 2D primitive input types become a `GeometryLayerDesc` with one
`GeometryTopology`:

| 4.x `InputType` | 5.x `GeometryTopology` | Floats per primitive                                  |
| --------------- | ---------------------- | ----------------------------------------------------- |
| `LINES`         | `kLineList`            | 4: `x0, y0, x1, y1`                                   |
| `LINE_STRIP`    | `kLineStrip`           | 2 per vertex; `N` vertices draw `N - 1` segments      |
| `RECTANGLES`    | `kRectangleList`       | 4: two opposite corners                               |
| `CROSSES`       | `kCrossList`           | 3: `x, y, size`                                       |
| `OVALS`         | `kOvalList`            | 4: `x, y, rx, ry`                                     |
| `POINTS`        | No equivalent          | Draw small crosses                                    |
| `TRIANGLES`     | No equivalent          | No filled primitives; draw outlines with `kLineStrip` |

Coordinates are still normalized to \[0, 1] with the origin at the top-left
corner. Several details changed:

* **Size is required.** 4.x let crosses, ovals, and text omit their size and
  used 0.05. 5.x requires every float of every primitive.
* **Oval sizes are radii.** 4.x read the third and fourth values as the full
  width and height of the oval. 5.x reads them as radii. Halve the values when
  you port.
* **Crosses are no longer kept square.** 4.x scaled the horizontal arm by the
  window aspect ratio. 5.x applies `size` in normalized units on both axes, so a
  cross on a wide window is wider than it is tall.
* **One topology per layer.** `topologies` is a list, but only its first entry
  is drawn, and the operator logs a warning when it has more. A 4.x spec that
  mixed primitives across tensors becomes several layers.
* **Flat host coordinates.** The coordinates must be a contiguous host
  `float32` tensor with rank 1. For `N` rectangles, flatten the legacy
  `(2N, 2)` corner array to `(4N,)`, preserving the corner order. In NumPy,
  use `np.ascontiguousarray(box_coords, dtype=np.float32).reshape(-1)`.
  Declare rank 1 in the producer contract in either language. 4.x also drew
  coordinates in CUDA memory.
* **Fixed line width.** `default_line_width` is in framebuffer pixels and is
  honored on every GPU. 4.x line widths depended on an optional Vulkan feature.
  There is no `point_size`, because there are no 2D points.
* **No views.** A 2D geometry layer always covers the full framebuffer.

`color` gives every primitive in the layer one color, as in 4.x. To draw
primitives in several colors, declare one layer per color.

## Text

The 4.x `TEXT` input type took `(x, y, size)` coordinates and a fixed list of
strings set at initialization. A 5.x `TextLayerDesc` takes the strings from
each frame instead. Its input is a host `uint8` tensor of shape `{N, 16 + L}`:
each row is a `TextRunHeader` followed by up to `L` bytes of NUL-padded UTF-8
text.

* `TextRunHeader::x` and `y` are framebuffer pixels by default. Set
  `normalized_coordinates = true` to keep the 4.x \[0, 1] coordinates.
* `size_px` is the glyph height in framebuffer pixels. The 4.x `size` was a
  fraction of the window height; multiply by the framebuffer height to convert.
* Each run has its own color, packed as `0xAABBGGRR`. In 4.x, one layer used one
  color.
* `max_glyphs` bounds the text bytes in one frame.
* The built-in font is monospace and covers ASCII 32 to 127. Other bytes draw
  as `?`. The 4.x `font_path` parameter and its TrueType font support have no
  equivalent.

## Windows, displays, and headless output

| 4.x parameter                                                           | 5.x replacement                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `window_title`, `width`, `height`                                       | `WindowSinkDesc::title`, `width`, `height`. For a decorated window, each zero dimension defaults independently: width to 1280 and height to 720. 4.x defaulted to 1920 x 1080.                                                                                   |
| `fullscreen`, `display_name`                                            | `WindowSinkDesc::fullscreen` and `display_name` (the exact monitor name), plus `refresh_hz`. With fullscreen enabled, either dimension set to zero selects the monitor's current video mode. `FullscreenWindowDisplayOp` shows a single image stream fullscreen. |
| `vsync`                                                                 | `present_mode`. The default `PresentMode::kAuto` never tears. For the uncapped 4.x default (`vsync = false`), request `kMailbox`, or `kImmediate` if tearing is acceptable.                                                                                      |
| `framebuffer_srgb`                                                      | `framebuffer_srgb` on the window or exclusive-display sink. All layer colors must then be linear.                                                                                                                                                                |
| `use_exclusive_display`, `display_name`, `width`, `height`, `framerate` | `ExclusiveDisplaySinkDesc` with `display_name` (a substring of the DRM connector name, such as `DP-2`), `width`, `height`, and `refresh_hz`. `DirectDisplayOp` shows a single image stream.                                                                      |
| `display_color_space`                                                   | No equivalent. Output is SDR.                                                                                                                                                                                                                                    |
| `headless`, `enable_render_buffer_output`, `allocator`                  | `CudaSinkDesc` with `width`, `height`, and `format`. Frames arrive on the `output` port as `schema::ImageT` from a runtime pool.                                                                                                                                 |
| `enable_depth_buffer_output`                                            | No equivalent                                                                                                                                                                                                                                                    |
| `enable_render_buffer_input`, `enable_depth_buffer_input`               | No equivalent. The operator owns its render targets.                                                                                                                                                                                                             |
| `cuda_stream_pool`                                                      | No parameter. The runtime provides the activation stream.                                                                                                                                                                                                        |

Exclusive display now uses the Linux DRM interface only. 4.x could take a
monitor from a running X server; in 5.x, no X server or Wayland compositor may
hold the GPU. See
[Enable exclusive display](/holoscan/sdk-user-guide/setup/additional-setup/exclusive-display).

In 4.x, `enable_render_buffer_output` exposed the rendered framebuffer in
both windowed and headless applications. To migrate an application that
displays and records the same frame, render into a `CudaSinkDesc` and connect
`output` to a `WindowDisplayOp` and to the recorder or other consumers.

The CUDA sink output supports `kR8Unorm`, `kR8G8B8A8Unorm`, `kB8G8R8A8Unorm`,
their sRGB variants, `kR16Unorm`, and `kR16G16B16A16Unorm`. The deployment must
bind the output's CUDA device with
`CompileOptions::deployment.bind_tensor_output_device`. When the consumer still
holds every pooled buffer, the operator drops that frame instead of waiting.

## Timing

A 4.x `HolovizOp` ran when its conditions allowed, and every tensor named in
`tensors` had to be present on every call, or `compute()` raised an error. 5.x
replaces this with a declared trigger:

* `LayerTrigger` (the default, layer 0) draws one frame for each sample on the
  named layer. Name the layer by index, by name, or by handle.
* `ClockTrigger` offers render opportunities at a fixed period, 60 Hz by
  default. Input admission still decides whether an opportunity runs
  `compute()`. With a lone image layer, a stopped producer eventually exhausts
  the `max_input_age` hold and stops activations, including window-event
  polling. A clock trigger is not an independent window-event pump.
* `HolovizOpOptions::max_input_age` (default 100 ms) bounds how old the other
  layers' samples may be. A layer with no new sample draws its last one again
  until it is older than this bound.

Tensor contracts and frame-content checks have different outcomes. A producer
that declares an incompatible element type, rank, or memory location is
rejected when the graph is built or compiled. A delivered tensor that violates
a port contract can end the session with `kProtocolError`. This applies to
image inputs, host rank-1 `float32` geometry, host rank-2 `uint8` text, and the
optional host rank-2 `float32` color-table input.

Content checks happen after those contracts are satisfied. For example, a
host rank-2 byte text tensor with rows shorter than the 16-byte header is
logged and skipped for that activation; it does not end the session. The LUT
mask input checks its accepted element types, shapes, and device residency
inside the operator. Validate or filter samples before emission when your
application needs to drop contract-invalid data and continue.

Side-layer samples must carry a genuine capture timestamp comparable to the
trigger in the graph's clock domain. Preserve the image acquisition time on
derived overlays with `EmitOptions::capture_time` in C++ or
`EmitOptions.capture_time` in Python. Increasing `max_input_age` cannot make an
unstamped sample eligible.

Use depth-one, drop-oldest mailboxes for the trigger and overlay edges, as in
the worked examples, so a slow display or a faster overlay producer does not
build a queue of old samples. See
[Temporal contract](/holoscan/sdk-user-guide/modules/visualization#temporal-contract).

These 4.x timing features have no equivalent:

* `FirstPixelOutCondition` and `PresentDoneCondition`. No operator-level
  condition waits for presentation.
* The `HOLOSCAN_HOLOVIZ_MUTEX` multiprocess lock and the
  `holoviz_multiprocess_mutex_path` and `multiprocess_framedrop_waittime_ms`
  parameters.

## Window events and user interface

* **Closing the window.** A `HolovizOp` activation that observes a window-close
  event requests a cooperative stop of the whole session. This replaces
  `window_close_condition`, `window_close_scheduling_term`, and
  `interrupt_app_on_window_close`. If input admission prevents further
  activations, the operator cannot observe the event. Handle camera outages
  and application-owned shutdown through `RunSession.request_stop()` or the
  corresponding C++ session API; a clock trigger alone does not guarantee
  close-button handling during a stall.
* **Escape key.** 4.x closed the window on Escape. 5.x does so only when
  `WindowSinkDesc::close_on_escape` is `true`.
* **Input callbacks.** `key_callback`, `unicode_char_callback`,
  `mouse_button_callback`, `scroll_callback`, `cursor_pos_callback`,
  `framebuffer_size_callback`, `window_size_callback`, and
  `window_close_callback` have no equivalent. The `HolovizOp` window does not
  pass mouse or keyboard input to the application.
* **ImGui and custom drawing.** `layer_callback`, which let an application add
  layers or ImGui widgets inside the `HolovizOp` frame, has no equivalent.
  `ImGuiOp` (C++ only) shows one image stream in its own window and calls your
  callback to draw Dear ImGui widgets over each frame. To keep the `HolovizOp`
  layers under the widgets, render `HolovizOp` into a `CudaSinkDesc` with
  `kR8G8B8A8Unorm` and connect its `output` to an `ImGuiOp`. See
  [ImGuiOp](/holoscan/sdk-user-guide/modules/visualization#imguiop).

## The `viz::` library

The 4.x `holoviz` module exposed an immediate-mode API: `viz::Init`, `Begin`
and `End`, layer calls such as `ImageCudaDevice`, `ImageHost`, `LUT`,
`Primitive`, `PrimitiveCudaDevice`, `Text`, and `DepthMap`, and helpers such as
`ReadFramebuffer`, `SetCamera`, `GetCameraPose`, `SetFont`, `WaitForPresent`,
and `GetVBlankCounter`.

5.x has no public replacement. The HoloViz rendering interface below the
operators installs its headers, but it is internal: it has no source or ABI
compatibility promise and can change in any release. Port custom drawing to
`HolovizOp` layers and the display operators. If your 4.x application relies
on a `viz::` feature that the operators do not provide, please describe your use
case on the
[Holoscan SDK support forum](https://forums.developer.nvidia.com/c/robotics-edge-computing/holoscan/757)
so that the Holoscan team can consider it for a future release. See
[Support and Contributing](/holoscan/sdk-user-guide/resources/support-and-contributing)
for issue-reporting and contribution guidance.

## Python

The Python operator takes typed dataclasses from
`holoscan_visualization.operators` instead of `InputSpec` dictionaries:

```python
# Holoscan SDK 4.x
visualizer = HolovizOp(
    self,
    name="holoviz",
    width=854,
    height=480,
    tensors=[
        dict(name="", type="color"),
        dict(name="boxes", type="rectangles", color=[1.0, 0.0, 1.0, 0.5], line_width=2),
    ],
)
self.add_flow(source, visualizer, {("output", "receivers")})
self.add_flow(detector, visualizer, {("outputs", "receivers")})
```

```python
# Holoscan SDK 5.x
import holoscan as hs
from holoscan_visualization.operators import (
    GeometryLayer,
    GeometryTopology,
    HolovizOp,
    ImageFormat,
    ImageLayer,
    WindowSink,
)

viz = HolovizOp(
    graph,
    "holoviz",
    layers=[
        ImageLayer(
            port_name="video",
            format=ImageFormat.RGBA8_UNORM,
            max_width=854,
            max_height=480,
        ),
        GeometryLayer(
            port_name="boxes",
            topologies=[GeometryTopology.RECTANGLE_LIST],
            max_primitives=64,
            default_line_width=2.0,
            color=(1.0, 0.0, 1.0, 0.5),
        ),
    ],
    sink=WindowSink(title="Holoviz", width=854, height=480),
)
mailbox = dict(queue_policy=hs.QueuePolicy.DROP_OLDEST, queue_depth=1)
graph.add_flow(source.frame, viz.video, **mailbox)
graph.add_flow(detector.boxes, viz.boxes, **mailbox)
graph.partition("holoviz").add(viz)
```

As in the C++ listing, `graph`, `source`, and `detector` are omitted setup.
The detector emits a contiguous host `float32` tensor with shape `(4N,)` for
`N` rectangles and declares rank 1. Flatten a legacy coordinate array with
`np.ascontiguousarray(box_coords, dtype=np.float32).reshape(-1)`. Pass the
source image's acquisition time in `hs.EmitOptions(capture_time=...)` when
emitting the boxes, using the graph's admitted clock domain. This lets the
side-layer selector pair the overlay with the video.

The other declarations follow the same pattern: `TextLayer`, `LutLayer`,
`ViewTransform`, `ExclusiveDisplaySink`, `CudaSink`, `LayerTrigger`, and
`ClockTrigger`. Pass `trigger` and `max_input_age` as keyword arguments. Callbacks have no Python equivalent, and
`ImGuiOp` is not available from Python.

## 4.x features with no 5.x equivalent

This table lists every 4.x Holoviz feature that 5.1 does not provide, with the
closest alternative.

| 4.x feature                                                                                            | Alternative in 5.x                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Adding, removing, or changing layers at run time (`input_specs`)                                       | Declare every layer up front. Drive `LayerTrigger` from a continuously supplied layer, such as the video. An optional geometry, text, or LUT side layer with no sample newer than `max_input_age` is skipped, so stop sending to it and it disappears on the next admitted frame. If the layer you stop drives `LayerTrigger`, no new frame is rendered: the view freezes on the last frame with that layer still visible. |
| Format auto-detection (`InputType::UNKNOWN`, `ImageFormat::AUTO_DETECT`)                               | Declare each layer's kind and format.                                                                                                                                                                                                                                                                                                                                                                                      |
| More than 8 layers in one operator                                                                     | Chain `HolovizOp` instances: render lower layers into an RGBA8 `CudaSinkDesc`, use that output as the next stage's first image layer, and add up to seven further layers above it.                                                                                                                                                                                                                                         |
| 2D points and triangles                                                                                | Small crosses for points; line outlines for triangles                                                                                                                                                                                                                                                                                                                                                                      |
| Several topologies in one 2D layer                                                                     | One layer per topology                                                                                                                                                                                                                                                                                                                                                                                                     |
| 2D geometry in CUDA memory                                                                             | Copy the coordinates to host memory                                                                                                                                                                                                                                                                                                                                                                                        |
| Optional cross, oval, and text sizes                                                                   | Send every value                                                                                                                                                                                                                                                                                                                                                                                                           |
| Several views or a matrix for 2D layers                                                                | One `ViewTransform` for image and LUT layers; none for 2D geometry and text                                                                                                                                                                                                                                                                                                                                                |
| Float, signed, 32-bit integer, packed 10-bit, UYVY, 3-plane, and 16-bit YUV image formats              | Convert to a supported format before the layer                                                                                                                                                                                                                                                                                                                                                                             |
| YUV chroma location                                                                                    | None; chroma is reconstructed at the sample center                                                                                                                                                                                                                                                                                                                                                                         |
| Component swizzle (`viz::ImageComponentMapping`)                                                       | Reorder channels before the layer                                                                                                                                                                                                                                                                                                                                                                                          |
| 3D geometry (`POINTS_3D`, `LINES_3D`, `LINE_STRIP_3D`, `TRIANGLES_3D`)                                 | None. Project the points to 2D in your application and draw them as 2D geometry.                                                                                                                                                                                                                                                                                                                                           |
| Depth maps (`DEPTH_MAP`, `DEPTH_MAP_COLOR`, `depth_map_render_mode`)                                   | None. Show the depth image as an `R8` or `R16` image or LUT layer.                                                                                                                                                                                                                                                                                                                                                         |
| The 3D camera (`camera_eye`, `camera_look_at`, `camera_up`, their input ports, and camera pose output) | None                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Image layers with a depth image for 3D compositing                                                     | None                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Depth buffer output (`enable_depth_buffer_output`)                                                     | None                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Several colors in one 2D geometry layer                                                                | One layer per color                                                                                                                                                                                                                                                                                                                                                                                                        |
| HDR output (`display_color_space`)                                                                     | None                                                                                                                                                                                                                                                                                                                                                                                                                       |
| TrueType fonts (`font_path`)                                                                           | Built-in monospace ASCII font                                                                                                                                                                                                                                                                                                                                                                                              |
| Key, mouse, scroll, and window callbacks                                                               | None                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `layer_callback` and ImGui inside the `HolovizOp` window                                               | `HolovizOp` with `CudaSinkDesc` feeding `ImGuiOp` (C++ only)                                                                                                                                                                                                                                                                                                                                                               |
| `window_close_callback` and a window close that does not stop the application                          | None; an activation that observes a window-close event requests a cooperative session stop                                                                                                                                                                                                                                                                                                                                 |
| User-supplied render and depth buffers                                                                 | None; the operator renders into its own targets and emits pooled images                                                                                                                                                                                                                                                                                                                                                    |
| Exclusive display while an X server is running                                                         | Stop the display server, or use `WindowSinkDesc::fullscreen`                                                                                                                                                                                                                                                                                                                                                               |
| `FirstPixelOutCondition` and `PresentDoneCondition`                                                    | None                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Multiprocess display lock (`HOLOSCAN_HOLOVIZ_MUTEX`)                                                   | None                                                                                                                                                                                                                                                                                                                                                                                                                       |
| The `viz::` immediate-mode library                                                                     | Use the operators                                                                                                                                                                                                                                                                                                                                                                                                          |
| Python callbacks                                                                                       | None                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Recap

* A 4.x tensor-name `InputSpec` becomes a typed layer on a `LayerStack`, with
  its own input port and a declared maximum size.
* Image producers emit `schema::ImageT`, and each image layer declares its
  format and color space.
* 2D geometry has one topology and one color per layer, host coordinates,
  required sizes, and oval radii instead of diameters. Points and triangles
  have no equivalent.
* Text strings, positions, and colors come from each frame.
* Sinks replace the window, exclusive-display, and headless parameters. The CUDA
  sink can feed a display and other consumers at the same time.
* Triggers and `max_input_age` replace conditions. An activation that observes
  a window-close event requests a cooperative session stop; input stalls can
  prevent that activation.
* 3D geometry, depth maps, the 3D camera, callbacks, in-window ImGui, HDR,
  present conditions, and the `viz::` library have no 5.1 equivalent.