Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mask erosion #8

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/napari_tapenade_processing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.0.6"
__version__ = "0.0.7"
from ._widget import TapenadeProcessingWidget

__all__ = (
Expand Down
39 changes: 24 additions & 15 deletions src/napari_tapenade_processing/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down Expand Up @@ -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 = (
Expand All @@ -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="SpinBox",
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,
Expand All @@ -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,
)
Expand Down Expand Up @@ -1827,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,
}

Expand Down
2 changes: 1 addition & 1 deletion src/napari_tapenade_processing/logo/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.6"
__version__ = "0.0.7"
Loading