tracks
sleap.gui.overlays.tracks
¶
Track trail and track list overlays.
Classes:
| Name | Description |
|---|---|
TrackListOverlay |
Class to show track number and names in overlay. |
TrackTrailOverlay |
Class to show track trails as overlay on video frame. |
TrackListOverlay
¶
Bases: BaseOverlay
Class to show track number and names in overlay.
Methods:
| Name | Description |
|---|---|
add_to_scene |
Adds track list as overlay on video. |
Attributes:
| Name | Type | Description |
|---|---|---|
visible |
Gets or set whether overlay is visible. |
Source code in sleap/gui/overlays/tracks.py
visible
property
writable
¶
Gets or set whether overlay is visible.
add_to_scene(video, frame_idx)
¶
Adds track list as overlay on video.
Source code in sleap/gui/overlays/tracks.py
TrackTrailOverlay
¶
Bases: BaseOverlay
Class to show track trails as overlay on video frame.
Initialize this object with both its data source and its visual output scene, and it handles both extracting the relevant data for a given frame and plotting it in the output.
Attributes:
| Name | Type | Description |
|---|---|---|
labels |
Labels | None
|
The :class: |
player |
QtVideoPlayer | None
|
The video player in which to show overlay. |
trail_length |
int
|
The maximum number of frames to include in trail. |
trail_shade |
str
|
A literal "Dark", "Normal", or "Bright" which determines the shade of the trail color. |
Usage
After class is instantiated, call :meth:add_to_scene(frame_idx)
to plot the trails in scene.
Methods:
| Name | Description |
|---|---|
__attrs_post_init__ |
Initialize the shade options attribute after initalizing the instance. |
add_to_scene |
Plot the trail on a given frame. |
get_frame_selection |
Return |
get_shade_options |
Return a dictionary with values to multiply each RGB value by. |
get_track_trails |
Get data needed to draw track trail. |
get_tracks_in_frame |
Returns list of tracks that have instance in specified frame. |
map_to_qt_path |
Converts a list of (x, y)-tuples to a |
Source code in sleap/gui/overlays/tracks.py
17 18 19 20 21 22 23 24 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
__attrs_post_init__()
¶
add_to_scene(video, frame_idx)
¶
Plot the trail on a given frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
Video
|
current video |
required |
frame_idx
|
int
|
index of the frame to which the trail is attached |
required |
Source code in sleap/gui/overlays/tracks.py
get_frame_selection(video, frame_idx)
¶
Return LabeledFrame objects to include in trail for specified frame.
Source code in sleap/gui/overlays/tracks.py
get_shade_options()
classmethod
¶
get_track_trails(frame_selection)
¶
Get data needed to draw track trail.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame_selection
|
Iterable[LabeledFrame]
|
an iterable with the :class: |
required |
Returns:
| Type | Description |
|---|---|
Optional[Dict[Track, List[List[Tuple[float, float]]]]]
|
Dictionary keyed by track, value is list of lists of (x, y) tuples i.e., for every node in instance, we get a list of positions |
Source code in sleap/gui/overlays/tracks.py
get_tracks_in_frame(video, frame_idx, include_trails=False)
¶
Returns list of tracks that have instance in specified frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
Video
|
Video for which we want tracks. |
required |
frame_idx
|
int
|
Frame index for which we want tracks. |
required |
include_trails
|
bool
|
Whether to include tracks which aren't in current frame but would be included in trail (i.e., previous frames within trail_length). |
False
|
Source code in sleap/gui/overlays/tracks.py
map_to_qt_path(point_list)
staticmethod
¶
Converts a list of (x, y)-tuples to a QPainterPath.