Track trail and track list overlays.

class sleap.gui.overlays.tracks.TrackListOverlay(labels: = None, player: = None, text_box: Optional[] = None)[source]

Class to show track number and names in overlay.

add_to_scene(video:, frame_idx: int)[source]

Adds track list as overlay on video.

property visible

Gets or set whether overlay is visible.

class sleap.gui.overlays.tracks.TrackTrailOverlay(labels: = None, player: = None, trail_length: int = 0, show: bool = True, max_node_count: Optional[int] = None)[source]

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.


The Labels dataset from which to get overlay data.


The video player in which to show overlay.


The maximum number of frames to include in trail.


After class is instantiated, call add_to_scene(frame_idx)() to plot the trails in scene.

add_to_scene(video:, frame_idx: int)[source]

Plot the trail on a given frame.

  • video – current video

  • frame_idx – index of the frame to which the trail is attached

get_frame_selection(video:, frame_idx: int)[source]

Return LabeledFrame objects to include in trail for specified frame.

get_track_trails(frame_selection: Iterable[LabeledFrame])[source]

Get data needed to draw track trail.


frame_selection – an iterable with the LabeledFrame objects to include in trail.


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

get_tracks_in_frame(video:, frame_idx: int, include_trails: bool = False) → List[sleap.instance.Track][source]

Returns list of tracks that have instance in specified frame.

  • video – Video for which we want tracks.

  • frame_idx – Frame index for which we want tracks.

  • include_trails – Whether to include tracks which aren’t in current frame but would be included in trail (i.e., previous frames within trail_length).


List of tracks.

static map_to_qt_path(point_list)[source]

Converts a list of (x, y)-tuples to a QPainterPath.