Skip to content

Commit

Permalink
Merge pull request #41 from haesleinhuepf/conditional_hints
Browse files Browse the repository at this point in the history
conditional hints for bia-bob depending on what's installed
  • Loading branch information
haesleinhuepf authored Oct 10, 2024
2 parents a31a59f + d84d86e commit af02941
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 22 deletions.
2 changes: 1 addition & 1 deletion napari_segment_blobs_and_things_with_membranes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

__version__ = "0.3.9"
__version__ = "0.3.10"
__common_alias__ = "nsbatwm"

from napari_plugin_engine import napari_hook_implementation
Expand Down
57 changes: 37 additions & 20 deletions napari_segment_blobs_and_things_with_membranes/_bia_bob_plugins.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
def list_bia_bob_plugins():
"""List of function hints for bia_bob"""
return """ ## napari-segment-blobs-and-things-with-membranes (nsbatwm)
nsbatwm is a Python library that processes images, mostly using the scikit-image library, but with simpler access.
When you use it, you always start by importing the library: `import napari_segment_blobs_and_things_with_membranes as nsbatwm`.
When asked for how to use nsbatwm, you can adapt one of the following code snippets:
* Splits touching objects in a binary image using an algorithm similar to the ImageJ watershed.
nsbatwm.split_touching_objects(binary_image)
try:
import pyclesperanto
good_alternative_installed = True
except:
pass
try:
import pyclesperanto_prototype
good_alternative_installed = True
except:
pass

if not good_alternative_installed:
basic_hints = """
* Applies Otsu's method to binarize an intensity image (also works with yen, isodata, li, mean, minimum, triangle instead of otsu).
nsbatwm.threshold_otsu(image)
* Labels connected components in a binary image.
nsbatwm.connected_component_labeling(binary_image)
* Applies seeded watershed segmentation using labeled objects, e.g. nuclei, and an image showing bright borders between objects such as cell membranes.
nsbatwm.seeded_watershed(image, labeled_objects)
* Segments blob-like structures using Voronoi-Otsu labeling.
nsbatwm.voronoi_otsu_labeling(image, spot_sigma=4, outline_sigma=1)
* Applies a Gaussian blur for noise reduction.
nsbatwm.gaussian_blur(image, sigma=5)
Expand All @@ -28,9 +28,6 @@ def list_bia_bob_plugins():
* Smooth a label image using a local most popular intensity (mode) filter.
nsbatwm.mode_filter(labels)
* Applies a percentile filter.
nsbatwm.percentile_filter(image)
* Removes background in an image using the top-hat filter.
nsbatwm.white_tophat(image)
Expand All @@ -46,10 +43,30 @@ def list_bia_bob_plugins():
* Expands labels by a specified distance.
nsbatwm.expand_labels(label_image, distance=2)
"""

return f""" ## napari-segment-blobs-and-things-with-membranes (nsbatwm)
nsbatwm is a Python library that processes images, mostly using the scikit-image library, but with simpler access.
When you use it, you always start by importing the library: `import napari_segment_blobs_and_things_with_membranes as nsbatwm`.
When asked for how to use nsbatwm, you can adapt one of the following code snippets:
{basic_hints}
* Splits touching objects in a binary image using an algorithm similar to the ImageJ watershed.
nsbatwm.split_touching_objects(binary_image)
* Labels connected components in a binary image.
nsbatwm.connected_component_labeling(binary_image)
* Applies seeded watershed segmentation using labeled objects, e.g. nuclei, and an image showing bright borders between objects such as cell membranes.
nsbatwm.seeded_watershed(image, labeled_objects)
* Applies a percentile filter.
nsbatwm.percentile_filter(image)
* Segments using seeded watershed with local minima as seeds.
nsbatwm.local_minima_seeded_watershed(image, spot_sigma=10, outline_sigma=2)
* Skeletonizes labeled objects.
nsbatwm.skeletonize(image)
"""
"""
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = napari-segment-blobs-and-things-with-membranes
version = 0.3.9
version = 0.3.10
author = Robert Haase
author_email = robert.haase@tu-dresden.de
url = https://github.com/haesleinhuepf/napari-segment-blobs-and-things-with-membranes
Expand Down

0 comments on commit af02941

Please sign in to comment.