atlas_gui package¶
Subpackages¶
- atlas_gui.datasets package
- atlas_gui.utils package
Submodules¶
atlas_gui.gui module¶
- class ActionDialog(*args, **kwargs)[source]¶
Bases:
QDialogA custom Qt dialog for selecting an action label and success flag during annotation.
This dialog is used in ATLAS to collect a user-defined label and a success boolean for a low-level action during video annotation.
Features: - Displays a key-action map to guide the user (e.g., 1: Approach, 2: Grasp, etc.). - Allows manual input of an action name. - Lets the user toggle a success flag via a checkbox or Space key. - Returns the chosen action name and success state when accepted.
- Parameters:
parent (QWidget, optional) – Parent widget. Defaults to None.
action_map (dict, optional) – A mapping from Qt key codes to action label strings.
- Key Bindings:
Number keys (1–9): Set corresponding action label based on action_map.
Space key: Toggle success flag checkbox.
- keyPressEvent(event)[source]¶
Handle key press events to enable quick interaction.
If a key in action_map is pressed, its corresponding action label is populated.
If the space key is pressed, the success checkbox is toggled.
Other keys are passed to the base class implementation.
- Parameters:
event (QKeyEvent) – The Qt key event.
- class EditableAnnotationWidget(*args, **kwargs)[source]¶
Bases:
QWidgetA widget that allows editing an individual annotation.
Provides UI elements for editing the label, start time, end time, and success flag, as well as buttons to save, cancel, or delete the annotation.
- Parameters:
annotation_id (int) – Unique identifier for the annotation.
annotation (dict) – Annotation data containing ‘label’, ‘start’, ‘end’, ‘success’, and ‘color’.
parent (QWidget, optional) – Parent widget.
- class SegmentedVideoAnnotator(*args, **kwargs)[source]¶
Bases:
QMainWindowMain GUI class for interactive annotation of segmented video data.
Provides tools to: - Visualize synchronized video and sensor streams. - Navigate and annotate segments. - Interact with multiple data formats (e.g., REASSEMBLE, RLDS). - Save and load annotation metadata.
- Parameters:
config (dict) – Configuration dictionary specifying keys, dataset type, camera keys, key bindings, and visual settings.
- setup_ui()[source]¶
Constructs the full user interface, including: - Video displays for multiple cameras. - Data selector for numeric streams. - Plots, timeline slider, and action label. - Scrollable timeline widget. - Control buttons and status bar.
- setup_controls(layout)[source]¶
Adds core controls to the GUI for: - Loading data. - Playback (play/pause). - Displaying current time. - Starting, ending, and deleting annotations.
- Parameters:
layout (QLayout) – Layout object to which the controls are added.
- setup_segment_controls(layout)[source]¶
Adds segment-level controls to the GUI for: - Navigating between segments (previous, next). - Jumping to a segment by index. - Saving annotations for the current segment.
- Parameters:
layout (QLayout) – Layout object to which the controls are added.
- create_annotation_widget(annotation_id, annotation)[source]¶
Create a QPushButton widget to visually represent an annotation in the timeline.
- Parameters:
annotation_id (int) – Unique identifier for the annotation.
annotation (dict) – Annotation data including ‘start’, ‘end’, ‘label’, ‘success’, and ‘color’.
- Returns:
A clickable and context-sensitive button widget for the annotation.
- Return type:
QPushButton
Display a context menu with options to edit or delete the annotation.
- Parameters:
pos (QPoint) – Position of the context menu trigger.
annotation_id (int) – ID of the annotation for which the menu is shown.
- edit_annotation(annotation_id)[source]¶
Replace the annotation widget in the timeline with an editable form.
Maintains the visual order of annotations and ensures only one is editable at a time.
- Parameters:
annotation_id (int) – ID of the annotation to edit.
- update_annotation(annotation_id, new_annotation)[source]¶
Update the internal annotation dictionary and refresh the UI.
- Parameters:
annotation_id (int) – ID of the annotation to update.
new_annotation (dict) – The updated annotation values.
- delete_annotation(annotation_id)[source]¶
Delete an annotation from the internal storage and update the timeline and plots.
- Parameters:
annotation_id (int) – ID of the annotation to delete.
- show_error_message(message)[source]¶
Display an error message in the status bar with red-colored text.
- Parameters:
message (str) – The message to display.
- keyPressEvent(event)[source]¶
Handle key press events for playback, navigation, annotation, and scrubbing.
- Parameters:
event (QKeyEvent) – The key event triggered by the user.
- load_data()[source]¶
Load the dataset. If download mode is enabled (RLDS), auto-downloads. Otherwise prompts user to select a dataset path. Initializes segment index, updates segment info, and prepares UI.
- load_current_segment()[source]¶
Load the current segment’s data and annotations. Updates visual elements, plots, timeline, and internal state for playback and annotation.
- update_data_selectors()[source]¶
Update the scrollable list of checkboxes for selecting which numerical data fields to visualize. This is based on the config-defined low_level_keys.
- update_segment_info()[source]¶
Update the segment info label to reflect the current segment index and total count.
- save_segment_annotations()[source]¶
Save current segment’s annotations to the dataset using absolute timestamps. Sorts annotations by start time before saving.
- load_segment_annotations()[source]¶
Load annotations for the current segment and prepare internal storage. Assign colors and update annotation IDs accordingly.
- jump_to_segment()[source]¶
Jump to a user-specified segment index entered in the text box. Validates the index and loads the corresponding segment if valid.
- on_data_selection_changed()[source]¶
Update the list of selected numerical data fields and refresh plots when checkboxes are toggled.
- slider_changed()[source]¶
Update the current time in seconds based on the slider position. Refresh the video frame accordingly.
- toggle_annotation()[source]¶
Start or end an annotation interval. On ending, shows a dialog to input action label and success flag, then stores the annotation and updates the UI.
- delete_last_annotation()[source]¶
Delete the most recent annotation and free up its color. Updates the timeline and plots accordingly.
- find_nearest_frame_index(timestamps, target_time)[source]¶
Find the index of the timestamp closest to the target time.
- Parameters:
timestamps (list or np.ndarray) – Sorted list of timestamps.
target_time (float) – Target time in seconds.
- Returns:
Index of the nearest timestamp, or None if unavailable.
- Return type:
int or None
- update_frame()[source]¶
Update the video display and timeline slider based on the current time. Refreshes frames for all camera views and updates plots.
- display_frame(index, frame)[source]¶
Display a given frame in the specified video label.
- Parameters:
index (int) – Index of the video label.
frame (np.ndarray) – Frame image as a numpy array (grayscale or color).
- scrub_video(delta)[source]¶
Move the video playback time forward or backward by a given delta.
- Parameters:
delta (float) – Amount in seconds to move the playback position.
- update_plots()[source]¶
Update the numerical data plots based on selected data fields.
Includes: - Plotting of new data - Drawing vertical playback line - Displaying annotation regions - Handling single/multi-dimensional data - Adjusting to dynamic plot count and layout
- update_annotation_bar()[source]¶
Update the annotation overview bar with colored regions for each annotation, a playback position line, and the active recording region.
- update_timeline()[source]¶
Rebuild the timeline widget with current annotations.
Removes old widgets and creates new annotation widgets in sorted order based on annotation start times.