DGtal  0.9.2
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)
34 
35 #define LocalEstimatorFromSurfelFunctorAdapter_RECURSES
36 
37 #if !defined LocalEstimatorFromSurfelFunctorAdapter_h
38 
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 TMetric::Value Value;
122 
124  typedef TFunctorOnSurfel FunctorOnSurfel;
125 
127  typedef TConvolutionFunctor ConvolutionFunctor;
128 
130  typedef typename TFunctorOnSurfel::Quantity Quantity;
131 
133  typedef double Scalar;
134 
137 
139  typedef typename DigitalSurfaceContainer::Surfel Surfel;
140 
141 
142  private:
143 
145  typedef typename FunctorOnSurfel::SCellEmbedder Embedder;
146  typedef std::function< typename Metric::Value ( typename Metric::Point ) > MetricToPoint;
149  VertexFunctor> Visitor;
150 
151 
152  public:
153 
158 
172  ( ConstAlias< Surface > aSurface,
173  ConstAlias<TMetric> aMetric,
174  Alias<FunctorOnSurfel> aFunctor,
175  ConstAlias<ConvolutionFunctor> aConvolutionFunctor );
176 
183  mySurface(other.mySurface), myFunctor(other.myFunctor), myMetric(other.myMetric),
185  { }
186 
187 
195  {
196  mySurface = other.mySurface;
197  myFunctor = other.myFunctor;
198  myMetric = other.myMetric;
199  myEmbedder = other.myEmbedder;
201  return *this;
202  }
203 
208 
209  // ----------------------- Interface --------------------------------------
210  public:
211 
216  Scalar h() const;
217 
226  void attach( ConstAlias<Surface> aSurface );
227 
241  void setParams( ConstAlias<TMetric> aMetric,
242  Alias<FunctorOnSurfel> aFunctor,
243  ConstAlias<ConvolutionFunctor> aConvolutionFunctor,
244  const Value radius);
245 
253  template<typename SurfelConstIterator>
254  void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite);
255 
256 
261  template< typename SurfelConstIterator>
262  Quantity eval(const SurfelConstIterator& it) const;
263 
271  template< typename SurfelConstIterator, typename OutputIterator>
272  OutputIterator eval(const SurfelConstIterator& itb,
273  const SurfelConstIterator& ite,
274  OutputIterator result) const;
275 
276 
281  void selfDisplay ( std::ostream & out ) const;
282 
287  bool isValid() const;
288 
289  // ------------------------- Hidden services ------------------------------
290 
291  private:
292 
293 
294  // ------------------------- Internals ------------------------------------
295  private:
296 
299 
301  FunctorOnSurfel* myFunctor;
302 
305 
307  double myH;
308 
310  bool myInit;
311 
313  Embedder myEmbedder;
314 
317 
319  Value myRadius;
320 
321  }; // end of class LocalEstimatorFromSurfelFunctorAdapter
322 
329  template <typename TD, typename TV, typename TF, typename TC>
330  std::ostream&
331  operator<< ( std::ostream & out, const LocalEstimatorFromSurfelFunctorAdapter<TD,TV,TF,TC> & object );
332 } // namespace DGtal
333 
334 
336 // Includes inline functions.
337 #include "DGtal/geometry/surfaces/estimation//LocalEstimatorFromSurfelFunctorAdapter.ih"
338 
339 // //
341 
342 #endif // !defined LocalEstimatorFromSurfelFunctorAdapter_h
343 
344 #undef LocalEstimatorFromSurfelFunctorAdapter_RECURSES
345 #endif // else defined(LocalEstimatorFromSurfelFunctorAdapter_RECURSES)
Aim: This class is useful to perform an exploration of a graph given a starting point or set (called ...
TConvolutionFunctor ConvolutionFunctor
Functor on double to compute convolution weights.
DigitalSurface< DigitalSurfaceContainer > Surface
Digital surface type.
std::function< typename Metric::Value(typename Metric::Point) > MetricToPoint
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DistanceBreadthFirstVisitor< Surface, VertexFunctor > Visitor
FunctorOnSurfel::SCellEmbedder Embedder
Embedded and type definitions.
void setParams(ConstAlias< TMetric > aMetric, Alias< FunctorOnSurfel > aFunctor, ConstAlias< ConvolutionFunctor > aConvolutionFunctor, const Value radius)
Aim: Smart or simple const pointer on T. It can be a smart pointer based on reference counts or a sim...
void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite)
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: Alias.h:182
TDigitalSurfaceContainer DigitalSurfaceContainer
Digital surface container type.
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
Aim: Define a new Functor from the composition of two other functors.
CountedConstPtrOrConstPtr< ConvolutionFunctor > myConvFunctor
Convolution functor.
Aim: this concept describes functors on digtal surface surfel which can be used to define local estim...
DGtal is the top-level namespace which contains all DGtal functions and types.
void selfDisplay(std::ostream &out) const
CountedConstPtrOrConstPtr< Metric > myMetric
Distance functor.
Quantity eval(const SurfelConstIterator &it) const
BOOST_CONCEPT_ASSERT((concepts::CMetricSpace< TMetric >))
Concept Checks.
Aim: defines the concept of metric spaces.
Definition: CMetricSpace.h:124
Aim: this class adapts any local functor on digital surface element to define a local estimator...
void attach(ConstAlias< Surface > aSurface)
functors::Composer< Embedder, MetricToPoint, Value > VertexFunctor
LocalEstimatorFromSurfelFunctorAdapter & operator=(const LocalEstimatorFromSurfelFunctorAdapter &other)
Aim: The digital surface container concept describes a minimal set of inner types and methods so as t...
CountedConstPtrOrConstPtr< Surface > mySurface
Digital surface member.
LocalEstimatorFromSurfelFunctorAdapter(const LocalEstimatorFromSurfelFunctorAdapter &other)