diff --git a/brainglobe_template_builder/napari/chest_of_widgets.py b/brainglobe_template_builder/napari/chest_of_widgets.py index 5075e04..e17ff4b 100644 --- a/brainglobe_template_builder/napari/chest_of_widgets.py +++ b/brainglobe_template_builder/napari/chest_of_widgets.py @@ -8,10 +8,11 @@ class ChestOfDrawers(CollapsibleWidgetContainer): def __init__(self, napari_viewer: Viewer, parent=None): super().__init__() - self.add_widget(GenerateMask(napari_viewer, parent=self)) - self.add_widget(GenerateMask(napari_viewer, parent=self)) + mask_widget_1 = GenerateMask(napari_viewer, parent=self) + self.add_widget(mask_widget_1, collapsible=True, widget_title="Mask 1") random_button = QPushButton("Random button", parent=self) self.add_widget(random_button) - self.add_widget(GenerateMask(napari_viewer, parent=self)) + mask_widget_2 = GenerateMask(napari_viewer, parent=self) + self.add_widget(mask_widget_2, collapsible=True, widget_title="Mask 2") diff --git a/brainglobe_template_builder/napari/mask_widget.py b/brainglobe_template_builder/napari/mask_widget.py index 02343b3..98adc23 100644 --- a/brainglobe_template_builder/napari/mask_widget.py +++ b/brainglobe_template_builder/napari/mask_widget.py @@ -1,5 +1,4 @@ import numpy as np -from brainglobe_utils.qtpy.collapsible_widget import CollapsibleWidget from napari.layers import Image from napari.utils.notifications import show_info from napari.viewer import Viewer @@ -18,32 +17,28 @@ ) -class GenerateMask(CollapsibleWidget): +class GenerateMask(QWidget): def __init__(self, napari_viewer: Viewer, parent=None): - super().__init__(title="Generate Mask", parent=parent) + super().__init__(parent=parent) self.viewer = napari_viewer - - content = QWidget(parent=self) - content.setLayout(QFormLayout()) - - self.setContent(content) + self.setLayout(QFormLayout()) self.gauss_sigma = QSpinBox(parent=self) self.gauss_sigma.setRange(0, 20) self.gauss_sigma.setValue(3) - content.layout().addRow("gauss sigma:", self.gauss_sigma) + self.layout().addRow("gauss sigma:", self.gauss_sigma) self.threshold_method = QComboBox(parent=self) self.threshold_method.addItems(["triangle", "otsu", "isodata"]) - content.layout().addRow("threshold method:", self.threshold_method) + self.layout().addRow("threshold method:", self.threshold_method) self.erosion_size = QSpinBox(parent=self) self.erosion_size.setRange(0, 20) self.erosion_size.setValue(5) - content.layout().addRow("erosion size:", self.erosion_size) + self.layout().addRow("erosion size:", self.erosion_size) self.generate_mask_button = QPushButton("Generate mask", parent=self) - content.layout().addRow(self.generate_mask_button) + self.layout().addRow(self.generate_mask_button) self.generate_mask_button.clicked.connect(self._on_button_click) def _on_button_click(self):