From 2f09415c049f4a5025e2f58c63157481f8d44554 Mon Sep 17 00:00:00 2001 From: fdsteffen <35061965+fdsteffen@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:35:43 +0200 Subject: [PATCH 1/2] Remove filter_widget before reinitializing --- src/napari_ome_zarr_navigator/img_browser.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/napari_ome_zarr_navigator/img_browser.py b/src/napari_ome_zarr_navigator/img_browser.py index 03dae4b..2487bdb 100644 --- a/src/napari_ome_zarr_navigator/img_browser.py +++ b/src/napari_ome_zarr_navigator/img_browser.py @@ -43,6 +43,7 @@ def __init__(self, viewer: "napari.viewer.Viewer"): self.btn_load_roi = PushButton(text="Load ROI", enabled=False) self.roi_loader = None self.roi_widget = None + self.filter_widget = None super().__init__( widgets=[ @@ -89,6 +90,12 @@ def initialize_filters(self): ], layout="vertical", ) + if self.filter_widget: + with suppress(RuntimeError): + self.viewer.window.remove_dock_widget( + self.filter_widget + ) + self.filter_widget = self.viewer.window.add_dock_widget( widget=self.filters, name="Filters", From a42b6b2f8b5d4ae80718102dfc37e86b07e6ca20 Mon Sep 17 00:00:00 2001 From: fdsteffen <35061965+fdsteffen@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:37:49 +0200 Subject: [PATCH 2/2] Fix non-typed feature table --- src/napari_ome_zarr_navigator/roi_loader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/napari_ome_zarr_navigator/roi_loader.py b/src/napari_ome_zarr_navigator/roi_loader.py index bb43e60..2079abe 100644 --- a/src/napari_ome_zarr_navigator/roi_loader.py +++ b/src/napari_ome_zarr_navigator/roi_loader.py @@ -296,7 +296,7 @@ def find_matching_label_layer(self, table_name): try: target_label_name = table_attrs["region"]["path"].split("/")[-1] except KeyError: - target_label_name = list(self.label_layers.keys)[0] + target_label_name = list(self.label_layers.keys())[0] logger.info( f"Table {table_name} did not have region metadata to match" "it to the correct label image. Attaching the features to the" @@ -304,7 +304,7 @@ def find_matching_label_layer(self, table_name): ) if target_label_name not in self.label_layers: - target_label_name = list(self.label_layers.keys)[0] + target_label_name = list(self.label_layers.keys())[0] logger.info( f"The label {target_label_name} that {table_name} would be " "matched to where not loaded. Attaching the features to the"