DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 
234  BinomialConvolver ( const BinomialConvolver & other );
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;
266  typedef typename TBinomialConvolver::Value SignalValue;
267  typedef typename TBinomialConvolver::ConstIteratorOnPoints ConstIteratorOnPoints;
268 
275  Value operator()( const BinomialConvolver & bc,
276  const ConstIteratorOnPoints & it ) const;
277 
278  };
279 
289  template <typename TBinomialConvolver, typename TReal>
291  {
292  public:
293  // ----------------------- inner type ------------------------------
294  typedef TReal Value;
295  typedef TReal Real;
296  typedef TBinomialConvolver BinomialConvolver;
297  typedef typename TBinomialConvolver::Value SignalValue;
298  typedef typename TBinomialConvolver::ConstIteratorOnPoints ConstIteratorOnPoints;
299 
306  Value operator()( const BinomialConvolver & bc,
307  const ConstIteratorOnPoints & it ) const;
308 
309  };
310 
321  template <typename TBinomialConvolver, typename TBinomialConvolverFunctor>
323  {
324  public:
325  typedef TBinomialConvolver BinomialConvolver;
326  typedef TBinomialConvolverFunctor BinomialConvolverFunctor;
329  typedef typename BinomialConvolverFunctor::Value Value;
330  typedef Value Quantity;
331 
332  BinomialConvolverEstimator( unsigned int n = 0,
333  const BinomialConvolverFunctor & f
335 
343  void init( const double h,
344  const ConstIterator & itb,
345  const ConstIterator & ite,
346  const bool isClosed);
347 
351  Quantity eval( const ConstIterator& it );
352 
357  template <typename OutputIterator>
358  OutputIterator eval( const ConstIterator& itb,
359  const ConstIterator& ite,
360  OutputIterator result );
361 
362 
363 
364  private:
367 
368  };
369 
376  template <typename TConstIteratorOnPoints, typename TValue >
377  std::ostream&
378  operator<< ( std::ostream & out,
380 
381 } // namespace DGtal
382 
383 
385 // Includes inline functions.
386 #include "DGtal/geometry/curves/BinomialConvolver.ih"
387 
388 // //
390 
391 #endif // !defined BinomialConvolver_h
392 
393 #undef BinomialConvolver_RECURSES
394 #endif // else defined(BinomialConvolver_RECURSES)