Skip to content

Commit

Permalink
Merge pull request #279 from clEsperanto/update-clic-0.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
StRigaud authored Oct 18, 2024
2 parents 3da67ee + 123b28e commit 9fd6f78
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 12 deletions.
8 changes: 4 additions & 4 deletions pyclesperanto/_tier1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
32 changes: 32 additions & 0 deletions pyclesperanto/_tier4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
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.14.0"
CLIC_VERSION = "0.14.0"
VERSION = "0.14.1"
CLIC_VERSION = "0.14.1"
COMMON_ALIAS = "cle"
4 changes: 2 additions & 2 deletions src/wrapper/tier1_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down Expand Up @@ -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"));

Expand Down
4 changes: 4 additions & 0 deletions src/wrapper/tier4_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mean_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mean_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_variance_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_variance_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9fd6f78

Please sign in to comment.