DGtal  0.9.2
SimpleThresholdForegroundPredicate.h
1 
17 #pragma once
18 
31 #if defined(SimpleThresholdForegroundPredicate_RECURSES)
32 #error Recursive header files inclusion detected in SimpleThresholdForegroundPredicate.h
33 #else // defined(SimpleThresholdForegroundPredicate_RECURSES)
34 
35 #define SimpleThresholdForegroundPredicate_RECURSES
36 
37 #if !defined SimpleThresholdForegroundPredicate_h
38 
39 #define SimpleThresholdForegroundPredicate_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/images/CConstImage.h"
46 #include "DGtal/base/ConstAlias.h"
48 
49 // @since 0.8 In DGtal::functors
50 namespace DGtal {
51  namespace functors {
52 
64  template <typename Image>
66  {
67  public:
69 
70  typedef typename Image::Value Value;
71  typedef typename Image::Point Point;
72 
81  const Value value):
82  myImage(&aImage), myVal(value) {};
83 
87  bool operator()(const typename Image::Point &aPoint) const
88  {
89  return ((*myImage)(aPoint) > myVal);
90  }
91 
95  bool operator()(const typename Image::Domain::ConstIterator &it) const
96  {
97  return ( (*myImage)(*it) > myVal);
98  }
99 
103  bool operator()(const typename Image::ConstRange::ConstIterator &it) const
104  {
105  return ((*it) > myVal);
106  }
107 
108 
109  private:
110  const Image * myImage;
111  Value myVal;
112 
113  protected:
115 
116  };
117 
118 
119 } // namespace functors
120 } // namespace DGtal
121 
122 // //
124 
125 #endif // !defined SimpleThresholdForegroundPredicate_h
126 
127 #undef SimpleThresholdForegroundPredicate_RECURSES
128 #endif // else defined(SimpleThresholdForegroundPredicate_RECURSES)
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
BOOST_CONCEPT_ASSERT((concepts::CConstImage< Image >))
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
bool operator()(const typename Image::Domain::ConstIterator &it) const
SimpleThresholdForegroundPredicate(ConstAlias< Image > aImage, const Value value)
bool operator()(const typename Image::Point &aPoint) const
Aim: Define a simple Foreground predicate thresholding image values given a single thresold...
bool operator()(const typename Image::ConstRange::ConstIterator &it) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:94