From dcccc319e06e7c3f2ac2cd68c54f99f70b92bcea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 15 Oct 2024 08:30:34 +0000 Subject: [PATCH 1/5] Update pyclesperanto to 0.13.4 --- pyclesperanto/_tier5.py | 20 ++++++++++---------- pyclesperanto/_tier6.py | 24 ++++++++++++------------ pyclesperanto/_version.py | 2 +- src/wrapper/tier5_.cpp | 4 ++-- src/wrapper/tier6_.cpp | 8 ++++---- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/pyclesperanto/_tier5.py b/pyclesperanto/_tier5.py index a029e621..9af90cb9 100644 --- a/pyclesperanto/_tier5.py +++ b/pyclesperanto/_tier5.py @@ -164,8 +164,8 @@ def reduce_labels_to_centroids( def filter_label_by_size( input_image: Image, output_image: Optional[Image] =None, - min_size: float =0, - max_size: float =100, + minimum_size: float =0, + maximum_size: float =100, device: Optional[Device] =None ) -> Image: """Filter labelled objects outside of the min/max size range value. @@ -176,9 +176,9 @@ def filter_label_by_size( Input label image. output_image: Optional[Image] (= None) Output label image. - min_size: float (= 0) + minimum_size: float (= 0) Minimum size of labels to keep. - max_size: float (= 100) + maximum_size: float (= 100) Maximum size of labels to keep. device: Optional[Device] (= None) Device to perform the operation on. @@ -191,14 +191,14 @@ 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(minimum_size), float(maximum_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, + minimum_size: float =0, + maximum_size: float =100, device: Optional[Device] =None ) -> Image: """Filter labelled objects outside of the min/max size range value. @@ -209,9 +209,9 @@ def exclude_labels_outside_size_range( Input label image. output_image: Optional[Image] (= None) Output label image. - min_size: float (= 0) + minimum_size: float (= 0) Minimum size of labels to keep. - max_size: float (= 100) + maximum_size: float (= 100) Maximum size of labels to keep. device: Optional[Device] (= None) Device to perform the operation on. @@ -224,4 +224,4 @@ def exclude_labels_outside_size_range( ---------- [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)) \ No newline at end of file + return clic._exclude_labels_outside_size_range(device, input_image, output_image, float(minimum_size), float(maximum_size)) \ No newline at end of file diff --git a/pyclesperanto/_tier6.py b/pyclesperanto/_tier6.py index 0b5c2da6..3c7982e7 100644 --- a/pyclesperanto/_tier6.py +++ b/pyclesperanto/_tier6.py @@ -174,7 +174,7 @@ def voronoi_labeling( def remove_small_labels( input_image: Image, output_image: Optional[Image] =None, - min_size: float =100, + minimum_size: float =100, device: Optional[Device] =None ) -> Image: """Removes labelled objects small than a given size (in pixels) from a label map. @@ -185,7 +185,7 @@ def remove_small_labels( Label image to filter. output_image: Optional[Image] (= None) Output label image fitlered. - min_size: float (= 100) + minimum_size: float (= 100) Smallest size object allowed. device: Optional[Device] (= None) Device to perform the operation on. @@ -198,13 +198,13 @@ def remove_small_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._remove_small_labels(device, input_image, output_image, float(min_size)) + return clic._remove_small_labels(device, input_image, output_image, float(minimum_size)) @plugin_function(categories=["label processing", "in assistant"]) def exclude_small_labels( input_image: Image, output_image: Optional[Image] =None, - max_size: float =100, + maximum_size: float =100, device: Optional[Device] =None ) -> Image: """Removes labels from a label map which are below a given maximum size. @@ -215,7 +215,7 @@ def exclude_small_labels( Label image to filter. output_image: Optional[Image] (= None) Output label image fitlered. - max_size: float (= 100) + maximum_size: float (= 100) Largest size object to exclude. device: Optional[Device] (= None) Device to perform the operation on. @@ -228,13 +228,13 @@ def exclude_small_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._exclude_small_labels(device, input_image, output_image, float(max_size)) + return clic._exclude_small_labels(device, input_image, output_image, float(maximum_size)) @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def remove_large_labels( input_image: Image, output_image: Optional[Image] =None, - max_size: float =100, + maximum_size: float =100, device: Optional[Device] =None ) -> Image: """Removes labelled objects bigger than a given size (in pixels) from a label map. @@ -245,7 +245,7 @@ def remove_large_labels( Label image to filter. output_image: Optional[Image] (= None) Output label image fitlered. - max_size: float (= 100) + maximum_size: float (= 100) Biggest size object allowed. device: Optional[Device] (= None) Device to perform the operation on. @@ -258,13 +258,13 @@ def remove_large_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._remove_large_labels(device, input_image, output_image, float(max_size)) + return clic._remove_large_labels(device, input_image, output_image, float(maximum_size)) @plugin_function(categories=["label processing", "in assistant"]) def exclude_large_labels( input_image: Image, output_image: Optional[Image] =None, - min_size: float =100, + minimum_size: float =100, device: Optional[Device] =None ) -> Image: """Removes labels from a label map which are higher a given minimum size. @@ -275,7 +275,7 @@ def exclude_large_labels( Label image to filter. output_image: Optional[Image] (= None) Output label image fitlered. - min_size: float (= 100) + minimum_size: float (= 100) Smallest size object to keep. device: Optional[Device] (= None) Device to perform the operation on. @@ -288,4 +288,4 @@ def exclude_large_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._exclude_large_labels(device, input_image, output_image, float(min_size)) \ No newline at end of file + return clic._exclude_large_labels(device, input_image, output_image, float(minimum_size)) \ No newline at end of file diff --git a/pyclesperanto/_version.py b/pyclesperanto/_version.py index 79d130db..9991936d 100644 --- a/pyclesperanto/_version.py +++ b/pyclesperanto/_version.py @@ -1,3 +1,3 @@ VERSION = "0.13.3" -CLIC_VERSION = "0.13.3" +CLIC_VERSION = "0.13.4" COMMON_ALIAS = "cle" diff --git a/src/wrapper/tier5_.cpp b/src/wrapper/tier5_.cpp index 00b81ba4..aff53eca 100644 --- a/src/wrapper/tier5_.cpp +++ b/src/wrapper/tier5_.cpp @@ -28,9 +28,9 @@ 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")); + py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("minimum_size"), py::arg("maximum_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")); + py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("minimum_size"), py::arg("maximum_size")); } \ No newline at end of file diff --git a/src/wrapper/tier6_.cpp b/src/wrapper/tier6_.cpp index 34bd432b..6b369b45 100644 --- a/src/wrapper/tier6_.cpp +++ b/src/wrapper/tier6_.cpp @@ -28,17 +28,17 @@ m.def("_dilate_labels", &cle::tier6::dilate_labels_func, "Call cle::tier6::dilat m.def("_remove_small_labels", &cle::tier6::remove_small_labels_func, "Call cle::tier6::remove_small_labels_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("device"), py::arg("src"), py::arg("dst"), py::arg("minimum_size")); m.def("_exclude_small_labels", &cle::tier6::exclude_small_labels_func, "Call cle::tier6::exclude_small_labels_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("max_size")); + py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("maximum_size")); m.def("_remove_large_labels", &cle::tier6::remove_large_labels_func, "Call cle::tier6::remove_large_labels_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("max_size")); + py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("maximum_size")); m.def("_exclude_large_labels", &cle::tier6::exclude_large_labels_func, "Call cle::tier6::exclude_large_labels_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("device"), py::arg("src"), py::arg("dst"), py::arg("minimum_size")); } \ No newline at end of file From 8ae76c39394e44ae42f6e0331122bd8616f62947 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Tue, 15 Oct 2024 10:46:15 +0200 Subject: [PATCH 2/5] bump version to 0.13.4 --- pyclesperanto/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyclesperanto/_version.py b/pyclesperanto/_version.py index 9991936d..05e33b10 100644 --- a/pyclesperanto/_version.py +++ b/pyclesperanto/_version.py @@ -1,3 +1,3 @@ -VERSION = "0.13.3" +VERSION = "0.13.4" CLIC_VERSION = "0.13.4" COMMON_ALIAS = "cle" From b2bcaf9f4a010a091bacb2304a7acc8ac805ab0b Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Tue, 15 Oct 2024 10:46:25 +0200 Subject: [PATCH 3/5] add low intensity tests --- tests/test_threshold_otsu.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_threshold_otsu.py b/tests/test_threshold_otsu.py index 79c9606d..65c78c81 100644 --- a/tests/test_threshold_otsu.py +++ b/tests/test_threshold_otsu.py @@ -30,3 +30,18 @@ def test_threshold_otsu_against_scikit_image(): # compare assert np.allclose(binary, (cle.pull(gpu_binary) > 0)) + + + +def test_threshold_otsu_low_values(): + input = np.asarray([[0,0,0], + [0,0.003,0], + [0,0,0]]) + + reference = np.asarray([[0,0,0], + [0,1,0], + [0,0,0]]) + + result = cle.threshold_otsu(input) + + assert np.allclose(reference, cle.pull(result) > 0) \ No newline at end of file From 45915716d89b120e603ce6905bf6f0daf9f5c761 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Tue, 15 Oct 2024 10:46:34 +0200 Subject: [PATCH 4/5] update parameter name --- tests/test_filter_labels_by_size.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_filter_labels_by_size.py b/tests/test_filter_labels_by_size.py index ac68d25c..47f512bc 100644 --- a/tests/test_filter_labels_by_size.py +++ b/tests/test_filter_labels_by_size.py @@ -28,7 +28,7 @@ def test_exclude_labels_out_of_size_range_2d(): ) ) - gpu_output = cle.filter_label_by_size(gpu_input, min_size=4, max_size=5) + gpu_output = cle.filter_label_by_size(gpu_input, minimum_size=4, maximum_size=5) a = cle.pull(gpu_output) b = cle.pull(gpu_reference) @@ -64,7 +64,7 @@ def test_exclude_small_labels_2d(): ) ) - gpu_output = cle.exclude_small_labels(gpu_input, max_size=5) + gpu_output = cle.exclude_small_labels(gpu_input, maximum_size=5) a = cle.pull(gpu_output) b = cle.pull(gpu_reference) @@ -100,7 +100,7 @@ def test_exclude_large_labels_2d(): ) ) - gpu_output = cle.exclude_large_labels(gpu_input, min_size=3) + gpu_output = cle.exclude_large_labels(gpu_input, minimum_size=3) a = cle.pull(gpu_output) b = cle.pull(gpu_reference) From a30bdc39c454c98a188ea7b253d1fc9c29394a3a Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Tue, 15 Oct 2024 10:56:56 +0200 Subject: [PATCH 5/5] fix workflow --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 763f575b..8b32a00c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9"] + python-version: ["3.11"] platform: [ubuntu-latest, macos-latest] #, windows-latest] defaults: run: @@ -31,7 +31,6 @@ jobs: uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} - miniforge-variant: Mambaforge miniforge-version: latest activate-environment: test use-mamba: true