DGtal  0.9.2
IntervalForegroundPredicate.h
1 
17 #pragma once
18 
31 #if defined(IntervalForegroundPredicate_RECURSES)
32 #error Recursive header files inclusion detected in IntervalForegroundPredicate.h
33 #else // defined(IntervalForegroundPredicate_RECURSES)
34 
35 #define IntervalForegroundPredicate_RECURSES
36 
37 #if !defined IntervalForegroundPredicate_h
38 
39 #define IntervalForegroundPredicate_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 
63  template <typename Image>
65  {
66  public:
68 
69  typedef typename Image::Value Value;
70  typedef typename Image::Point Point;
71 
81  const Value minVal,
82  const Value maxVal):
83  myImage(&aImage), myMaxVal(maxVal), myMinVal(minVal) {};
84 
88  bool operator()(const typename Image::Point &aPoint) const
89  {
90  return ((*myImage)(aPoint) > myMinVal) && ((*myImage)(aPoint) <= myMaxVal);
91  }
92 
96  bool operator()(const typename Image::ConstRange::ConstIterator &it) const
97  {
98  return ((*it) > myMinVal) && ((*it) <= myMaxVal);
99  }
100 
101 
102  private:
103  const Image* myImage;
104  Value myMaxVal;
105  Value myMinVal;
106 
107  protected:
109 
110  };
111 
112 } // namespace functors
113 } // namespace DGtal
114 
115 // //
117 
118 #endif // !defined IntervalForegroundPredicate_h
119 
120 #undef IntervalForegroundPredicate_RECURSES
121 #endif // else defined(IntervalForegroundPredicate_RECURSES)
BOOST_CONCEPT_ASSERT((concepts::CConstImage< Image >))
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
bool operator()(const typename Image::ConstRange::ConstIterator &it) const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
IntervalForegroundPredicate(ConstAlias< Image > aImage, const Value minVal, const Value maxVal)
bool operator()(const typename Image::Point &aPoint) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Define a simple Foreground predicate thresholding image values between two constant values (the ...
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:94