From 618ce5a9fac03286b7b5a1e18ffbc2de300699b9 Mon Sep 17 00:00:00 2001 From: Keya Loding Date: Thu, 20 Jun 2024 13:21:40 -0700 Subject: [PATCH 1/6] updated trail length optptions --- sleap/gui/overlays/tracks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sleap/gui/overlays/tracks.py b/sleap/gui/overlays/tracks.py index 361585719..28ba74a6f 100644 --- a/sleap/gui/overlays/tracks.py +++ b/sleap/gui/overlays/tracks.py @@ -48,7 +48,7 @@ def __attrs_post_init__(self): @classmethod def get_length_options(cls): - return (0, 10, 50, 100, 250) + return (0, 10, 50, 100, 250, 500, 1000, 2500) @classmethod def get_shade_options(cls): From f990a30b1219f0b5cd819f22188948286a76070f Mon Sep 17 00:00:00 2001 From: Keya Loding <117320751+keyaloding@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:16:06 -0500 Subject: [PATCH 2/6] Updated trail length options in the view menu --- sleap/gui/overlays/tracks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sleap/gui/overlays/tracks.py b/sleap/gui/overlays/tracks.py index 28ba74a6f..bf0b633cd 100644 --- a/sleap/gui/overlays/tracks.py +++ b/sleap/gui/overlays/tracks.py @@ -48,7 +48,9 @@ def __attrs_post_init__(self): @classmethod def get_length_options(cls): - return (0, 10, 50, 100, 250, 500, 1000, 2500) + if prefs["trail length"] != 0: + return (0, 10, 50, 100, 250, 500, prefs["trail length"]) + return (0, 10, 50, 100, 250, 500) @classmethod def get_shade_options(cls): From ea359c7b37c4ea3a7cc8da1b3612a2096da9e445 Mon Sep 17 00:00:00 2001 From: Keya Loding <117320751+keyaloding@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:17:37 -0500 Subject: [PATCH 3/6] Updated `prefs` to include length info from `preferences.yaml` --- sleap/prefs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sleap/prefs.py b/sleap/prefs.py index 3d5a2113e..5ca2d8868 100644 --- a/sleap/prefs.py +++ b/sleap/prefs.py @@ -45,6 +45,9 @@ def load_(self): self._prefs = util.get_config_yaml(self._filename) if not hasattr(self._prefs, "get"): self._prefs = self._defaults + else: + self._prefs["trail length"] = self._prefs.get("trail length", + self._defaults["trail length"]) except FileNotFoundError: self._prefs = self._defaults From 19ab435bc9dd3a8ce2769175bec83e9a4eaa0552 Mon Sep 17 00:00:00 2001 From: Keya Loding <117320751+keyaloding@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:18:40 -0500 Subject: [PATCH 4/6] Added trail length as method of `MainWindow` --- sleap/gui/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sleap/gui/app.py b/sleap/gui/app.py index becc1d83a..736d7207f 100644 --- a/sleap/gui/app.py +++ b/sleap/gui/app.py @@ -151,6 +151,7 @@ def __init__( self.state["edge style"] = prefs["edge style"] self.state["fit"] = False self.state["color predicted"] = prefs["color predicted"] + self.state["trail_length"] = prefs["trail length"] self.state["trail_shade"] = prefs["trail shade"] self.state["marker size"] = prefs["marker size"] self.state["propagate track labels"] = prefs["propagate track labels"] @@ -221,6 +222,7 @@ def closeEvent(self, event): prefs["edge style"] = self.state["edge style"] prefs["propagate track labels"] = self.state["propagate track labels"] prefs["color predicted"] = self.state["color predicted"] + prefs["trail length"] = self.state["trail_length"] prefs["trail shade"] = self.state["trail_shade"] prefs["share usage data"] = self.state["share usage data"] @@ -1025,6 +1027,7 @@ def _load_overlays(self): labels=self.labels, player=self.player, trail_shade=self.state["trail_shade"], + trail_length=self.state["trail_length"], ) self.overlays["instance"] = InstanceOverlay( labels=self.labels, player=self.player, state=self.state From 5cd000c1beece2a50b5e410316ea90b959ec825a Mon Sep 17 00:00:00 2001 From: Keya Loding <117320751+keyaloding@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:25:05 -0500 Subject: [PATCH 5/6] Updated trail length documentation --- docs/guides/gui.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/gui.md b/docs/guides/gui.md index 88cf3f656..813ed68fa 100644 --- a/docs/guides/gui.md +++ b/docs/guides/gui.md @@ -60,7 +60,7 @@ Note that many of the menu command have keyboard shortcuts which can be configur "**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). -"**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. +"**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. "**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. From 91e38f17fb4c0ef88128d67428d49ab4bb245f69 Mon Sep 17 00:00:00 2001 From: Keya Loding Date: Fri, 28 Jun 2024 09:24:24 -0700 Subject: [PATCH 6/6] black formatting --- sleap/prefs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sleap/prefs.py b/sleap/prefs.py index 5ca2d8868..8790f1d3f 100644 --- a/sleap/prefs.py +++ b/sleap/prefs.py @@ -46,8 +46,9 @@ def load_(self): if not hasattr(self._prefs, "get"): self._prefs = self._defaults else: - self._prefs["trail length"] = self._prefs.get("trail length", - self._defaults["trail length"]) + self._prefs["trail length"] = self._prefs.get( + "trail length", self._defaults["trail length"] + ) except FileNotFoundError: self._prefs = self._defaults