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", diff --git a/src/napari_ome_zarr_navigator/roi_loader.py b/src/napari_ome_zarr_navigator/roi_loader.py index e4c9999..0c585f2 100644 --- a/src/napari_ome_zarr_navigator/roi_loader.py +++ b/src/napari_ome_zarr_navigator/roi_loader.py @@ -317,7 +317,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" @@ -325,7 +325,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"