From e670068e64bf8f83488ef5f150564d3d6d50ae85 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 16 Oct 2024 19:15:20 +0200 Subject: [PATCH 1/2] fix param name to fit prototype --- clic/include/tier4.hpp | 16 ++++++++-------- clic/src/tier4/filter_label_by_values.cpp | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/clic/include/tier4.hpp b/clic/include/tier4.hpp index 99312747..55dfb7e2 100644 --- a/clic/include/tier4.hpp +++ b/clic/include/tier4.hpp @@ -210,8 +210,8 @@ remove_labels_with_map_values_within_range_func(const Device::Pointer & device, * associated with the labels. * * @param device Device to perform the operation on. [const Device::Pointer &] - * @param src Input image where labels will be filtered. [const Array::Pointer &] - * @param values Vector of values associated with the labels. [const Array::Pointer &] + * @param values_map Vector of values associated with the labels. [const Array::Pointer &] + * @param label_map_input Input image where labels will be filtered. [const Array::Pointer &] * @param dst Output image where labels will be written to. [Array::Pointer ( = None )] * @param min_value_range Minimum value to keep. [float ( = 0 )] * @param max_value_range Maximum value to keep. [float ( = 100 )] @@ -223,8 +223,8 @@ remove_labels_with_map_values_within_range_func(const Device::Pointer & device, */ auto exclude_labels_with_map_values_out_of_range_func(const Device::Pointer & device, - const Array::Pointer & src, - const Array::Pointer & values, + const Array::Pointer & values_map, + const Array::Pointer & label_map_input, Array::Pointer dst, float min_value_range, float max_value_range) -> Array::Pointer; @@ -235,8 +235,8 @@ exclude_labels_with_map_values_out_of_range_func(const Device::Pointer & device, * associated with the labels. * * @param device Device to perform the operation on. [const Device::Pointer &] - * @param src Input image where labels will be filtered. [const Array::Pointer &] - * @param values Vector of values associated with the labels. [const Array::Pointer &] + * @param values_map Vector of values associated with the labels. [const Array::Pointer &] + * @param label_map_input Input image where labels will be filtered. [const Array::Pointer &] * @param dst Output image where labels will be written to. [Array::Pointer ( = None )] * @param min_value_range Minimum value to keep. [float ( = 0 )] * @param max_value_range Maximum value to keep. [float ( = 100 )] @@ -248,8 +248,8 @@ exclude_labels_with_map_values_out_of_range_func(const Device::Pointer & device, */ auto exclude_labels_with_map_values_within_range_func(const Device::Pointer & device, - const Array::Pointer & src, - const Array::Pointer & values, + const Array::Pointer & values_map, + const Array::Pointer & label_map_input, Array::Pointer dst, float min_value_range, float max_value_range) -> Array::Pointer; diff --git a/clic/src/tier4/filter_label_by_values.cpp b/clic/src/tier4/filter_label_by_values.cpp index 830d3519..bc98697f 100644 --- a/clic/src/tier4/filter_label_by_values.cpp +++ b/clic/src/tier4/filter_label_by_values.cpp @@ -47,25 +47,25 @@ remove_labels_with_map_values_within_range_func(const Device::Pointer & device, auto exclude_labels_with_map_values_out_of_range_func(const Device::Pointer & device, - const Array::Pointer & src, - const Array::Pointer & values, + const Array::Pointer & values_map, + const Array::Pointer & label_map_input, Array::Pointer dst, float min_value_range, float max_value_range) -> Array::Pointer { - return remove_labels_with_map_values_out_of_range_func(device, src, values, dst, min_value_range, max_value_range); + return remove_labels_with_map_values_out_of_range_func(device, label_map_input, values_map, dst, min_value_range, max_value_range); } auto exclude_labels_with_map_values_within_range_func(const Device::Pointer & device, - const Array::Pointer & src, - const Array::Pointer & values, + const Array::Pointer & values_map, + const Array::Pointer & label_map_input, Array::Pointer dst, float min_value_range, float max_value_range) -> Array::Pointer { - return remove_labels_with_map_values_within_range_func(device, src, values, dst, min_value_range, max_value_range); + return remove_labels_with_map_values_within_range_func(device, label_map_input, values_map, dst, min_value_range, max_value_range); } } // namespace cle::tier4 From 19c95cabf8b8c2d63333d9a234dab453ee0b9685 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:15:47 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- clic/src/tier4/filter_label_by_values.cpp | 6 ++++-- clic/src/tier4/threshold_otsu.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/clic/src/tier4/filter_label_by_values.cpp b/clic/src/tier4/filter_label_by_values.cpp index bc98697f..2e706ebf 100644 --- a/clic/src/tier4/filter_label_by_values.cpp +++ b/clic/src/tier4/filter_label_by_values.cpp @@ -53,7 +53,8 @@ exclude_labels_with_map_values_out_of_range_func(const Device::Pointer & device, float min_value_range, float max_value_range) -> Array::Pointer { - return remove_labels_with_map_values_out_of_range_func(device, label_map_input, values_map, dst, min_value_range, max_value_range); + return remove_labels_with_map_values_out_of_range_func( + device, label_map_input, values_map, dst, min_value_range, max_value_range); } @@ -65,7 +66,8 @@ exclude_labels_with_map_values_within_range_func(const Device::Pointer & device, float min_value_range, float max_value_range) -> Array::Pointer { - return remove_labels_with_map_values_within_range_func(device, label_map_input, values_map, dst, min_value_range, max_value_range); + return remove_labels_with_map_values_within_range_func( + device, label_map_input, values_map, dst, min_value_range, max_value_range); } } // namespace cle::tier4 diff --git a/clic/src/tier4/threshold_otsu.cpp b/clic/src/tier4/threshold_otsu.cpp index b248dee8..e0f15b88 100644 --- a/clic/src/tier4/threshold_otsu.cpp +++ b/clic/src/tier4/threshold_otsu.cpp @@ -18,8 +18,8 @@ threshold_otsu_func(const Device::Pointer & device, const Array::Pointer & src, constexpr int bin = 256; const float min_intensity = tier2::minimum_of_all_pixels_func(device, src); const float max_intensity = tier2::maximum_of_all_pixels_func(device, src); - double range = max_intensity - min_intensity; - + double range = max_intensity - min_intensity; + // Compute histogram auto hist_array = Array::create(bin, 1, 1, 1, dType::FLOAT, mType::BUFFER, src->device()); tier3::histogram_func(device, src, hist_array, bin, min_intensity, max_intensity); @@ -41,7 +41,7 @@ threshold_otsu_func(const Device::Pointer & device, const Array::Pointer & src, // Compute weight2 std::vector reversed_counts(counts.rbegin(), counts.rend()); std::partial_sum(reversed_counts.begin(), reversed_counts.end(), weight2.rbegin()); - + // Compute mean1 std::vector counts_bin_centers(bin); std::transform(counts.begin(), counts.end(), bin_centers.begin(), counts_bin_centers.begin(), std::multiplies<>()); @@ -62,7 +62,7 @@ threshold_otsu_func(const Device::Pointer & device, const Array::Pointer & src, auto max_it = std::max_element(variance12.begin(), variance12.end()); size_t idx = std::distance(variance12.begin(), max_it); double threshold = bin_centers[idx]; - + // Create binary image with threshold tier0::create_like(src, dst, dType::BINARY); return tier1::greater_constant_func(device, src, dst, static_cast(threshold));