DGtal  1.0.0
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 <vector>
43 #include <map>
44 #include <DGtal/base/Common.h>
45 #include <DGtal/helpers/StdDefs.h>
46 #include "DGtal/kernel/CSpace.h"
47 #include "DGtal/kernel/PointVector.h"
48 #include "DGtal/geometry/curves/estimation/FunctorsLambdaMST.h"
49 #include "DGtal/geometry/curves/CForwardSegmentComputer.h"
50 #include "DGtal/geometry/curves/estimation/CLMSTTangentFromDSS.h"
51 #include "DGtal/geometry/curves/estimation/CLMSTDSSFilter.h"
52 
53 namespace DGtal {
61  template < typename TSpace, typename TSegmentation, typename Functor, typename DSSFilter >
63  {
64  public:
65  //Checking concepts
67  BOOST_STATIC_ASSERT(( TSpace::dimension == 3 ));
71  // ----------------------- Types ------------------------------
72  public:
74  typedef TSegmentation Segmentation;
76  typedef typename TSegmentation::SegmentComputer SegmentComputer;
80  typedef typename Functor::Value Value;
82  typedef typename TSpace::RealVector RealVector;
84  typedef typename TSpace::Point Point;
85 
86  // ----------------------- Standard services ------------------------------
87  public:
90 
96  void init ( ConstIterator itb, ConstIterator ite );
97 
101  void attach ( Alias<TSegmentation> segmentComputer );
102 
107  bool isValid ( ) const;
108 
118  RealVector eval ( const Point & p );
119 
128  template <typename OutputIterator>
129  OutputIterator eval ( ConstIterator itb, ConstIterator ite, OutputIterator result );
130 
135  DSSFilter & getDSSFilter ( );
136 
137  // ------------------------- Internals ------------------------------------
138  protected:
139 
140  typedef typename std::vector<SegmentComputer >::const_iterator OrphanDSSIterator;
141 
155  template <typename OutputIterator>
156  void accumulate ( std::multimap < Point, Value > & outValues, ConstIterator itb, ConstIterator ite, OutputIterator & result );
157 
167  template < typename DSSesIterator, typename OrphanIterator >
168 
169  void treatOrphans(DSSesIterator begin, DSSesIterator end, OrphanIterator obegin, OrphanIterator oend,
170  std::multimap<Point, Value> &outValues);
171 
172 
173  // ------------------------- Private Datas --------------------------------
174  private:
186  TSegmentation * dssSegments;
193 
194  DSSFilter myDSSFilter;
195 
196  }; // end of class LambdaTangentFromDSSEstimator
197 
198  //-------------------------------------------------------------------------------------------
199 
200  // Template class LambdaMST3D
207  template < typename DSSSegmentationComputer, typename LambdaFunction = functors::Lambda64Function,
209  class LambdaMST3D:
210  public LambdaMST3DEstimator<Z3i::Space, DSSSegmentationComputer,
211  TangentFromDSS3DFunctor< typename DSSSegmentationComputer::SegmentComputer, LambdaFunction >, DSSFilter >
212  {
213  typedef
214  LambdaMST3DEstimator<Z3i::Space, DSSSegmentationComputer,
216 
217  public:
222  };
223 }// namespace DGtal
224 
226 // Includes inline functions
227 #include "DGtal/geometry/curves/estimation/LambdaMST3D.ih"
228 // //
230 
231 #endif // !defined LAMBDAMST3D_h
232 
233 #undef LAMBDAMST3D_RECURSES
234 #endif // else defined(LAMBDAMST3D_RECURSES)
InHalfPlaneBySimple3x3Matrix< Point, double > Functor
TSpace::RealVector RealVector
Type of 3d real vector.
Definition: LambdaMST3D.h:82
MyDigitalSurface::ConstIterator ConstIterator
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST3D.h:209
TSpace::Point Point
Type of 3d real point.
Definition: LambdaMST3D.h:84
Functor::Value Value
Type returned by model of CLMSTTangentFrom2DSS.
Definition: LambdaMST3D.h:80
Z3i::RealVector RealVector
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: Alias.h:182
TSegmentation * dssSegments
Definition: LambdaMST3D.h:186
BOOST_STATIC_ASSERT((TSpace::dimension==3))
std::vector< SegmentComputer >::const_iterator OrphanDSSIterator
Definition: LambdaMST3D.h:140
void attach(Alias< TSegmentation > segmentComputer)
RealVector eval(const Point &p)
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:105
TSegmentation::SegmentComputer SegmentComputer
Curve segmentation algorithm.
Definition: LambdaMST3D.h:76
void init(ConstIterator itb, ConstIterator ite)
Value treatOrphan(OrphanDSSIterator begin, OrphanDSSIterator end, const Point &p)
Use the DSS filter defined conditions to ensure estimation over not covered points - orphans.
TSegmentation Segmentation
Tangential cover algorithm.
Definition: LambdaMST3D.h:74
void treatOrphans(DSSesIterator begin, DSSesIterator end, OrphanIterator obegin, OrphanIterator oend, std::multimap< Point, Value > &outValues)
LambdaMST3DEstimator< Z3i::Space, DSSSegmentationComputer, TangentFromDSS3DFunctor< typename DSSSegmentationComputer::SegmentComputer, LambdaFunction >, DSSFilter > Super
Definition: LambdaMST3D.h:215
Aim: Defines the concept describing a forward segment computer. Like any model of CIncrementalSegment...
void accumulate(std::multimap< Point, Value > &outValues, ConstIterator itb, ConstIterator ite, OutputIterator &result)
Accumulate partial results obtained for each point. In 3D it can happen that DSSs' direction vectors ...
Aim: Defines the concept describing a functor which filters DSSes for L-MST calculations.
DGtal is the top-level namespace which contains all DGtal functions and types.
MyPointD Point
Definition: testClone2.cpp:383
LambdaMST3DEstimator()
Default constructor.
SegmentComputer::ConstIterator ConstIterator
Type of iterator, at least readable and forward.
Definition: LambdaMST3D.h:78
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
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...