DGtal  1.4.beta
SetFromImage.h
1 
17 #pragma once
18 
31 #if defined(SetFromImage_RECURSES)
32 #error Recursive header files inclusion detected in SetFromImage.h
33 #else // defined(SetFromImage_RECURSES)
35 #define SetFromImage_RECURSES
36 
37 #if !defined SetFromImage_h
39 #define SetFromImage_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/images/CImage.h"
46 #include "DGtal/kernel/sets/CDigitalSet.h"
47 #include "DGtal/images/IntervalForegroundPredicate.h"
49 
50 namespace DGtal
51 {
52 
54  // template class SetFromImage
62  template <typename TSet>
63  struct SetFromImage
64  {
65  typedef TSet Set;
66 
68 
79  template<typename Image, typename ForegroundPredicate>
80  static
81  void append(Set &aSet,
82  const ForegroundPredicate &isForeground,
83  typename Image::Domain::ConstIterator itBegin,
84  typename Image::Domain::ConstIterator itEnd);
85 
100  template<typename Image>
101  static
102  void append(Set &aSet, const Image &aImage,
103  const typename Image::Value minVal,
104  const typename Image::Value maxVal,
105  typename Image::Domain::ConstIterator itBegin,
106  typename Image::Domain::ConstIterator itEnd)
107  {
108  functors::IntervalForegroundPredicate<Image> isForeground(aImage,minVal,maxVal);
109 
110  append(aSet, isForeground,itBegin,itEnd);
111  }
112 
123  template<typename Image,typename ForegroundPredicate>
124  static
125  void append(Set &aSet, const Image &aImage, const ForegroundPredicate &isForeground)
126  {
127  typename Image::Domain domain=aImage.domain();
128 
129  append<Image,ForegroundPredicate>(aSet,isForeground,domain.begin(),domain.end());
130  }
131 
144  template<typename Image>
145  static
146  void append(Set &aSet, const Image &aImage,
147  const typename Image::Value minVal,
148  const typename Image::Value maxVal)
149  {
150  functors::IntervalForegroundPredicate<Image> isForeground(aImage,minVal,maxVal);
151  append(aSet,aImage,isForeground);
152  }
153 
154  };
155 } // namespace DGtal
156 
157 
159 // Includes inline functions.
160 #include "DGtal/images/imagesSetsUtils/SetFromImage.ih"
161 
162 // //
164 
165 #endif // !defined SetFromImage_h
166 
167 #undef SetFromImage_RECURSES
168 #endif // else defined(SetFromImage_RECURSES)
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
const Domain & domain() const
Definition: Image.h:192
Aim: Define a simple Foreground predicate thresholding image values between two constant values (the ...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Define utilities to convert a digital set into an image.
Definition: SetFromImage.h:64
BOOST_CONCEPT_ASSERT((concepts::CDigitalSet< Set >))
static void append(Set &aSet, const Image &aImage, const typename Image::Value minVal, const typename Image::Value maxVal)
Definition: SetFromImage.h:146
static void append(Set &aSet, const ForegroundPredicate &isForeground, typename Image::Domain::ConstIterator itBegin, typename Image::Domain::ConstIterator itEnd)
static void append(Set &aSet, const Image &aImage, const typename Image::Value minVal, const typename Image::Value maxVal, typename Image::Domain::ConstIterator itBegin, typename Image::Domain::ConstIterator itEnd)
Definition: SetFromImage.h:102
static void append(Set &aSet, const Image &aImage, const ForegroundPredicate &isForeground)
Definition: SetFromImage.h:125
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user...
Definition: CDigitalSet.h:141
Domain domain