DGtal  0.9.2
LambdaMST3D.h
1 
17 #pragma once
18 
29 #if defined(LAMBDAMST3D_RECURSES)
30 #error Recursive header files inclusion detected in LambdaMST3D.h
31 #else // defined(LAMBDAMST3D_RECURSES)
32 
33 #define LAMBDAMST3D_RECURSES
34 
35 #if !defined LAMBDAMST3D_h
36 
37 #define LAMBDAMST3D_h
38 
39 #include <algorithm>
40 #include <iterator>
41 #include <cmath>
42 #include <map>
43 #include <DGtal/base/Common.h>
44 #include <DGtal/helpers/StdDefs.h>
45 #include "DGtal/kernel/CSpace.h"
46 #include "DGtal/kernel/PointVector.h"
47 #include "DGtal/geometry/curves/estimation/FunctorsLambdaMST.h"
48 #include "DGtal/geometry/curves/CForwardSegmentComputer.h"
49 #include "DGtal/geometry/curves/estimation/CLMSTTangentFromDSS.h"
50 
51 namespace DGtal {
58  template < typename TSpace, typename TSegmentation, typename Functor >
60  {
61  public:
62  //Checking concepts
64  BOOST_STATIC_ASSERT(( TSpace::dimension == 3 ));
67  // ----------------------- Types ------------------------------
68  public:
70  typedef TSegmentation Segmentation;
72  typedef typename TSegmentation::SegmentComputer SegmentComputer;
74  typedef typename SegmentComputer::ConstIterator ConstIterator;
76  typedef typename Functor::Value Value;
78  typedef typename TSpace::RealVector RealVector;
80  typedef typename TSpace::Point Point;
81 
82  // ----------------------- Standard services ------------------------------
83  public:
86 
92  void init ( const ConstIterator& itb, const ConstIterator& ite );
93 
97  void attach ( Alias<TSegmentation> segmentComputer );
98 
103  bool isValid() const;
104 
109  RealVector eval ( const ConstIterator & it );
110 
118  template <typename OutputIterator>
119  OutputIterator eval ( const ConstIterator & itb, const ConstIterator & ite,
120  OutputIterator result );
121 
122  // ------------------------- Internals ------------------------------------
123  protected:
124 
138  template <typename OutputIterator>
139  void accumulate ( std::multimap < Point, Value > & outValues, const ConstIterator& itb, const ConstIterator& ite, OutputIterator & result );
140 
141  // ------------------------- Private Datas --------------------------------
142  private:
146  ConstIterator myBegin;
150  ConstIterator myEnd;
154  TSegmentation * dssSegments;
161 
162  }; // end of class LambdaTangentFromDSSEstimator
163 
164  //-------------------------------------------------------------------------------------------
165 
166  // Template class LambdaMST3D
172  template < typename DSSSegmentationComputer, typename LambdaFunction = functors::Lambda64Function>
173  class LambdaMST3D:
174  public LambdaMST3DEstimator<Z3i::Space, DSSSegmentationComputer,
175  TangentFromDSS3DFunctor< typename DSSSegmentationComputer::SegmentComputer, LambdaFunction> >
176  {
177  typedef
178  LambdaMST3DEstimator<Z3i::Space, DSSSegmentationComputer,
180 
181  public:
185  LambdaMST3D() : Super() {}
186  };
187 }// namespace DGtal
188 
190 // Includes inline functions
191 #include "DGtal/geometry/curves/estimation/LambdaMST3D.ih"
192 // //
194 
195 #endif // !defined LAMBDAMST3D_h
196 
197 #undef LAMBDAMST3D_RECURSES
198 #endif // else defined(LAMBDAMST3D_RECURSES)
TSpace::Point Point
Type of 3d real point.
Definition: LambdaMST3D.h:80
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST3D.h:173
TSpace::RealVector RealVector
Type of 3d real vector.
Definition: LambdaMST3D.h:78
LambdaMST3DEstimator< Z3i::Space, DSSSegmentationComputer, TangentFromDSS3DFunctor< typename DSSSegmentationComputer::SegmentComputer, LambdaFunction > > Super
Definition: LambdaMST3D.h:179
void init(const ConstIterator &itb, const ConstIterator &ite)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: Alias.h:182
LambdaMST3DEstimator()
Default constructor.
RealVector eval(const ConstIterator &it)
TSegmentation Segmentation
Tangential cover algorithm.
Definition: LambdaMST3D.h:70
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 >))
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.
TSegmentation::SegmentComputer SegmentComputer
Curve segmentation algorithm.
Definition: LambdaMST3D.h:72
BOOST_STATIC_ASSERT((TSpace::dimension==3))
SegmentComputer::ConstIterator ConstIterator
Type of iterator, at least readable and forward.
Definition: LambdaMST3D.h:74
TSegmentation * dssSegments
Definition: LambdaMST3D.h:154
Functor::Value Value
Type returned by model of CLMSTTangentFrom2DSS.
Definition: LambdaMST3D.h:76
void attach(Alias< TSegmentation > segmentComputer)
void accumulate(std::multimap< Point, Value > &outValues, const ConstIterator &itb, const ConstIterator &ite, OutputIterator &result)
Accumulate partial results obtained for each point. In 3D it can happen that DSSs' direction vectors ...
SpaceND< 3, Integer > Space
Definition: StdDefs.h:144
Aim: Defines the concept describing a functor which calculates a direction of the 2D DSS and an eccen...