DGtal  1.1.0
BinomialConvolver.h
1 
17 #pragma once
18 
31 #if defined(BinomialConvolver_RECURSES)
32 #error Recursive header files inclusion detected in BinomialConvolver.h
33 #else // defined(BinomialConvolver_RECURSES)
34 
35 #define BinomialConvolver_RECURSES
36 
37 #if !defined BinomialConvolver_h
38 
39 #define BinomialConvolver_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <map>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/math/Signal.h"
48 
49 namespace DGtal
50 {
51 
53  // template class BinomialConvolver
72  template <typename TConstIteratorOnPoints, typename TValue = double>
74  {
75  // ----------------------- Standard services ------------------------------
76  public:
77  typedef TValue Value;
78  typedef TConstIteratorOnPoints ConstIteratorOnPoints;
79  typedef typename ConstIteratorOnPoints::value_type Point;
80 
89  BinomialConvolver( unsigned int n = 1 );
90 
91 
96 
101  void setSize( unsigned int n );
102 
107  unsigned int size() const;
108 
114  static
115  unsigned int suggestedSize( const double h,
116  const ConstIteratorOnPoints& itb,
117  const ConstIteratorOnPoints& ite );
118 
128  void init( const double h,
129  const ConstIteratorOnPoints& itb,
130  const ConstIteratorOnPoints& ite,
131  const bool isClosed );
132 
143  int index( const ConstIteratorOnPoints& it ) const;
144 
150  std::pair<Value,Value> x( int i ) const;
151 
158  std::pair<Value,Value> dx( int i ) const;
159 
166  std::pair<Value,Value> d2x( int i ) const;
167 
174  std::pair<Value,Value> tangent( int i ) const;
175 
183  Value curvature( int i ) const;
184 
185 
186  // ----------------------- Interface --------------------------------------
187  public:
188 
193  void selfDisplay ( std::ostream & out ) const;
194 
199  bool isValid() const;
200 
201  // ------------------------- Protected Datas ------------------------------
202  protected:
203  unsigned int myN;
204  double myH;
211 
214 
217 
218  // Stores the mapping Iterator => Index.
219  std::map<ConstIteratorOnPoints,int> myMapIt2Idx;
220 
221  // ------------------------- Private Datas --------------------------------
222  private:
223 
224  // ------------------------- Hidden services ------------------------------
225  protected:
226 
227  private:
228 
235 
243 
244  // ------------------------- Internals ------------------------------------
245  private:
246 
247  }; // end of class BinomialConvolver
248 
258  template <typename TBinomialConvolver, typename TRealPoint>
260  {
261  public:
262  // ----------------------- inner type ------------------------------
263  typedef TRealPoint Value;
264  typedef TRealPoint RealPoint;
265  typedef TBinomialConvolver BinomialConvolver;
267  typedef typename TBinomialConvolver::ConstIteratorOnPoints ConstIteratorOnPoints;
268 
277  const ConstIteratorOnPoints & it ) const;
278 
279  };
280 
290  template <typename TBinomialConvolver, typename TReal>
292  {
293  public:
294  // ----------------------- inner type ------------------------------
295  typedef TReal Value;
296  typedef TReal Real;
297  typedef TBinomialConvolver BinomialConvolver;
299  typedef typename TBinomialConvolver::ConstIteratorOnPoints ConstIteratorOnPoints;
300 
309  const ConstIteratorOnPoints & it ) const;
310 
311  };
312 
323  template <typename TBinomialConvolver, typename TBinomialConvolverFunctor>
325  {
326  public:
327  typedef TBinomialConvolver BinomialConvolver;
328  typedef TBinomialConvolverFunctor BinomialConvolverFunctor;
332  typedef Value Quantity;
333 
334  BinomialConvolverEstimator( unsigned int n = 0,
335  const BinomialConvolverFunctor & f
337 
345  void init( const double h,
346  const ConstIterator & itb,
347  const ConstIterator & ite,
348  const bool isClosed = true );
349 
354 
359  template <typename OutputIterator>
360  OutputIterator eval( const ConstIterator& itb,
361  const ConstIterator& ite,
362  OutputIterator result );
363 
364 
365 
366  private:
369 
370  };
371 
378  template <typename TConstIteratorOnPoints, typename TValue >
379  std::ostream&
380  operator<< ( std::ostream & out,
382 
383 } // namespace DGtal
384 
385 
387 // Includes inline functions.
388 #include "DGtal/geometry/curves/BinomialConvolver.ih"
389 
390 // //
392 
393 #endif // !defined BinomialConvolver_h
394 
395 #undef BinomialConvolver_RECURSES
396 #endif // else defined(BinomialConvolver_RECURSES)
DGtal::BinomialConvolver::ConstIteratorOnPoints
TConstIteratorOnPoints ConstIteratorOnPoints
Definition: BinomialConvolver.h:78
DGtal::BinomialConvolverEstimator
Aim: This class encapsulates a BinomialConvolver and a functor on BinomialConvolver so as to be a mod...
Definition: BinomialConvolver.h:325
DGtal::TangentFromBinomialConvolverFunctor::SignalValue
TBinomialConvolver::Value SignalValue
Definition: BinomialConvolver.h:266
DGtal::BinomialConvolver::myEnd
ConstIteratorOnPoints myEnd
Copy of the end iterator.
Definition: BinomialConvolver.h:216
DGtal::BinomialConvolver::myN
unsigned int myN
Definition: BinomialConvolver.h:203
DGtal::TangentFromBinomialConvolverFunctor::ConstIteratorOnPoints
TBinomialConvolver::ConstIteratorOnPoints ConstIteratorOnPoints
Definition: BinomialConvolver.h:267
DGtal::BinomialConvolverEstimator::BinomialConvolverEstimator
BinomialConvolverEstimator(unsigned int n=0, const BinomialConvolverFunctor &f=BinomialConvolverFunctor())
DGtal::BinomialConvolver::size
unsigned int size() const
DGtal::BinomialConvolver::myX
Signal< Value > myX
Definition: BinomialConvolver.h:205
DGtal::BinomialConvolver::myH
double myH
Definition: BinomialConvolver.h:204
DGtal::BinomialConvolver::myDX
Signal< Value > myDX
Definition: BinomialConvolver.h:207
DGtal::BinomialConvolverEstimator::myBC
BinomialConvolver myBC
Definition: BinomialConvolver.h:367
DGtal::CurvatureFromBinomialConvolverFunctor::Value
TReal Value
Definition: BinomialConvolver.h:295
DGtal::CurvatureFromBinomialConvolverFunctor::SignalValue
TBinomialConvolver::Value SignalValue
Definition: BinomialConvolver.h:298
DGtal::BinomialConvolver::myBegin
ConstIteratorOnPoints myBegin
Copy of the begin iterator.
Definition: BinomialConvolver.h:213
DGtal::BinomialConvolverEstimator::Quantity
Value Quantity
Definition: BinomialConvolver.h:332
DGtal::CurvatureFromBinomialConvolverFunctor::ConstIteratorOnPoints
TBinomialConvolver::ConstIteratorOnPoints ConstIteratorOnPoints
Definition: BinomialConvolver.h:299
DGtal::BinomialConvolver::setSize
void setSize(unsigned int n)
DGtal::BinomialConvolver::myDDY
Signal< Value > myDDY
Definition: BinomialConvolver.h:210
DGtal::BinomialConvolver::myDDX
Signal< Value > myDDX
Definition: BinomialConvolver.h:209
DGtal::TangentFromBinomialConvolverFunctor
Aim: This class is a functor for getting the tangent vector of a binomial convolver.
Definition: BinomialConvolver.h:260
DGtal::BinomialConvolverEstimator::Value
BinomialConvolverFunctor::Value Value
Definition: BinomialConvolver.h:331
DGtal::CurvatureFromBinomialConvolverFunctor::Real
TReal Real
Definition: BinomialConvolver.h:296
DGtal::BinomialConvolverEstimator::eval
Quantity eval(const ConstIterator &it)
DGtal::CurvatureFromBinomialConvolverFunctor
Aim: This class is a functor for getting the curvature of a binomial convolver.
Definition: BinomialConvolver.h:292
DGtal::CurvatureFromBinomialConvolverFunctor::BinomialConvolver
TBinomialConvolver BinomialConvolver
Definition: BinomialConvolver.h:297
DGtal::BinomialConvolver
Aim: This class represents a 2D contour convolved by some binomial. It computes first and second orde...
Definition: BinomialConvolver.h:74
DGtal::BinomialConvolver::operator=
BinomialConvolver & operator=(const BinomialConvolver &other)
DGtal::BinomialConvolver::suggestedSize
static unsigned int suggestedSize(const double h, const ConstIteratorOnPoints &itb, const ConstIteratorOnPoints &ite)
DGtal::BinomialConvolver::BinomialConvolver
BinomialConvolver(unsigned int n=1)
DGtal::BinomialConvolverEstimator::BinomialConvolver
TBinomialConvolver BinomialConvolver
Definition: BinomialConvolver.h:327
DGtal::BinomialConvolverEstimator::myFunctor
BinomialConvolverFunctor myFunctor
Definition: BinomialConvolver.h:368
DGtal::BinomialConvolverEstimator::BinomialConvolverFunctor
TBinomialConvolverFunctor BinomialConvolverFunctor
Definition: BinomialConvolver.h:328
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::BinomialConvolver::myMapIt2Idx
std::map< ConstIteratorOnPoints, int > myMapIt2Idx
Definition: BinomialConvolver.h:219
DGtal::BinomialConvolver::init
void init(const double h, const ConstIteratorOnPoints &itb, const ConstIteratorOnPoints &ite, const bool isClosed)
DGtal::BinomialConvolver::~BinomialConvolver
~BinomialConvolver()
DGtal::TangentFromBinomialConvolverFunctor::BinomialConvolver
TBinomialConvolver BinomialConvolver
Definition: BinomialConvolver.h:265
DGtal::Signal< Value >
DGtal::BinomialConvolver::myY
Signal< Value > myY
Definition: BinomialConvolver.h:206
DGtal::BinomialConvolverEstimator::ConstIteratorOnPoints
BinomialConvolver::ConstIteratorOnPoints ConstIteratorOnPoints
Definition: BinomialConvolver.h:329
DGtal::TangentFromBinomialConvolverFunctor::Value
TRealPoint Value
Definition: BinomialConvolver.h:263
DGtal::BinomialConvolver::Point
ConstIteratorOnPoints::value_type Point
Definition: BinomialConvolver.h:79
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::BinomialConvolver::curvature
Value curvature(int i) const
DGtal::BinomialConvolver::BinomialConvolver
BinomialConvolver(const BinomialConvolver &other)
DGtal::BinomialConvolverEstimator::init
void init(const double h, const ConstIterator &itb, const ConstIterator &ite, const bool isClosed=true)
DGtal::BinomialConvolver::tangent
std::pair< Value, Value > tangent(int i) const
DGtal::TangentFromBinomialConvolverFunctor::operator()
Value operator()(const BinomialConvolver &bc, const ConstIteratorOnPoints &it) const
DGtal::BinomialConvolverEstimator::ConstIterator
ConstIteratorOnPoints ConstIterator
Definition: BinomialConvolver.h:330
DGtal::BinomialConvolver::index
int index(const ConstIteratorOnPoints &it) const
DGtal::BinomialConvolver::d2x
std::pair< Value, Value > d2x(int i) const
DGtal::BinomialConvolver::Value
TValue Value
Definition: BinomialConvolver.h:77
DGtal::BinomialConvolverEstimator::eval
OutputIterator eval(const ConstIterator &itb, const ConstIterator &ite, OutputIterator result)
DGtal::TangentFromBinomialConvolverFunctor::RealPoint
TRealPoint RealPoint
Definition: BinomialConvolver.h:264
DGtal::CurvatureFromBinomialConvolverFunctor::operator()
Value operator()(const BinomialConvolver &bc, const ConstIteratorOnPoints &it) const
DGtal::BinomialConvolver::selfDisplay
void selfDisplay(std::ostream &out) const
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38
DGtal::BinomialConvolver::isValid
bool isValid() const
DGtal::BinomialConvolver::dx
std::pair< Value, Value > dx(int i) const
DGtal::BinomialConvolver::x
std::pair< Value, Value > x(int i) const
DGtal::BinomialConvolver::myDY
Signal< Value > myDY
Definition: BinomialConvolver.h:208