From c2056af65a4d3e7f97edb74d40cfadb63d56c83d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 18 Oct 2024 14:43:33 +0000 Subject: [PATCH 1/3] Update pyclesperanto to 0.14.1 --- pyclesperanto/_tier1.py | 8 ++++---- pyclesperanto/_tier4.py | 32 ++++++++++++++++++++++++++++++++ pyclesperanto/_version.py | 2 +- src/wrapper/tier1_.cpp | 4 ++-- src/wrapper/tier4_.cpp | 4 ++++ 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/pyclesperanto/_tier1.py b/pyclesperanto/_tier1.py index 278e5ccb..90621bc0 100644 --- a/pyclesperanto/_tier1.py +++ b/pyclesperanto/_tier1.py @@ -1838,7 +1838,7 @@ def mean_sphere( return clic._mean_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) @plugin_function(categories=["filter", "denoise", "in assistant"]) -def mean( +def mean_filter( input_image: Image, output_image: Optional[Image] =None, radius_x: int =1, @@ -1876,7 +1876,7 @@ def mean( ---------- [1] https://clij.github.io/clij2-docs/reference_mean3DSphere """ - return clic._mean(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._mean_filter(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) @plugin_function(categories=["projection"]) def mean_x_projection( @@ -4257,7 +4257,7 @@ def variance_sphere( return clic._variance_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) @plugin_function(categories=["filter", "edge detection", "in assistant"]) -def variance( +def variance_filter( input_image: Image, output_image: Optional[Image] =None, radius_x: int =1, @@ -4296,7 +4296,7 @@ def variance( [1] https://clij.github.io/clij2-docs/reference_varianceBox [2] https://clij.github.io/clij2-docs/reference_varianceSphere """ - return clic._variance(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._variance_filter(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) @plugin_function def write_values_to_positions( diff --git a/pyclesperanto/_tier4.py b/pyclesperanto/_tier4.py index d8c19b25..0c5251c2 100644 --- a/pyclesperanto/_tier4.py +++ b/pyclesperanto/_tier4.py @@ -163,6 +163,38 @@ def threshold_otsu( """ return clic._threshold_otsu(device, input_image, output_image) +@plugin_function(categories=["label measurement", "map", "in assistant", "combine"]) +def mean_intensity_map( + input_image: Image, + labels: Image, + output_image: Optional[Image] =None, + device: Optional[Device] =None +) -> Image: + """Takes an image and a corresponding label map, determines the mean intensity + per label and replaces every label with the that number. This results in a + parametric image expressing mean object intensity. + + Parameters + ---------- + input_image: Image + intensity image + labels: Image + label image + output_image: Optional[Image] (= None) + Parametric image computed + device: Optional[Device] (= None) + Device to perform the operation on. + + Returns + ------- + Image + + References + ---------- + [1] https://clij.github.io/clij2-docs/reference_meanIntensityMap + """ + return clic._mean_intensity_map(device, input_image, labels, output_image) + @plugin_function(categories=["label measurement", "map", "in assistant"]) def pixel_count_map( input_image: Image, diff --git a/pyclesperanto/_version.py b/pyclesperanto/_version.py index 26ddb549..860cbd5f 100644 --- a/pyclesperanto/_version.py +++ b/pyclesperanto/_version.py @@ -1,3 +1,3 @@ VERSION = "0.14.0" -CLIC_VERSION = "0.14.0" +CLIC_VERSION = "0.14.1" COMMON_ALIAS = "cle" diff --git a/src/wrapper/tier1_.cpp b/src/wrapper/tier1_.cpp index 37ee2a93..d8ba3138 100644 --- a/src/wrapper/tier1_.cpp +++ b/src/wrapper/tier1_.cpp @@ -238,7 +238,7 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - m.def("_mean", &cle::tier1::mean_func, "Call cle::tier1::mean_func from C++ CLIc.", + m.def("_mean_filter", &cle::tier1::mean_filter_func, "Call cle::tier1::mean_filter_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); @@ -546,7 +546,7 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - m.def("_variance", &cle::tier1::variance_func, "Call cle::tier1::variance_func from C++ CLIc.", + m.def("_variance_filter", &cle::tier1::variance_filter_func, "Call cle::tier1::variance_filter_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); diff --git a/src/wrapper/tier4_.cpp b/src/wrapper/tier4_.cpp index 14f726bf..9ada218b 100644 --- a/src/wrapper/tier4_.cpp +++ b/src/wrapper/tier4_.cpp @@ -26,6 +26,10 @@ m.def("_label_bounding_box", &cle::tier4::label_bounding_box_func, "Call cle::ti py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); + m.def("_mean_intensity_map", &cle::tier4::mean_intensity_map_func, "Call cle::tier4::mean_intensity_map_func from C++ CLIc.", + py::return_value_policy::take_ownership, + py::arg("device"), py::arg("src"), py::arg("labels"), py::arg("dst")); + m.def("_pixel_count_map", &cle::tier4::pixel_count_map_func, "Call cle::tier4::pixel_count_map_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); From fe51765c6eda84b7f4bd8d4548676bc5d3f829e0 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Fri, 18 Oct 2024 16:54:01 +0200 Subject: [PATCH 2/3] Update _version.py --- pyclesperanto/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyclesperanto/_version.py b/pyclesperanto/_version.py index 860cbd5f..c2083363 100644 --- a/pyclesperanto/_version.py +++ b/pyclesperanto/_version.py @@ -1,3 +1,3 @@ -VERSION = "0.14.0" +VERSION = "0.14.1" CLIC_VERSION = "0.14.1" COMMON_ALIAS = "cle" From 123b28e95775c2375f1150070c1f4a237f2b017f Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Fri, 18 Oct 2024 17:25:23 +0200 Subject: [PATCH 3/3] update test --- tests/test_mean_box.py | 2 +- tests/test_mean_sphere.py | 2 +- tests/test_variance_box.py | 2 +- tests/test_variance_sphere.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_mean_box.py b/tests/test_mean_box.py index 7ff05547..ab537e77 100644 --- a/tests/test_mean_box.py +++ b/tests/test_mean_box.py @@ -31,7 +31,7 @@ def test_mean_box(): ) result = cle.create(test1) - cle.mean(test1, result, 1, 1, 0) + cle.mean_filter(test1, result, 1, 1, 0) a = cle.pull(result) b = cle.pull(reference) diff --git a/tests/test_mean_sphere.py b/tests/test_mean_sphere.py index 88fa9d61..c5a2df33 100644 --- a/tests/test_mean_sphere.py +++ b/tests/test_mean_sphere.py @@ -31,7 +31,7 @@ def test_mean_sphere(): ) result = cle.create(test1, dtype=float) - cle.mean(test1, result, 1, 1, 0, "sphere") + cle.mean_filter(test1, result, 1, 1, 0, "sphere") a = cle.pull(result) b = cle.pull(reference) diff --git a/tests/test_variance_box.py b/tests/test_variance_box.py index b4bce81c..149e02ad 100644 --- a/tests/test_variance_box.py +++ b/tests/test_variance_box.py @@ -31,7 +31,7 @@ def test_variance_box(): ) result = cle.create(test1, dtype=float) - cle.variance(test1, result, 1, 1, 0) + cle.variance_filter(test1, result, 1, 1, 0) a = cle.pull(result) b = cle.pull(reference) diff --git a/tests/test_variance_sphere.py b/tests/test_variance_sphere.py index e632c0cd..e2cd0231 100644 --- a/tests/test_variance_sphere.py +++ b/tests/test_variance_sphere.py @@ -31,7 +31,7 @@ def test_variance_sphere(): ) result = cle.create(test1, dtype=float) - cle.variance(test1, result, 1, 1, 0, connectivity="sphere") + cle.variance_filter(test1, result, 1, 1, 0, connectivity="sphere") a = cle.pull(result) b = cle.pull(reference)