From f8185b8f8fd6604ebfe9d3cdf020a3fc495b5d5d Mon Sep 17 00:00:00 2001 From: jules-vanaret Date: Mon, 9 Dec 2024 14:42:42 +0100 Subject: [PATCH 1/3] added mask erosion --- src/napari_tapenade_processing/_widget.py | 38 ++++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/napari_tapenade_processing/_widget.py b/src/napari_tapenade_processing/_widget.py index 1fda208..93d331c 100644 --- a/src/napari_tapenade_processing/_widget.py +++ b/src/napari_tapenade_processing/_widget.py @@ -466,19 +466,6 @@ def __init__(self, viewer: "napari.viewer.Viewer"): compute_mask_threshold_factor_container.margins = (0,)*4 - # self._convex_hull_checkbox = create_widget( - # widget_type="CheckBox", - # label="Compute convex hull", - # options={"value": False}, - # ) - - # convex_hull_checkbox_tooltip = ( - # "Returns the convex hull of the mask. Really slow." - # ) - # convex_hull_container = self._add_tooltip_button_to_container( - # self._convex_hull_checkbox, convex_hull_checkbox_tooltip - # ) - self._compute_mask_post_processing_combo = create_widget( label="Post-processing", options={ @@ -523,8 +510,9 @@ def __init__(self, viewer: "napari.viewer.Viewer"): options={"value": False}, ) registered_image_tooltip = ( - "If checked, the image is assumed to have large areas of 0s outside of the tapenade.\n" - "These values will be masked" + "If checked, the image is assumed to have large areas of 0s on the outer parts,\n" + "as is often the case for images that are padded with 0 when spatially registered.\n" + "These values will be masked." ) registered_image_container = ( @@ -536,6 +524,25 @@ def __init__(self, viewer: "napari.viewer.Viewer"): registered_image_container.margins = (0,)*4 + self._erode_mask_spinbox = create_widget( + widget_type="IntSpinBox", + label="Num. erosions", + options={"min": 0, "max": 100, "value": 0}, + ) + + erode_mask_tooltip = ( + "Number of erosions to apply to the mask after thresholding.\n" + "Useful to remove small objects or to thin out the mask border." + ) + + erode_mask_container = ( + self._add_tooltip_button_to_container( + self._erode_mask_spinbox, erode_mask_tooltip + ) + ) + + erode_mask_container.margins = (0,)*4 + self._compute_mask_container = Container( widgets=[ compute_mask_method_container, @@ -544,6 +551,7 @@ def __init__(self, viewer: "napari.viewer.Viewer"): compute_mask_post_processing_container, keep_largest_cc_container, registered_image_container, + erode_mask_container, ], labels=False, ) From 2a92e84231ac27a52da2e12d554cc8b985df638f Mon Sep 17 00:00:00 2001 From: jules-vanaret Date: Mon, 9 Dec 2024 14:50:55 +0100 Subject: [PATCH 2/3] solved bug --- src/napari_tapenade_processing/_widget.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/napari_tapenade_processing/_widget.py b/src/napari_tapenade_processing/_widget.py index 93d331c..45123d6 100644 --- a/src/napari_tapenade_processing/_widget.py +++ b/src/napari_tapenade_processing/_widget.py @@ -525,7 +525,7 @@ def __init__(self, viewer: "napari.viewer.Viewer"): registered_image_container.margins = (0,)*4 self._erode_mask_spinbox = create_widget( - widget_type="IntSpinBox", + widget_type="SpinBox", label="Num. erosions", options={"min": 0, "max": 100, "value": 0}, ) @@ -1835,6 +1835,7 @@ def _run_compute_mask(self): "post_processing_method": self._compute_mask_post_processing_combo.value, "keep_largest_cc": self._compute_mask_keep_largest_cc_checkbox.value, "registered_image": self._registered_image_checkbox.value, + "n_erosion_steps": self._erode_mask_spinbox.value, "n_jobs": self._n_jobs_slider.value, } From 5732a6de8684e20e02a2ab58ecc0b2c7259b980c Mon Sep 17 00:00:00 2001 From: jules-vanaret Date: Mon, 9 Dec 2024 15:33:31 +0100 Subject: [PATCH 3/3] bumped to version 0.0.7 --- setup.cfg | 2 +- src/napari_tapenade_processing/__init__.py | 2 +- src/napari_tapenade_processing/logo/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 482ace5..16ce13c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,7 @@ install_requires = qtpy tifffile natsort - tapenade>=0.0.13 + tapenade>=0.0.14 python_requires = >=3.8 include_package_data = True diff --git a/src/napari_tapenade_processing/__init__.py b/src/napari_tapenade_processing/__init__.py index 6937c96..a391f0e 100644 --- a/src/napari_tapenade_processing/__init__.py +++ b/src/napari_tapenade_processing/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.6" +__version__ = "0.0.7" from ._widget import TapenadeProcessingWidget __all__ = ( diff --git a/src/napari_tapenade_processing/logo/__init__.py b/src/napari_tapenade_processing/logo/__init__.py index d85b28e..7d53ea3 100644 --- a/src/napari_tapenade_processing/logo/__init__.py +++ b/src/napari_tapenade_processing/logo/__init__.py @@ -1 +1 @@ -__version__ = "0.0.6" \ No newline at end of file +__version__ = "0.0.7" \ No newline at end of file