DGtal  1.1.0
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 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 
142  typedef typename DigitalSurfaceContainer::Surfel Surfel;
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)
DGtal::LocalEstimatorFromSurfelFunctorAdapter::MetricToPoint
std::function< Value(Point) > MetricToPoint
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:152
DGtal::LocalEstimatorFromSurfelFunctorAdapter::mySurface
CountedConstPtrOrConstPtr< Surface > mySurface
Digital surface member.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:304
DGtal::functors::Composer
Aim: Define a new Functor from the composition of two other functors.
Definition: BasicFunctors.h:418
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
DGtal::LocalEstimatorFromSurfelFunctorAdapter::LocalEstimatorFromSurfelFunctorAdapter
LocalEstimatorFromSurfelFunctorAdapter()
DGtal::LocalEstimatorFromSurfelFunctorAdapter::ConvolutionFunctor
TConvolutionFunctor ConvolutionFunctor
Functor on double to compute convolution weights.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:130
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Surface
DigitalSurface< DigitalSurfaceContainer > Surface
Digital surface type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:139
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Metric
TMetric Metric
Metric type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:118
DGtal::DigitalSurface
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Definition: DigitalSurface.h:140
DGtal::LocalEstimatorFromSurfelFunctorAdapter::setParams
void setParams(ConstAlias< TMetric > aMetric, Alias< FunctorOnSurfel > aFunctor, ConstAlias< ConvolutionFunctor > aConvolutionFunctor, const Value radius)
DGtal::LocalEstimatorFromSurfelFunctorAdapter::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TConvolutionFunctor, double, double >))
DGtal::LocalEstimatorFromSurfelFunctorAdapter::eval
Quantity eval(const SurfelConstIterator &it) const
DGtal::LocalEstimatorFromSurfelFunctorAdapter::myFunctor
FunctorOnSurfel * myFunctor
Functor member.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:307
DGtal::LocalEstimatorFromSurfelFunctorAdapter::isValid
bool isValid() const
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Visitor
DistanceBreadthFirstVisitor< Surface, VertexFunctor > Visitor
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:155
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Embedder
FunctorOnSurfel::SCellEmbedder Embedder
Embedded and type definitions.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:149
DGtal::LocalEstimatorFromSurfelFunctorAdapter::init
void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite)
DGtal::LocalEstimatorFromSurfelFunctorAdapter::myInit
bool myInit
Has init been done before eval.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:316
DGtal::LocalEstimatorFromSurfelFunctorAdapter::myRadius
Value myRadius
Ball radius.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:325
DGtal::LocalEstimatorFromSurfelFunctorAdapter::DigitalSurfaceContainer
TDigitalSurfaceContainer DigitalSurfaceContainer
Digital surface container type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:115
DGtal::concepts::CDigitalSurfaceContainer
Aim: The digital surface container concept describes a minimal set of inner types and methods so as t...
Definition: CDigitalSurfaceContainer.h:128
DGtal::LocalEstimatorFromSurfelFunctorAdapter::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CLocalEstimatorFromSurfelFunctor< TFunctorOnSurfel >))
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Scalar
double Scalar
The "real number" type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:136
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Point
Metric::Point Point
Metric point type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:124
DGtal::CountedConstPtrOrConstPtr
Aim: Smart or simple const pointer on T. It can be a smart pointer based on reference counts or a sim...
Definition: CountedConstPtrOrConstPtr.h:95
DGtal::LocalEstimatorFromSurfelFunctorAdapter::LocalEstimatorFromSurfelFunctorAdapter
LocalEstimatorFromSurfelFunctorAdapter(ConstAlias< Surface > aSurface, ConstAlias< TMetric > aMetric, Alias< FunctorOnSurfel > aFunctor, ConstAlias< ConvolutionFunctor > aConvolutionFunctor)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::LocalEstimatorFromSurfelFunctorAdapter::myConvFunctor
CountedConstPtrOrConstPtr< ConvolutionFunctor > myConvFunctor
Convolution functor.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:322
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Surfel
DigitalSurfaceContainer::Surfel Surfel
Surfel type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:142
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Value
Metric::Value Value
Metric value type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:121
DGtal::LocalEstimatorFromSurfelFunctorAdapter::h
Scalar h() const
DGtal::DistanceBreadthFirstVisitor
Aim: This class is useful to perform an exploration of a graph given a starting point or set (called ...
Definition: DistanceBreadthFirstVisitor.h:206
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::LocalEstimatorFromSurfelFunctorAdapter::myMetric
CountedConstPtrOrConstPtr< Metric > myMetric
Distance functor.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:310
DGtal::LocalEstimatorFromSurfelFunctorAdapter::~LocalEstimatorFromSurfelFunctorAdapter
~LocalEstimatorFromSurfelFunctorAdapter()
DGtal::LocalEstimatorFromSurfelFunctorAdapter::RealPoint
Embedder::RealPoint RealPoint
Real point type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:151
DGtal::LocalEstimatorFromSurfelFunctorAdapter::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDigitalSurfaceContainer< TDigitalSurfaceContainer >))
DGtal::LocalEstimatorFromSurfelFunctorAdapter::attach
void attach(ConstAlias< Surface > aSurface)
DGtal::concepts::CMetricSpace
Aim: defines the concept of metric spaces.
Definition: CMetricSpace.h:125
DGtal::LocalEstimatorFromSurfelFunctorAdapter::eval
OutputIterator eval(const SurfelConstIterator &itb, const SurfelConstIterator &ite, OutputIterator result) const
DGtal::LocalEstimatorFromSurfelFunctorAdapter::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CMetricSpace< TMetric >))
Concept Checks.
DGtal::LocalEstimatorFromSurfelFunctorAdapter::myH
double myH
Grid step.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:313
DGtal::concepts::CLocalEstimatorFromSurfelFunctor
Aim: this concept describes functors on digtal surface surfel which can be used to define local estim...
Definition: CLocalEstimatorFromSurfelFunctor.h:106
DGtal::LocalEstimatorFromSurfelFunctorAdapter::operator=
LocalEstimatorFromSurfelFunctorAdapter & operator=(const LocalEstimatorFromSurfelFunctorAdapter &other)
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:200
DGtal::LocalEstimatorFromSurfelFunctorAdapter::myEmbedder
Embedder myEmbedder
Embedder object.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:319
DGtal::LocalEstimatorFromSurfelFunctorAdapter::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::LocalEstimatorFromSurfelFunctorAdapter::FunctorOnSurfel
TFunctorOnSurfel FunctorOnSurfel
Functor on surfels type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:127
DGtal::Alias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: Alias.h:183
DGtal::LocalEstimatorFromSurfelFunctorAdapter::VertexFunctor
functors::Composer< Embedder, MetricToPoint, Value > VertexFunctor
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:153
DGtal::LocalEstimatorFromSurfelFunctorAdapter
Aim: this class adapts any local functor on digital surface element to define a local estimator....
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:104
DGtal::LocalEstimatorFromSurfelFunctorAdapter::Quantity
TFunctorOnSurfel::Quantity Quantity
Quantity type.
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:133
Point
MyPointD Point
Definition: testClone2.cpp:383
RealPoint
Z2i::RealPoint RealPoint
Definition: testAstroid2D.cpp:46
DGtal::LocalEstimatorFromSurfelFunctorAdapter::LocalEstimatorFromSurfelFunctorAdapter
LocalEstimatorFromSurfelFunctorAdapter(const LocalEstimatorFromSurfelFunctorAdapter &other)
Definition: LocalEstimatorFromSurfelFunctorAdapter.h:188
DGtal::concepts::CUnaryFunctor
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38