nicetoolbox.visual.media.viewer.Viewer¶
- class nicetoolbox.visual.media.viewer.Viewer(visualizer_config: dict)[source]¶
Bases:
objectClass for visualizing the components.
- config¶
Configuration settings for the viewer.
- Type:
dict
Initializes the Viewer class with the given configuration.
- Parameters:
config (dict) – Configuration settings for the viewer.
Methods
Checks the consistency of the multi-view parameter in the visualizer config.
Generates the entity path for a given component.
Returns the entity path for the camera position.
Returns the end frame for visualization specified in the visualizer config.
Returns the entity path for the images of a specific camera.
Returns a boolean indicating whether to display the camera position in the viewer.
Returns the start frame for visualization specified in the visualizer config.
Returns the frame step size for visualization specified in the visualizer config.
Returns the start time of the video in seconds.
Go to the specified frame index in the rerun viewer.
Logs the camera calibration in the viewer.
Logs an image in the viewer.
Spawns a rerun application with the given app_id.
- check_multiview() None[source]¶
Checks the consistency of the multi-view parameter in the visualizer config.
- Raises:
ValueError – If the multi-view parameter is set to False but a 3D canvas is present.
- generate_component_entity_path(component: str, is_3d: bool = True, cam_name: str | None = None, alg_name: str | None = None, subject_name: str | None = None, bodypart: str | None = None) str[source]¶
Generates the entity path for a given component.
- Parameters:
component (str) – The name of the component.
is_3d (bool, optional) – Flag indicating if the component is 3D. Defaults to True.
cam_name (str, optional) – The name of the camera. Defaults to None.
alg_name (str, optional) – The name of the algorithm. Defaults to None.
subject_name (str, optional) – The name of the subject. Defaults to None.
bodypart (str, optional) – The name of the body part. Defaults to None.
- Returns:
The generated entity path.
- Return type:
str
- Raises:
ValueError – If the component is not implemented.
- get_camera_pos_entity_path(camera_name: str) str[source]¶
Returns the entity path for the camera position.
- Parameters:
camera_name (str) – The name of the camera.
- Returns:
The entity path for the camera position.
- Return type:
str
- get_end_frame() int[source]¶
Returns the end frame for visualization specified in the visualizer config.
- Returns:
The end frame for visualization.
- Return type:
int
- get_images_entity_path(camera_name)[source]¶
Returns the entity path for the images of a specific camera.
- Parameters:
camera_name (str) – The name of the camera.
- Returns:
The entity path for the images of the specified camera.
- Return type:
str
- get_is_camera_position()[source]¶
Returns a boolean indicating whether to display the camera position in the viewer.
- Returns:
Whether to display the camera position in the viewer.
- Return type:
bool
- get_start_frame()[source]¶
Returns the start frame for visualization specified in the visualizer config.
- Returns:
The start frame for visualization.
- Return type:
int
- get_step() int[source]¶
Returns the frame step size for visualization specified in the visualizer config.
Only every step-th frame will be visualized.
- Returns:
The step for visualization.
- Return type:
int
- get_video_start() int[source]¶
Returns the start time of the video in seconds.
- Returns:
The start time of the video in seconds.
- Return type:
int
- go_to_timestamp(frame_idx: int) None[source]¶
Go to the specified frame index in the rerun viewer.
- Parameters:
frame_idx (int) – The index of the frame to go to.
- log_camera(camera_calibration, entity_path) None[source]¶
Logs the camera calibration in the viewer.
- Parameters:
camera_calibration (dict) – The camera calibration parameters.
entity_path (str) – The entity path for the camera.