From 304e8c1b32bc181a53278e8ced6877108cb9dd3f Mon Sep 17 00:00:00 2001 From: niksirbi Date: Fri, 17 Nov 2023 15:18:52 +0000 Subject: [PATCH] finished first draft of mask qt widget --- brainglobe_template_builder/napari/mask_widget.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/brainglobe_template_builder/napari/mask_widget.py b/brainglobe_template_builder/napari/mask_widget.py index 556c966..b1b23d2 100644 --- a/brainglobe_template_builder/napari/mask_widget.py +++ b/brainglobe_template_builder/napari/mask_widget.py @@ -1,5 +1,6 @@ import numpy as np from napari.layers import Image +from napari.utils.notifications import show_info from napari.viewer import Viewer from qtpy.QtWidgets import ( QComboBox, @@ -44,13 +45,13 @@ def _on_button_click(self): """Generate a mask from the selected image layer.""" if len(self.viewer.layers.selection) != 1: - print("Please select exactly one image layer") + show_info("Please select exactly one image layer") return None - else: - image = list(self.viewer.layers.selection)[0] + + image = self.viewer.layers.selection[0] if not isinstance(image, Image): - print("The selected layer is not an image layer") + show_info("The selected layer is not an image layer") return None # Get parameters from widgets