Skip to content

Commit 436b177

Browse files
keyalodingKeya Loding
and
Keya Loding
authored
Updated trail length viewing options (#1822)
* updated trail length optptions * Updated trail length options in the view menu * Updated `prefs` to include length info from `preferences.yaml` * Added trail length as method of `MainWindow` * Updated trail length documentation * black formatting --------- Co-authored-by: Keya Loding <[email protected]>
1 parent 0528362 commit 436b177

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

docs/guides/gui.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Note that many of the menu command have keyboard shortcuts which can be configur
6060

6161
"**Edge Style**" controls whether edges are drawn as thin lines or as wedges which indicate the {ref}`orientation` of the instance (as well as the direction of the part affinity field which would be used to predict the connection between nodes when using a "bottom-up" approach).
6262

63-
"**Trail Length**" allows you to show a trail of where each instance was located in prior frames (the length of the trail is the number of prior frames). This can be useful when proofreading predictions since it can help you detect swaps in the identities of animals across frames.
63+
"**Trail Length**" allows you to show a trail of where each instance was located in prior frames (the length of the trail is the number of prior frames). This can be useful when proofreading predictions since it can help you detect swaps in the identities of animals across frames. By default, you can only select trail lengths of up to 250 frames. You can use a custom trail length by modifying the default length in the `preferences.yaml` file. However, using trail lengths longer than about 500 frames can result in significant lag.
6464

6565
"**Fit Instances to View**" allows you to toggle whether the view is auto-zoomed to the instances in each frame. This can be useful when proofreading predictions.
6666

sleap/gui/app.py

+3
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def __init__(
151151
self.state["edge style"] = prefs["edge style"]
152152
self.state["fit"] = False
153153
self.state["color predicted"] = prefs["color predicted"]
154+
self.state["trail_length"] = prefs["trail length"]
154155
self.state["trail_shade"] = prefs["trail shade"]
155156
self.state["marker size"] = prefs["marker size"]
156157
self.state["propagate track labels"] = prefs["propagate track labels"]
@@ -221,6 +222,7 @@ def closeEvent(self, event):
221222
prefs["edge style"] = self.state["edge style"]
222223
prefs["propagate track labels"] = self.state["propagate track labels"]
223224
prefs["color predicted"] = self.state["color predicted"]
225+
prefs["trail length"] = self.state["trail_length"]
224226
prefs["trail shade"] = self.state["trail_shade"]
225227
prefs["share usage data"] = self.state["share usage data"]
226228

@@ -1025,6 +1027,7 @@ def _load_overlays(self):
10251027
labels=self.labels,
10261028
player=self.player,
10271029
trail_shade=self.state["trail_shade"],
1030+
trail_length=self.state["trail_length"],
10281031
)
10291032
self.overlays["instance"] = InstanceOverlay(
10301033
labels=self.labels, player=self.player, state=self.state

sleap/gui/overlays/tracks.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def __attrs_post_init__(self):
4848

4949
@classmethod
5050
def get_length_options(cls):
51-
return (0, 10, 50, 100, 250)
51+
if prefs["trail length"] != 0:
52+
return (0, 10, 50, 100, 250, 500, prefs["trail length"])
53+
return (0, 10, 50, 100, 250, 500)
5254

5355
@classmethod
5456
def get_shade_options(cls):

sleap/prefs.py

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def load_(self):
4545
self._prefs = util.get_config_yaml(self._filename)
4646
if not hasattr(self._prefs, "get"):
4747
self._prefs = self._defaults
48+
else:
49+
self._prefs["trail length"] = self._prefs.get(
50+
"trail length", self._defaults["trail length"]
51+
)
4852
except FileNotFoundError:
4953
self._prefs = self._defaults
5054

0 commit comments

Comments
 (0)