ouster.sdk.viz.model module

Copyright (c) 2021, Ouster, Inc. All rights reserved.

Types for managing visualization state.

class ZoneSelectionMode(value)[source]

Bases: Enum

An enumeration.

NONE = 0
LIVE = 1
ALL = 2
class ZoneRenderMode(value)[source]

Bases: Enum

An enumeration.

STL = 0
CLOUDS = 1
STL_AND_CLOUDS = 2
VOXEL_MESH = 3
class ImgModeItem(mode, name, return_num=0)[source]

Bases: object

Image mode for specific return with explicit name.

mode: ImageMode
name: str
return_num: int = 0
class VizExtraMode(func)[source]

Bases: object

Image/Cloud mode factory func

Used to embed viz modes from external plugins.

func: Callable[[], Union[ImageCloudMode, ImageMode, CloudMode]]
create(info=None)[source]
Return type:

Union[ImageCloudMode, ImageMode, CloudMode]

class Palettes(_ext_palettes)[source]

Bases: object

Represents the color palettes used within an instance of LidarScanViz. Also keeps track of the palette currently in use.

Initialize a Palettes object, which populates two lists of palettes - one for normal view modes and one for ReflMode.

set_palette(index)[source]

Set the current palette index.

Return type:

None

cycle_cloud_palette(direction)[source]

Updates the current palette to use.

Return type:

None

get_palette(cloud_mode)[source]

Gets the current color palette depending on the view mode.

Return type:

CloudPaletteItem

get_palette_by_name(name)[source]
Return type:

CloudPaletteItem

triggered_live_zone_color(palette, zone_id)[source]
class Selection2d(p1, p2, sensor_index, sensor, image_index, image)[source]

Bases: object

property sensor
property finalized
finalize()[source]
property p1
property p2
property area: int

Calculates and returns the area of the rectangular selection.

The area is calculated as the absolute difference between the x and y coordinates, ensuring a positive result regardless of the points’ order.

class SensorModel(viz, meta, *, _img_aspect_ratio=0, palettes=<ouster.sdk.viz.model.Palettes object>)[source]

Bases: object

A model object representing viz state for a single sensor.

update_cloud_palettes(cloud_mode_name)[source]

Sets each cloud palette given the cloud mode name. Has no effect if the cloud mode is not available for this sensor.

Return type:

None

update_cloud(cloud, cloud_mode, range_field, return_num, scan)[source]

Updates the given Cloud with the given CloudMode.

Return type:

None

update_clouds(cloud_mode_name, scan)[source]

Update range and mode for each cloud given a mode name and a scan.

Return type:

None

update_image(image, image_mode_item, scan)[source]

Update the view mode of the given image.

Return type:

None

update_images(image_mode_names, scan)[source]

Update image values and mode given mode names and a scan.

Return type:

None

update_zones(scan=None)[source]
Return type:

None

update_zone_occupancy_cloud_and_image_masks(scan, palettes)[source]
hide_all_zone_geometry()[source]
set_zone_selection_and_render_mode(selection_mode, render_mode)[source]
class LidarScanVizModel(viz, metas, *, _img_aspect_ratio)[source]

Bases: object

property metadata: List[SensorInfo]

Metadatas for the displayed sensors.

update_cloud_palette_name()[source]

Gets the name of the palette used for the point clouds.

update_cloud_palettes()[source]

Updates the point clouds to use the currently-selected palette.

sorted_cloud_mode_names()[source]

Returns all the cloud mode names.

sorted_image_mode_names()[source]

Returns the image mode names, limited to those for fields we’ve seen in at least one LidarScan.

select_cloud_mode(name)[source]

Updates the currently selected cloud mode from the list of all available cloud modes. Returns false if the requested mode is not available.

Return type:

bool

cycle_cloud_mode(direction)[source]

Updates the currently selected cloud mode from the list of all available cloud modes.

select_image_mode(i, name)[source]

Updates the currently selected image mode from the list of all available cloud modes. Returns false if the requested mode is not available.

Return type:

bool

cycle_image_mode(i, direction)[source]

Updates the currently selected image mode from the list of all available cloud modes.

update(scans)[source]

Update the LidarScanViz state with the provided scans.

Return type:

None

clear_masks()[source]
clear_aoi()[source]
image_and_pixel_for_viewport_coordinate(ctx, x, y)[source]
mouse_button_handler(ctx, button, event, mods)[source]
Return type:

bool

update_aoi(ctx=None)[source]
mouse_pos_handler(ctx, x, y)[source]
Return type:

bool

update_aoi_label(scans)[source]
flip_images(flip)[source]
Return type:

None

toggle_flip_images()[source]
Return type:

None

show_one_image(do)[source]
Return type:

None

update_image_size(amount)[source]

Change the size of the 2D image and position image labels.

Return type:

None