base
sleap.gui.overlays.base
¶
Base classes for overlays.
Overlays are used for showing additional visuals on top of a video frame (i.e.,
a QtVideoPlayer object). Overlay objects are created in the main GUI app,
which then automatically calls the add_to_scene for each loaded overlay after
drawing a frame (i.e., when user navigates to a new frame or something changes
so that current frame must be redrawn).
Classes:
| Name | Description |
|---|---|
BaseOverlay |
Abstract base class for overlays. |
BaseOverlay
¶
Bases: ABC
Abstract base class for overlays.
Most overlays need rely on the Labels from which to get data and need the
QtVideoPlayer to which a QGraphicsItem will be added, so these
attributes are included in the base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
the |
required | |
player
|
the |
required | |
items
|
stores all |
required |
Methods:
| Name | Description |
|---|---|
add_to_scene |
Add items to scene. |
redraw |
Remove all items from the scene before adding new items to the scene. |
remove_from_scene |
Remove all items added to scene by this overlay. |
Source code in sleap/gui/overlays/base.py
add_to_scene(video, frame_idx)
abstractmethod
¶
Add items to scene.
To use the remove_from_scene and redraw methods, keep track of a list of
QGraphicsItems added in this function.
Source code in sleap/gui/overlays/base.py
redraw(video, frame_idx, *args, **kwargs)
¶
Remove all items from the scene before adding new items to the scene.
This method does not need to be called when changing the plot to a new frame.
Source code in sleap/gui/overlays/base.py
remove_from_scene()
¶
Remove all items added to scene by this overlay.
This method does not need to be called when changing the plot to a new frame.