DGtal  1.5.beta
LocalEstimatorFromSurfelFunctorAdapter.h
1 
17 #pragma once
18 
31 #if defined(LocalEstimatorFromSurfelFunctorAdapter_RECURSES)
32 #error Recursive header files inclusion detected in LocalEstimatorFromSurfelFunctorAdapter.h
33 #else // defined(LocalEstimatorFromSurfelFunctorAdapter_RECURSES)
35 #define LocalEstimatorFromSurfelFunctorAdapter_RECURSES
36 
37 #if !defined LocalEstimatorFromSurfelFunctorAdapter_h
39 #define LocalEstimatorFromSurfelFunctorAdapter_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <functional>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/Alias.h"
47 #include "DGtal/base/ConstAlias.h"
48 #include "DGtal/base/CUnaryFunctor.h"
49 #include "DGtal/topology/CanonicSCellEmbedder.h"
50 #include "DGtal/topology/CSCellEmbedder.h"
51 #include "DGtal/topology/CDigitalSurfaceContainer.h"
52 #include "DGtal/topology/DigitalSurface.h"
53 #include "DGtal/graph/DistanceBreadthFirstVisitor.h"
54 #include "DGtal/geometry/volumes/distance/CMetricSpace.h"
55 #include "DGtal/base/BasicFunctors.h"
56 #include "DGtal/geometry/surfaces/estimation/estimationFunctors/CLocalEstimatorFromSurfelFunctor.h"
58 
59 namespace DGtal
60 {
61 
63  // template class LocalEstimatorFromSurfelFunctorAdapter
101  template <typename TDigitalSurfaceContainer, typename TMetric,
102  typename TFunctorOnSurfel, typename TConvolutionFunctor>
104  {
105  // ----------------------- Standard services ------------------------------
106  public:
107 
113 
115  typedef TDigitalSurfaceContainer DigitalSurfaceContainer;
116 
118  typedef TMetric Metric;
119 
121  typedef typename Metric::Value Value;
122 
124  typedef typename Metric::Point Point;
125 
127  typedef TFunctorOnSurfel FunctorOnSurfel;
128 
130  typedef TConvolutionFunctor ConvolutionFunctor;
131 
133  typedef typename TFunctorOnSurfel::Quantity Quantity;
134 
136  typedef double Scalar;
137 
140 
143 
144 
145 
146  private:
147 
149  typedef typename FunctorOnSurfel::SCellEmbedder Embedder;
151  typedef typename Embedder::RealPoint RealPoint;
152  typedef std::function< Value ( Point ) > MetricToPoint;
156 
157 
158  public:
159 
164 
178  ( ConstAlias< Surface > aSurface,
179  ConstAlias<TMetric> aMetric,
180  Alias<FunctorOnSurfel> aFunctor,
181  ConstAlias<ConvolutionFunctor> aConvolutionFunctor );
182 
189  mySurface(other.mySurface), myFunctor(other.myFunctor), myMetric(other.myMetric),
191  { }
192 
193 
201  {
202  mySurface = other.mySurface;
203  myFunctor = other.myFunctor;
204  myMetric = other.myMetric;
205  myEmbedder = other.myEmbedder;
207  return *this;
208  }
209 
214 
215  // ----------------------- Interface --------------------------------------
216  public:
217 
222  Scalar h() const;
223 
232  void attach( ConstAlias<Surface> aSurface );
233 
248  Alias<FunctorOnSurfel> aFunctor,
249  ConstAlias<ConvolutionFunctor> aConvolutionFunctor,
250  const Value radius);
251 
259  template<typename SurfelConstIterator>
260  void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite);
261 
262 
267  template< typename SurfelConstIterator>
268  Quantity eval(const SurfelConstIterator& it) const;
269 
277  template< typename SurfelConstIterator, typename OutputIterator>
278  OutputIterator eval(const SurfelConstIterator& itb,
279  const SurfelConstIterator& ite,
280  OutputIterator result) const;
281 
282 
287  void selfDisplay ( std::ostream & out ) const;
288 
293  bool isValid() const;
294 
295  // ------------------------- Hidden services ------------------------------
296 
297  private:
298 
299 
300  // ------------------------- Internals ------------------------------------
301  private:
302 
305 
308 
311 
313  double myH;
314 
316  bool myInit;
317 
320 
323 
326 
327  }; // end of class LocalEstimatorFromSurfelFunctorAdapter
328 
335  template <typename TD, typename TV, typename TF, typename TC>
336  std::ostream&
337  operator<< ( std::ostream & out, const LocalEstimatorFromSurfelFunctorAdapter<TD,TV,TF,TC> & object );
338 } // namespace DGtal
339 
340 
342 // Includes inline functions.
343 #include "DGtal/geometry/surfaces/estimation//LocalEstimatorFromSurfelFunctorAdapter.ih"
344 
345 // //
347 
348 #endif // !defined LocalEstimatorFromSurfelFunctorAdapter_h
349 
350 #undef LocalEstimatorFromSurfelFunctorAdapter_RECURSES
351 #endif // else defined(LocalEstimatorFromSurfelFunctorAdapter_RECURSES)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: Alias.h:183
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: This class is useful to perform an exploration of a graph given a starting point or set (called ...
Aim: this class adapts any local functor on digital surface element to define a local estimator....
CountedConstPtrOrConstPtr< ConvolutionFunctor > myConvFunctor
Convolution functor.
LocalEstimatorFromSurfelFunctorAdapter(ConstAlias< Surface > aSurface, ConstAlias< TMetric > aMetric, Alias< FunctorOnSurfel > aFunctor, ConstAlias< ConvolutionFunctor > aConvolutionFunctor)
void attach(ConstAlias< Surface > aSurface)
void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite)
LocalEstimatorFromSurfelFunctorAdapter & operator=(const LocalEstimatorFromSurfelFunctorAdapter &other)
void selfDisplay(std::ostream &out) const
TDigitalSurfaceContainer DigitalSurfaceContainer
Digital surface container type.
DistanceBreadthFirstVisitor< Surface, VertexFunctor > Visitor
CountedConstPtrOrConstPtr< Metric > myMetric
Distance functor.
LocalEstimatorFromSurfelFunctorAdapter(const LocalEstimatorFromSurfelFunctorAdapter &other)
void setParams(ConstAlias< TMetric > aMetric, Alias< FunctorOnSurfel > aFunctor, ConstAlias< ConvolutionFunctor > aConvolutionFunctor, const Value radius)
CountedConstPtrOrConstPtr< Surface > mySurface
Digital surface member.
FunctorOnSurfel::SCellEmbedder Embedder
Embedded and type definitions.
OutputIterator eval(const SurfelConstIterator &itb, const SurfelConstIterator &ite, OutputIterator result) const
DigitalSurface< DigitalSurfaceContainer > Surface
Digital surface type.
TConvolutionFunctor ConvolutionFunctor
Functor on double to compute convolution weights.
functors::Composer< Embedder, MetricToPoint, Value > VertexFunctor
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TConvolutionFunctor, double, double >))
BOOST_CONCEPT_ASSERT((concepts::CDigitalSurfaceContainer< TDigitalSurfaceContainer >))
Quantity eval(const SurfelConstIterator &it) const
BOOST_CONCEPT_ASSERT((concepts::CLocalEstimatorFromSurfelFunctor< TFunctorOnSurfel >))
BOOST_CONCEPT_ASSERT((concepts::CMetricSpace< TMetric >))
Concept Checks.
Aim: Define a new Functor from the composition of two other functors.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: The digital surface container concept describes a minimal set of inner types and methods so as t...
Aim: this concept describes functors on digtal surface surfel which can be used to define local estim...
Aim: defines the concept of metric spaces.
Definition: CMetricSpace.h:125
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90
MyPointD Point
Definition: testClone2.cpp:383
PointVector< 3, double > RealPoint