From 8f4626b0499ba6b36ba6cf17b38f25c9bcec41f5 Mon Sep 17 00:00:00 2001 From: AnniekStok Date: Sat, 19 Oct 2024 17:14:32 +0200 Subject: [PATCH] fix the label highlighting when scrolling in the time dimension --- .../data_views/views_coordinator/tracks_viewer.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/motile_plugin/data_views/views_coordinator/tracks_viewer.py b/src/motile_plugin/data_views/views_coordinator/tracks_viewer.py index 87b74ed..3f26fcd 100644 --- a/src/motile_plugin/data_views/views_coordinator/tracks_viewer.py +++ b/src/motile_plugin/data_views/views_coordinator/tracks_viewer.py @@ -59,6 +59,7 @@ def __init__( self.visible = None self.tracking_layers = TracksLayerGroup(self.viewer, self.tracks, "", self) + self.viewer.dims.events.current_step.connect(self.update_highlights) self.selected_nodes = NodeSelectionList() self.selected_nodes.list_updated.connect(self.update_selection) @@ -183,6 +184,16 @@ def filter_visible_nodes(self) -> list[int]: else: return "all" + def update_highlights(self) -> None: + """If the time dimension is changed, update the highlighting in the seg layer""" + + if ( + self.viewer.dims.last_used == 0 + and self.tracking_layers.seg_layer is not None + ): + visible = self.filter_visible_nodes() + self.tracking_layers.seg_layer.update_label_colormap(visible) + def update_selection(self) -> None: """Sets the view and triggers visualization updates in other components"""