DGtal  1.5.beta
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)
33 #define LAMBDAMST3D_RECURSES
34 
35 #if !defined LAMBDAMST3D_h
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;
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: Alias.h:183
BOOST_STATIC_ASSERT((TSpace::dimension==3))
TSpace::Point Point
Type of 3d real point.
Definition: LambdaMST3D.h:84
TSegmentation::SegmentComputer SegmentComputer
Curve segmentation algorithm.
Definition: LambdaMST3D.h:76
void treatOrphans(DSSesIterator begin, DSSesIterator end, OrphanIterator obegin, OrphanIterator oend, std::multimap< Point, Value > &outValues)
std::vector< SegmentComputer >::const_iterator OrphanDSSIterator
Definition: LambdaMST3D.h:140
void attach(Alias< TSegmentation > segmentComputer)
TSpace::RealVector RealVector
Type of 3d real vector.
Definition: LambdaMST3D.h:82
BOOST_CONCEPT_ASSERT((concepts::CForwardSegmentComputer< typename TSegmentation::SegmentComputer >))
OutputIterator eval(ConstIterator itb, ConstIterator ite, OutputIterator result)
TSegmentation * dssSegments
Definition: LambdaMST3D.h:186
RealVector eval(const Point &p)
TSegmentation Segmentation
Tangential cover algorithm.
Definition: LambdaMST3D.h:74
BOOST_CONCEPT_ASSERT((concepts::CLMSTDSSFilter< DSSFilter >))
BOOST_CONCEPT_ASSERT((concepts::CLMSTTangentFromDSS< Functor >))
Value treatOrphan(OrphanDSSIterator begin, OrphanDSSIterator end, const Point &p)
Use the DSS filter defined conditions to ensure estimation over not covered points - orphans.
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
void init(ConstIterator itb, ConstIterator ite)
LambdaMST3DEstimator()
Default constructor.
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 ...
Functor::Value Value
Type returned by model of CLMSTTangentFrom2DSS.
Definition: LambdaMST3D.h:80
SegmentComputer::ConstIterator ConstIterator
Type of iterator, at least readable and forward.
Definition: LambdaMST3D.h:78
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST3D.h:212
LambdaMST3DEstimator< Z3i::Space, DSSSegmentationComputer, TangentFromDSS3DFunctor< typename DSSSegmentationComputer::SegmentComputer, LambdaFunction >, DSSFilter > Super
Definition: LambdaMST3D.h:215
Space::RealVector RealVector
SpaceND< 3, Integer > Space
Definition: StdDefs.h:144
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Defines the concept describing a forward segment computer. Like any model of CIncrementalSegment...
Aim: Defines the concept describing a functor which filters DSSes for L-MST calculations.
Aim: Defines the concept describing a functor which calculates a direction of the 2D DSS and an eccen...
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:106
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
MyPointD Point
Definition: testClone2.cpp:383
InHalfPlaneBySimple3x3Matrix< Point, double > Functor