DGtal  0.9.2
LambdaMST2D.h
1 
17 #pragma once
18 
29 #if defined(LAMBDAMST2D_RECURSES)
30 #error Recursive header files inclusion detected in LambdaMST2D.h
31 #else // defined(LAMBDAMST2D_RECURSES)
32 
33 #define LAMBDAMST2D_RECURSES
34 
35 #if !defined LAMBDAMST2D_h
36 
37 #define LAMBDAMST2D_h
38 
39 #include <algorithm>
40 #include <iterator>
41 #include <cmath>
42 #include "DGtal/helpers/StdDefs.h"
43 #include "DGtal/kernel/CSpace.h"
44 #include "DGtal/kernel/PointVector.h"
45 #include "DGtal/geometry/curves/estimation/FunctorsLambdaMST.h"
46 #include "DGtal/geometry/curves/CForwardSegmentComputer.h"
47 #include "DGtal/geometry/curves/estimation/CLMSTTangentFromDSS.h"
48 
49 namespace DGtal {
56  template < typename TSpace, typename TSegmentation, typename Functor >
58  {
59  //Checking concepts
60  BOOST_STATIC_ASSERT(( TSpace::dimension == 2 ));
64  // ----------------------- Types ------------------------------
65  public:
67  typedef TSegmentation Segmentation;
69  typedef typename TSegmentation::SegmentComputer SegmentComputer;
71  typedef typename SegmentComputer::ConstIterator ConstIterator;
73  typedef typename Functor::Value Value;
75  typedef typename TSpace::RealVector RealVector;
77  typedef typename TSpace::Point Point;
78 
79  // ----------------------- Interface --------------------------------------
80  public:
83 
89  void init ( const ConstIterator & itb, const ConstIterator & ite );
90 
95  void attach ( Alias<TSegmentation> SegmentComputer );
96 
101  RealVector eval ( const ConstIterator & it );
102 
110  template <typename OutputIterator>
111  OutputIterator eval ( const ConstIterator & itb, const ConstIterator & ite,
112  OutputIterator result );
113 
114  // ----------------------- Standard services ------------------------------
115  public:
116 
121  bool isValid() const;
122  // ------------------------- Internals ------------------------------------
123  protected:
124 
132  template <typename OutputIterator>
133  void accumulate ( std::vector < Value > & outValues, OutputIterator & result );
134 
135  // ------------------------- Private Datas --------------------------------
136  private:
137 
141  ConstIterator myBegin;
145  ConstIterator myEnd;
155  TSegmentation * dssSegments;
156 
157  }; // end of class LambdaMST2DEstimator
158 
159  //-------------------------------------------------------------------------------------------
160 
161  // Template class LambdaMST2D
167  template < typename DSSSegmentationComputer, typename LambdaFunction = functors::Lambda64Function >
168  class LambdaMST2D:
169  public LambdaMST2DEstimator < Z2i::Space, DSSSegmentationComputer,
170  TangentFromDSS2DFunctor < typename DSSSegmentationComputer::SegmentComputer, LambdaFunction > >
171  {
172  typedef LambdaMST2DEstimator < Z2i::Space, DSSSegmentationComputer,
174 
175  public:
179  LambdaMST2D (): Super() {}
180  };
181 }// namespace DGtal
182 
184 // Includes inline functions
185 #include "DGtal/geometry/curves/estimation/LambdaMST2D.ih"
186 
187 // //
189 
190 #endif // !defined LAMBDAMST2D_h
191 
192 #undef LAMBDAMST2D_RECURSES
193 #endif // else defined(LAMBDAMST2D_RECURSES)
Functor::Value Value
Type returned by model of CLMSTTangentFrom2DSS.
Definition: LambdaMST2D.h:73
TSegmentation::SegmentComputer SegmentComputer
Curve segmentation algorithm.
Definition: LambdaMST2D.h:69
SpaceND< 2, Integer > Space
Definition: StdDefs.h:75
TSpace::RealVector RealVector
Type of 3d real vector.
Definition: LambdaMST2D.h:75
void accumulate(std::vector< Value > &outValues, OutputIterator &result)
Accumulate partial results obtained for each point.
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: Alias.h:182
LambdaMST2DEstimator()
Default constructor.
SegmentComputer::ConstIterator ConstIterator
Type of iterator, at least readable and forward.
Definition: LambdaMST2D.h:71
TSegmentation * dssSegments
Definition: LambdaMST2D.h:155
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
LambdaMST2DEstimator< Z2i::Space, DSSSegmentationComputer, TangentFromDSS2DFunctor< typename DSSSegmentationComputer::SegmentComputer, LambdaFunction > > Super
Definition: LambdaMST2D.h:173
BOOST_STATIC_ASSERT((TSpace::dimension==2))
void init(const ConstIterator &itb, const ConstIterator &ite)
Aim: Defines the concept describing a forward segment computer. Like any model of CIncrementalSegment...
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST2D.h:168
DGtal is the top-level namespace which contains all DGtal functions and types.
RealVector eval(const ConstIterator &it)
TSpace::Point Point
Type of 3d real point.
Definition: LambdaMST2D.h:77
void attach(Alias< TSegmentation > SegmentComputer)
TSegmentation Segmentation
Tangential cover algorithm.
Definition: LambdaMST2D.h:67
Aim: Defines the concept describing a functor which calculates a direction of the 2D DSS and an eccen...