DGtal  0.9.2
MostCenteredMaximalSegmentEstimator.h
1 
17 #pragma once
18 
31 #if defined(MostCenteredMaximalSegmentEstimator_RECURSES)
32 #error Recursive header files inclusion detected in MostCenteredMaximalSegmentEstimator.h
33 #else // defined(MostCenteredMaximalSegmentEstimator_RECURSES)
34 
35 #define MostCenteredMaximalSegmentEstimator_RECURSES
36 
37 #if !defined MostCenteredMaximalSegmentEstimator_h
38 
39 #define MostCenteredMaximalSegmentEstimator_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <list>
45 
46 #include "DGtal/base/Common.h"
47 #include "DGtal/base/Exceptions.h"
48 #include "DGtal/base/Circulator.h"
49 
50 #include "DGtal/geometry/curves/estimation/CSegmentComputerEstimator.h"
51 #include "DGtal/geometry/curves/CForwardSegmentComputer.h"
52 #include "DGtal/geometry/curves/SaturatedSegmentation.h"
53 
55 
56 namespace DGtal
57 {
58 
60  // template class MostCenteredMaximalSegmentEstimator
82  template <typename SegmentComputer, typename SCEstimator>
84  {
85 
88  BOOST_STATIC_ASSERT(( boost::is_same< SegmentComputer,
89  typename SCEstimator::SegmentComputer >::value ));
90 
91  // ----------------------- Types ------------------------------
92  public:
93 
94  typedef typename SegmentComputer::ConstIterator ConstIterator;
95  typedef typename SCEstimator::Quantity Quantity;
96 
99 
100  // ----------------------- Standard services ------------------------------
101  public:
102 
107 
113  MostCenteredMaximalSegmentEstimator(const SegmentComputer& aSegmentComputer,
114  const SCEstimator& aSCEstimator);
115 
120 
121  // ----------------------- Interface --------------------------------------
122  public:
123 
130  void init(const double h, const ConstIterator& itb, const ConstIterator& ite);
131 
140  Quantity eval(const ConstIterator& it);
141 
155  template <typename OutputIterator>
156  OutputIterator eval(const ConstIterator& itb, const ConstIterator& ite,
157  OutputIterator result);
158 
159 
164  bool isValid() const;
165 
166  // ------------------------- Protected Datas ------------------------------
167  protected:
168 
169  // ------------------------- Private Datas --------------------------------
170  private:
171 
173  double myH;
174 
176  ConstIterator myBegin,myEnd;
177 
179  SegmentComputer mySC;
180 
182  SCEstimator mySCEstimator;
183 
184  // ------------------------- Internal services ------------------------------
185 
186  private:
187 
202  template <typename OutputIterator>
203  OutputIterator endEval(const ConstIterator& itb, const ConstIterator& ite, ConstIterator& itCurrent,
204  SegmentIterator& first, SegmentIterator& last,
205  OutputIterator result);
206 
207  template <typename OutputIterator>
208  OutputIterator endEval(const ConstIterator& /*itb*/, const ConstIterator& ite, ConstIterator& itCurrent,
209  SegmentIterator& /*first*/, SegmentIterator& last,
210  OutputIterator result, IteratorType);
211 
212  template <typename OutputIterator>
213  OutputIterator endEval(const ConstIterator& itb, const ConstIterator& ite, ConstIterator& itCurrent,
214  SegmentIterator& first, SegmentIterator& last,
215  OutputIterator result, CirculatorType);
216 
217  // ------------------------- Hidden services ------------------------------
218 
219  private:
220 
227 
235 
236 
237  }; // end of class MostCenteredMaximalSegmentEstimator
238 
239 } // namespace DGtal
240 
241 
243 // Includes inline functions.
244 #include "DGtal/geometry/curves/estimation/MostCenteredMaximalSegmentEstimator.ih"
245 #include "DGtal/geometry/curves/estimation/SegmentComputerEstimators.h"
246 
247 // //
249 
250 #endif // !defined MostCenteredMaximalSegmentEstimator_h
251 
252 #undef MostCenteredMaximalSegmentEstimator_RECURSES
253 #endif // else defined(MostCenteredMaximalSegmentEstimator_RECURSES)
OutputIterator endEval(const ConstIterator &itb, const ConstIterator &ite, ConstIterator &itCurrent, SegmentIterator &first, SegmentIterator &last, OutputIterator result)
Aim: A model of CLocalCurveGeometricEstimator that assigns to each element of a (sub)range a quantity...
BOOST_CONCEPT_ASSERT((concepts::CForwardSegmentComputer< SegmentComputer >))
MostCenteredMaximalSegmentEstimator & operator=(const MostCenteredMaximalSegmentEstimator &other)
Aim: This concept is a refinement of CCurveLocalGeometricEstimator devoted to the estimation of a geo...
void init(const double h, const ConstIterator &itb, const ConstIterator &ite)
Aim: Specific iterator to visit all the maximal segments of a saturated segmentation.
BOOST_STATIC_ASSERT((boost::is_same< SegmentComputer, typename SCEstimator::SegmentComputer >::value))
Aim: Defines the concept describing a forward segment computer. Like any model of CIncrementalSegment...
DGtal is the top-level namespace which contains all DGtal functions and types.
Quantity eval(const ConstIterator &it)
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
SaturatedSegmentation< SegmentComputer > Segmentation