Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated trail length viewing options #1822

Merged
merged 9 commits into from
Jun 28, 2024
2 changes: 1 addition & 1 deletion docs/guides/gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is now 500 frames. You have to close preferences.yaml and reopen it if you want to change the default more than once.


"**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.

Expand Down
3 changes: 3 additions & 0 deletions sleap/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]

Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion sleap/gui/overlays/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def __attrs_post_init__(self):

@classmethod
def get_length_options(cls):
return (0, 10, 50, 100, 250)
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):
Expand Down
3 changes: 3 additions & 0 deletions sleap/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading