Skip to content

Commit

Permalink
Merge pull request #241 from clEsperanto/update-clic-0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
StRigaud authored Sep 28, 2024
2 parents 1aaaac3 + 8d63d7a commit ea91ef7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 39 deletions.
35 changes: 34 additions & 1 deletion pyclesperanto/_tier5.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,37 @@ def filter_label_by_size(
----------
[1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange
"""
return clic._filter_label_by_size(device, input_image, output_image, float(min_size), float(max_size))
return clic._filter_label_by_size(device, input_image, output_image, float(min_size), float(max_size))

@plugin_function(categories=["label processing", "in assistant"])
def exclude_labels_outside_size_range(
input_image: Image,
output_image: Optional[Image] =None,
min_size: float =0,
max_size: float =100,
device: Optional[Device] =None
) -> Image:
"""Filter labelled objects outside of the min/max size range value.
Parameters
----------
input_image: Image
Input label image.
output_image: Optional[Image] (= None)
Output label image.
min_size: float (= 0)
Minimum size of labels to keep.
max_size: float (= 100)
Maximum size of labels to keep.
device: Optional[Device] (= None)
Device to perform the operation on.
Returns
-------
Image
References
----------
[1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange
"""
return clic._exclude_labels_outside_size_range(device, input_image, output_image, float(min_size), float(max_size))
33 changes: 1 addition & 32 deletions pyclesperanto/_tier7.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,35 +388,4 @@ def voronoi_otsu_labeling(
[2] https://ieeexplore.ieee.org/document/4310076
[3] https://en.wikipedia.org/wiki/Voronoi_diagram
"""
return clic._voronoi_otsu_labeling(device, input_image, output_image, float(spot_sigma), float(outline_sigma))

@plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"])
def fill_holes(
input_image: Image,
output_image: Optional[Image] =None,
max_size: float =100,
device: Optional[Device] =None
) -> Image:
"""Fill holes in labelled objects samller than a given size (in pixels) from a
label map.
Parameters
----------
input_image: Image
Label image to filter.
output_image: Optional[Image] (= None)
Output label image fitlered.
max_size: float (= 100)
Biggest size holes allowed.
device: Optional[Device] (= None)
Device to perform the operation on.
Returns
-------
Image
References
----------
[1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange
"""
return clic._fill_holes(device, input_image, output_image, float(max_size))
return clic._voronoi_otsu_labeling(device, input_image, output_image, float(spot_sigma), float(outline_sigma))
4 changes: 2 additions & 2 deletions pyclesperanto/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = "0.12.1"
CLIC_VERSION = "0.13.0"
VERSION = "0.13.1"
CLIC_VERSION = "0.13.1"
COMMON_ALIAS = "cle"
4 changes: 4 additions & 0 deletions src/wrapper/tier5_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ m.def("_array_equal", &cle::tier5::array_equal_func, "Call cle::tier5::array_equ
m.def("_filter_label_by_size", &cle::tier5::filter_label_by_size_func, "Call cle::tier5::filter_label_by_size_func from C++ CLIc.",
py::return_value_policy::take_ownership,
py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("min_size"), py::arg("max_size"));

m.def("_exclude_labels_outside_size_range", &cle::tier5::exclude_labels_outside_size_range_func, "Call cle::tier5::exclude_labels_outside_size_range_func from C++ CLIc.",
py::return_value_policy::take_ownership,
py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("min_size"), py::arg("max_size"));
}
4 changes: 0 additions & 4 deletions src/wrapper/tier7_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,4 @@ m.def("_affine_transform", &cle::tier7::affine_transform_func, "Call cle::tier7:
m.def("_voronoi_otsu_labeling", &cle::tier7::voronoi_otsu_labeling_func, "Call cle::tier7::voronoi_otsu_labeling_func from C++ CLIc.",
py::return_value_policy::take_ownership,
py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("spot_sigma"), py::arg("outline_sigma"));

m.def("_fill_holes", &cle::tier7::fill_holes_func, "Call cle::tier7::fill_holes_func from C++ CLIc.",
py::return_value_policy::take_ownership,
py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("max_size"));
}

0 comments on commit ea91ef7

Please sign in to comment.