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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
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
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
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
77 78 79 80 81 82 83 | |
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.
Source code in sleap/gui/overlays/base.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |