IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
peak_icv_threshold.hpp
Go to the documentation of this file.
1
11#pragma once
12
15#include <peak_common_c/detail/peak_common_defines.h>
19#include <peak_icv_c/algorithms/thresholds/peak_icv_threshold.h>
20
21namespace peak
22{
23namespace icv
24{
25namespace detail
26{
36template <typename IntervalType>
38{
39public:
40 static_assert(is_threshold_interval_v<IntervalType>, "Template argument of Threshold must be an Interval.");
41
49 explicit Threshold(const IntervalType& interval);
50
59 explicit Threshold(typename IntervalType::type minimum, typename IntervalType::type maximum);
60
76 PEAK_COMMON_NO_DISCARD peak::icv::Region Process(const Image& image) const;
77
87 static IntervalType GetRange(const Image& image);
88
89private:
90 IntervalType m_interval;
91};
92
93} // namespace detail
94
103
112
113namespace detail
114{
115template <typename IntervalType>
116Threshold<IntervalType>::Threshold(const IntervalType& interval)
117 : m_interval(interval)
118{}
119
120template <typename IntervalType>
121Threshold<IntervalType>::Threshold(typename IntervalType::type minimum, typename IntervalType::type maximum)
122 : m_interval(minimum, maximum)
123{}
124
125template <typename IntervalType>
127{
128 auto* const inputImageHandle = peak::common::detail::BackendAccessor<Image>::BackendHandle(image);
129
132 peak::common::detail::c_type_of_t<IntervalType> interval{ m_interval.GetMinimum(), m_interval.GetMaximum() };
133 return PEAK_ICV_C_ABI_PREFIX peak_icv_Threshold_Process(inputImageHandle, &interval, sizeof(interval),
134 peak::common::detail::BackendAccessor<peak::icv::Region>::BackendHandleAddress(region));
135 });
136
137 return region;
138}
139
140template <typename IntervalType>
141IntervalType Threshold<IntervalType>::GetRange(const Image& image)
142{
145 auto* const handle = peak::common::detail::BackendAccessor<Image>::BackendHandle(image);
146 return PEAK_ICV_C_ABI_PREFIX peak_icv_Threshold_GetRange(handle, &interval, sizeof(interval));
147 });
148 return { interval.minimum, interval.maximum };
149}
150} // namespace detail
151
152} /* namespace icv */
153} /* namespace peak */
For detailed information about the use of ids_peak_icv Image refer to the Image Guide.
Represents a region defined by a set of points in the image plane.
Class for thresholding an image.
Threshold(const IntervalType &interval)
Creates an instance of class Threshold.
peak::icv::Region Process(const Image &image) const
Applies a threshold on a given single-channel image and returns a region with selected pixels whose g...
static IntervalType GetRange(const Image &image)
Queries the minimum and maximum value of a given image and provides it as an interval.
detail::Threshold< peak::common::Interval > Threshold
Class for thresholding an image of type integer.
typename c_type_of_< Type >::type c_type_of_t
constexpr bool is_threshold_interval_v
void ExecuteAndMapReturnCodes(const CallableType &callableObject)