DGtal  1.1.0
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;
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)
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
DGtal::ImageContainerBySTLVector::Value
TValue Value
Definition: ImageContainerBySTLVector.h:151
DGtal::functors::IntervalForegroundPredicate::operator()
bool operator()(const typename Image::ConstRange::ConstIterator &it) const
Definition: IntervalForegroundPredicate.h:96
DGtal::functors::IntervalForegroundPredicate::myMinVal
Value myMinVal
Definition: IntervalForegroundPredicate.h:105
DGtal::functors::IntervalForegroundPredicate::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CConstImage< Image >))
aPoint
const Point aPoint(3, 4)
DGtal::ImageContainerBySTLVector< Domain, Value >::ConstIterator
std::vector< Value >::const_iterator ConstIterator
Definition: ImageContainerBySTLVector.h:263
DGtal::functors::IntervalForegroundPredicate::Point
Image::Point Point
Definition: IntervalForegroundPredicate.h:70
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::functors::IntervalForegroundPredicate::myImage
const Image * myImage
Definition: IntervalForegroundPredicate.h:103
DGtal::functors::IntervalForegroundPredicate::IntervalForegroundPredicate
IntervalForegroundPredicate()
DGtal::functors::IntervalForegroundPredicate::operator()
bool operator()(const typename Image::Point &aPoint) const
Definition: IntervalForegroundPredicate.h:88
DGtal::functors::IntervalForegroundPredicate::myMaxVal
Value myMaxVal
Definition: IntervalForegroundPredicate.h:104
DGtal::Image
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
DGtal::PointVector< dim, Integer >
DGtal::functors::IntervalForegroundPredicate::IntervalForegroundPredicate
IntervalForegroundPredicate(ConstAlias< Image > aImage, const Value minVal, const Value maxVal)
Definition: IntervalForegroundPredicate.h:80
DGtal::functors::IntervalForegroundPredicate::Value
Image::Value Value
Definition: IntervalForegroundPredicate.h:69
DGtal::functors::IntervalForegroundPredicate
Aim: Define a simple Foreground predicate thresholding image values between two constant values (the ...
Definition: IntervalForegroundPredicate.h:65
DGtal::concepts::CConstImage
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:95