robokudo.cas

Common Analysis Structure (CAS) for RoboKudo.

This module provides the core data structure used throughout RoboKudo for storing and managing data during pipeline execution. The CAS (Common Analysis Structure) holds sensor data, annotations, and other information that is shared between annotators.

The module provides:

  • Standard view definitions for common data types

  • Methods for storing and retrieving data

  • Support for annotations and filtering

  • Timestamp management

Classes

CASViews

Standard view definitions for the Common Analysis Structure.

CAS

The main data representation in RoboKudo.

Module Contents

class robokudo.cas.CASViews

Standard view definitions for the Common Analysis Structure.

This class defines the standard keys used to store and access different types of data in the CAS. These keys ensure consistent access to common data types like images, point clouds, and camera information.

Variables:
  • COLOR_IMAGE – RGB image data

  • DEPTH_IMAGE – Depth image data

  • COLOR2DEPTH_RATIO – Scale factors to match color and depth image resolutions

  • CAM_INFO – ROS camera info message

  • CAM_INTRINSIC – Open3D pinhole camera intrinsic model for RGB

  • PC_CAM_INTRINSIC – Camera intrinsic used for point cloud generation

  • CLOUD – Point cloud data

  • CLOUD_ORGANIZED – Organized point cloud data

  • TIMESTAMP – CAS creation timestamp

  • QUERY – Query information

  • VIEWPOINT_CAM_TO_WORLD – Camera to world transform

  • VIEWPOINT_WORLD_TO_CAM – World to camera transform

  • PLANE – Plane information (TODO: should be a plane annotation)

  • OBJECT_IMAGE – Object image data

  • OBJECT_COLOR_MAP – Object color mapping data

COLOR_IMAGE = 'color_image'
DEPTH_IMAGE = 'depth_image'
COLOR2DEPTH_RATIO = 'color2depth_ratio'
CAM_INFO = 'cam_info'
CAM_INTRINSIC = 'cam_intrinsic'
PC_CAM_INTRINSIC = 'pc_cam_intrinsic'
CLOUD = 'cloud'
CLOUD_ORGANIZED = 'cloud_organized'
TIMESTAMP = 'timestamp'
QUERY = 'query'
VIEWPOINT_CAM_TO_WORLD = 'viewpoint_cam_to_world'
VIEWPOINT_WORLD_TO_CAM = 'viewpoint_world_to_cam'
PLANE = 'plane'
OBJECT_IMAGE = 'object_image'
OBJECT_COLOR_MAP = 'object_color_map'
class robokudo.cas.CAS

The main data representation in RoboKudo.

This class provides the central data structure used by annotators to store and retrieve information. Each pipeline has its own CAS instance that maintains views (singular data like sensor readings) and annotations (multiple descriptors of the same data).

Variables:
  • timestamp – Unix timestamp when this CAS was created

  • timestamp_readable – Human readable timestamp string

  • views – Dictionary storing view data

  • annotations – List of annotations

timestamp
timestamp_readable
views
annotations = []
get(view_name: str)

Get a view by name.

Parameters:

view_name (str) – Name of the view to retrieve

Returns:

The view data

Return type:

Any

contains(view_name: str)

Check if a view exists.

Parameters:

view_name (str) – Name of the view to check

Returns:

True if the view exists

Return type:

bool

get_copy(view_name: str)

Get a deep copy of a view.

Parameters:

view_name (str) – Name of the view to copy

Returns:

Deep copy of the view data

Return type:

Any

set(view_name: str, value)

Put data in the CAS index by a given view name. This method will make a deepcopy of value.

Parameters:
  • view_name (str) – The name of the view which should be selected from constants in the CASView class.

  • value (Any) – The value that will be placed in the CAS under view_name by making a deepcopy of it.

set_ref(view_name: str, value)

Put data in the CAS index by a given view name. In contrast to set(), this will not make a copy but just does an assignment.

Parameters:
  • view_name (str) – The name of the view which should be selected from constants in the CASView class.

  • value (Any) – The value that will be placed in the CAS under view_name by making assigning it.

static filter_by_type(type_to_include, input_list)

Filter a list to include only objects of a specific type.

Parameters:
  • type_to_include (type) – Type to filter for

  • input_list (list) – List to filter

Returns:

Filtered list containing only objects of the specified type

Return type:

list

filter_annotations_by_type(type_to_include)

Filter annotations to include only those of a specific type.

Parameters:

type_to_include (type) – Type to filter for

Returns:

Filtered list of annotations

Return type:

list

static _filter_objects(objects, criteria)

Filters a list of objects based on specified criteria.

Parameters:
  • objects (list) – List of objects to be filtered.

  • criteria (dict) – A dictionary where keys are attribute names and values are tuples containing the comparison operator as a string (“==”, “>”, “<”, “>=”, “<=”) and the value to compare against.

Returns:

Filtered list of objects matching all criteria

Return type:

list

filter_by_type_and_criteria(type_to_include, input_list, criteria: dict)

Filters a list of objects based on specified criteria. Objects must be of type ‘type_to_include’

Parameters:
  • type_to_include (type) – All the returned objects must be of this type.

  • input_list (list) – List of objects to be filtered.

  • criteria (dict) – A dictionary where keys are attribute names and values are tuples containing the comparison operator as a string (“==”, “>”, “<”, “>=”, “<=”) and the value to compare against.

Returns:

A list of objects of type ‘type_to_include’ that match all specified attribute values.

Return type:

list