DGtal  0.9.2
DSSLengthEstimator.h
1 
17 #pragma once
18 
39 #if defined(DSSLengthEstimator_RECURSES)
40 #error Recursive header files inclusion detected in DSSLengthEstimator.h
41 #else // defined(DSSLengthEstimator_RECURSES)
42 
43 #define DSSLengthEstimator_RECURSES
44 
45 #if !defined DSSLengthEstimator_h
46 
47 #define DSSLengthEstimator_h
48 
50 // Inclusions
51 #include <iostream>
52 #include "DGtal/base/Common.h"
53 //#include "DGtal/base/IteratorTraits.h"
54 #include "DGtal/geometry/curves/GreedySegmentation.h"
55 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
56 
58 
59 namespace DGtal
60 {
61 
63  // template class DSSLengthEstimator
75  template <typename TConstIterator>
77  {
78  // ----------------------- Standard services ------------------------------
79  public:
80 
81 
83  typedef TConstIterator ConstIterator;
84 
85  typedef double Quantity;
86 
88  typedef typename DSSComputer::Point Point;
89  typedef typename DSSComputer::Vector Vector;
90 
95 
96 
101 
102 
103  // ----------------------- Interface --------------------------------------
104  public:
105 
113  void init( const double h, const ConstIterator& itb, const ConstIterator& ite);
114 
115 
123  Quantity eval( ) const;
124 
125 
130  void selfDisplay ( std::ostream & out ) const;
131 
136  bool isValid() const;
137 
138  // ------------------------- Private Datas --------------------------------
139  private:
140 
142  double myH;
143 
145  std::vector<Point> myRep;
146 
149 
150  private:
151 
157  DSSLengthEstimator ( const DSSLengthEstimator & other );
158 
166 
167  // ------------------------- Internals ------------------------------------
168  private:
169 
170  Point lastPoint (const ConstIterator& ite);
171  Point lastPoint (const ConstIterator& c, CirculatorType);
172  Point lastPoint (const ConstIterator& ite, IteratorType);
173 
174  }; // end of class DSSLengthEstimator
175 
176 
183  template <typename T>
184  std::ostream&
185  operator<< ( std::ostream & out, const DSSLengthEstimator<T> & object );
186 
187 } // namespace DGtal
188 
189 
191 // Includes inline functions.
192 #include "DGtal/geometry/curves/estimation/DSSLengthEstimator.ih"
193 
194 // //
196 
197 #endif // !defined DSSLengthEstimator_h
198 
199 #undef DSSLengthEstimator_RECURSES
200 #endif // else defined(DSSLengthEstimator_RECURSES)
ArithmeticalDSSComputer< ConstIterator, int, 4 > DSSComputer
bool myIsInitBefore
Boolean to make sure that init() has been called before eval().
std::vector< Point > myRep
polygonal representation of the input
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Point lastPoint(const ConstIterator &ite)
void selfDisplay(std::ostream &out) const
Quantity eval() const
void init(const double h, const ConstIterator &itb, const ConstIterator &ite)
Aim: a model of CGlobalCurveEstimator that segments the digital curve into DSS and computes the lengt...
DGtal is the top-level namespace which contains all DGtal functions and types.
IteratorCirculatorTraits< ConstIterator >::Value Point
DSSLengthEstimator & operator=(const DSSLengthEstimator &other)
DSSComputer::Vector Vector