74 #ifndef SLIP_THRESHOLD_HPP
75 #define SLIP_THRESHOLD_HPP
96 template <
typename InType,
typename OutType>
100 const OutType& false_value,
101 const OutType& true_value
127 template <
typename InType,
typename OutType>
131 const OutType& false_value):
153 template <
typename InType,
typename OutType>
157 const OutType& false_value):
192 template<
typename InputIterator,
typename OutputIterator>
196 OutputIterator result,
197 const typename std::iterator_traits<InputIterator>::value_type& t_value,
198 const typename std::iterator_traits<OutputIterator>::value_type& false_value,
199 const typename std::iterator_traits<OutputIterator>::value_type& true_value)
201 assert(first != last);
204 typename std::iterator_traits<InputIterator>::value_type,
205 typename std::iterator_traits<OutputIterator>::value_type>
206 t_fun(t_value,false_value,true_value);
208 std::transform(first,last,result,t_fun);
233 template<
typename InputIterator,
typename OutputIterator>
237 OutputIterator result,
238 const typename std::iterator_traits<InputIterator>::value_type& t_value,
239 const typename std::iterator_traits<OutputIterator>::value_type& false_value)
241 assert(first != last);
244 typename std::iterator_traits<InputIterator>::value_type,
245 typename std::iterator_traits<OutputIterator>::value_type>
246 t_fun(t_value,false_value);
248 std::transform(first,last,result,t_fun);
274 template<
typename InputIterator,
typename OutputIterator>
278 OutputIterator result,
279 const typename std::iterator_traits<InputIterator>::value_type& min_t_value,
280 const typename std::iterator_traits<InputIterator>::value_type& max_t_value,
281 const typename std::iterator_traits<OutputIterator>::value_type& false_value)
283 assert(first != last);
286 typename std::iterator_traits<InputIterator>::value_type,
287 typename std::iterator_traits<OutputIterator>::value_type>
288 t_fun(min_t_value,max_t_value,false_value);
290 std::transform(first,last,result,t_fun);
337 template<
typename InputIterator1,
338 typename RandomAccessIterator1,
339 typename RandomAccessIterator2,
340 typename OutputIterator>
343 RandomAccessIterator1 first_th,
344 RandomAccessIterator1 last_th,
345 RandomAccessIterator2 first_level,
346 RandomAccessIterator2 last_level,
347 OutputIterator result_first,
348 OutputIterator result_last)
351 assert((last_th-first_th) == (last_level-first_level));
352 assert((last - first) == (result_last - result_first));
354 RandomAccessIterator1 tmp_t = first_th;
355 RandomAccessIterator2 tmp_l = first_level;
357 for(;first!=last; ++first, ++result_first)
359 for ( ; first_th != last_th ; ++first_th, ++first_level)
361 if (*first <= *tmp_t)
363 *result_first = *tmp_l;
366 else if((*(first_th-1) < *first) && (*first <= *first_th))
368 *result_first = *first_level;
370 else if( *first > *(last_th - 1))
372 *result_first = *(last_level - 1);
384 #endif //SLIP_THRESHOLD_HPP
OutType operator()(const InType &val)
threshold_fun(const InType &t_value, const OutType &false_value)
void db_threshold(InputIterator first, InputIterator last, OutputIterator result, const typename std::iterator_traits< InputIterator >::value_type &min_t_value, const typename std::iterator_traits< InputIterator >::value_type &max_t_value, const typename std::iterator_traits< OutputIterator >::value_type &false_value)
double-threshold algorithm
Functor object used to double-threshold a value.
void threshold(InputIterator first, InputIterator last, OutputIterator result, const typename std::iterator_traits< InputIterator >::value_type &t_value, const typename std::iterator_traits< OutputIterator >::value_type &false_value)
threshold algorithm
Functor object used to binarize a value.
Functor object used to threshold a value.
db_threshold_fun(const InType &min_t_value, const InType &max_t_value, const OutType &false_value)
OutType operator()(const InType &val)
binarize_fun(const InType &t_value, const OutType &false_value, const OutType &true_value)
void multi_threshold(InputIterator1 first, InputIterator1 last, RandomAccessIterator1 first_th, RandomAccessIterator1 last_th, RandomAccessIterator2 first_level, RandomAccessIterator2 last_level, OutputIterator result_first, OutputIterator result_last)
multi_threshold algorithm It is equivalent to a quantification J[i] = Level[i] if T[i-1] < I[i] <= T[...
void binarize(InputIterator first, InputIterator last, OutputIterator result, const typename std::iterator_traits< InputIterator >::value_type &t_value, const typename std::iterator_traits< OutputIterator >::value_type &false_value, const typename std::iterator_traits< OutputIterator >::value_type &true_value)
binarize algorithm
OutType operator()(const InType &val)