IDS peak ICV v1.0.0
Loading...
Searching...
No Matches
peak_icv_threshold.hpp
Go to the documentation of this file.
1
11#pragma once
12
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
74 PEAK_ICV_NO_DISCARD peak::icv::experimental::Region Process(const Image& image) const;
75
85 static IntervalType GetRange(const Image& image);
86
87private:
88 IntervalType m_interval;
89};
90
91} // namespace detail
92
93namespace experimental
94{
103
112
113} /* namespace experimental */
114
115namespace detail
116{
117template <typename IntervalType>
118Threshold<IntervalType>::Threshold(const IntervalType& interval)
119 : m_interval(interval)
120{}
121
122template <typename IntervalType>
123Threshold<IntervalType>::Threshold(typename IntervalType::type minimum, typename IntervalType::type maximum)
124 : m_interval(minimum, maximum)
125{}
126
127template <typename IntervalType>
129{
130 auto* const inputImageHandle = peak::common::detail::BackendAccessor<Image>::BackendHandle(image);
131
134 peak::common::detail::c_type_of_t<IntervalType> interval{ m_interval.GetMinimum(), m_interval.GetMaximum() };
135 return PEAK_ICV_C_ABI_PREFIX peak_icv_Threshold_Process(inputImageHandle, &interval, sizeof(interval),
136 peak::common::detail::BackendAccessor<peak::icv::experimental::Region>::BackendHandleAddress(region));
137 });
138
139 return region;
140}
141
142template <typename IntervalType>
143IntervalType Threshold<IntervalType>::GetRange(const Image& image)
144{
147 auto* const handle = peak::common::detail::BackendAccessor<Image>::BackendHandle(image);
148 return PEAK_ICV_C_ABI_PREFIX peak_icv_Threshold_GetRange(handle, &interval, sizeof(interval));
149 });
150 return { interval.minimum, interval.maximum };
151}
152} // namespace detail
153
154} /* namespace icv */
155} /* namespace peak */
For detailed information about the use of ids_peak_icv Image refer to the Image Guide.
Class for thresholding an image.
Threshold(const IntervalType &interval)
Creates an instance of class Threshold.
peak::icv::experimental::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.
A region consists of a set of points in the image plane.
typename c_type_of_< Type >::type c_type_of_t
constexpr bool is_threshold_interval_v
void ExecuteAndMapReturnCodes(const CallableType &callableObject)