DGtal  1.3.beta
VoronoiCovarianceMeasure.h
1 
17 #pragma once
18 
31 #if defined(VoronoiCovarianceMeasure_RECURSES)
32 #error Recursive header files inclusion detected in VoronoiCovarianceMeasure.h
33 #else // defined(VoronoiCovarianceMeasure_RECURSES)
34 
35 #define VoronoiCovarianceMeasure_RECURSES
36 
37 #if !defined VoronoiCovarianceMeasure_h
38 
39 #define VoronoiCovarianceMeasure_h
40 
42 // Inclusions
43 #include <cmath>
44 #include <iostream>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/math/BasicMathFunctions.h"
47 #include "DGtal/kernel/BasicPointPredicates.h"
48 #include "DGtal/kernel/domains/HyperRectDomain.h"
49 #include "DGtal/math/linalg/SimpleMatrix.h"
50 #include "DGtal/kernel/Point2ScalarFunctors.h"
51 #include "DGtal/images/ImageContainerBySTLVector.h"
52 #include "DGtal/geometry/volumes/distance/VoronoiMap.h"
53 #include "DGtal/geometry/tools/SpatialCubicalSubdivision.h"
55 
56 namespace DGtal
57 {
58 
60  // template class VoronoiCovarianceMeasure
78  template <typename TSpace, typename TSeparableMetric>
80  {
83 
84  public:
85  typedef TSpace Space;
86  typedef TSeparableMetric Metric;
87  typedef typename Space::Point Point;
88  typedef typename Space::Size Size;
89  typedef typename Space::Integer Integer;
93 
101  typedef typename Space::Point Point;
104  CharacteristicSetPredicate( const Self& other ) : ptrSet( other.ptrSet ) {}
105  Self& operator=( const Self& other ) { ptrSet = other.ptrSet; return *this; }
106  bool operator()( const Point& p ) const
107  {
108  ASSERT( ptrSet != 0 );
109  return (*ptrSet)( p );
110  }
111  private:
113  };
116 
117  typedef double Scalar;
118  typedef DGtal::SimpleMatrix< Scalar,
121  typedef typename MatrixNN::RowVector VectorN;
122  typedef std::vector<Point> PointContainer;
123  typedef std::map<Point,MatrixNN> Point2MatrixNN;
124 
125  // ----------------------- Standard services ------------------------------
126  public:
127 
143  VoronoiCovarianceMeasure( double _R, double _r, Metric aMetric = Metric(), bool verbose = false );
144 
149 
152  Scalar R() const;
155  Scalar r() const;
156 
161  void clean();
162 
172  template <typename PointInputIterator>
173  void init( PointInputIterator itb, PointInputIterator ite );
174 
176  const Domain& domain() const;
177 
180  const Voronoi& voronoiMap() const;
181 
185  const Point2MatrixNN& vcmMap() const;
186 
200  template <typename Point2ScalarFunction>
201  MatrixNN measure( Point2ScalarFunction chi_r, Point p ) const;
202 
203  // ----------------------- Interface --------------------------------------
204  public:
205 
210  void selfDisplay ( std::ostream & out ) const;
211 
216  bool isValid() const;
217 
218  // ------------------------- Protected Datas ------------------------------
219  private:
220  // ------------------------- Private Datas --------------------------------
221  private:
222 
224  double myBigR;
227  double mySmallR;
231  bool myVerbose;
242 
243  // ------------------------- Hidden services ------------------------------
244  protected:
245 
251 
252  private:
253 
260 
268 
269  // ------------------------- Internals ------------------------------------
270  private:
271 
272  }; // end of class VoronoiCovarianceMeasure
273 
274 
281  template <typename TSpace, typename TSeparableMetric>
282  std::ostream&
283  operator<< ( std::ostream & out,
285 
286 } // namespace DGtal
287 
288 
290 // Includes inline functions.
291 #include "DGtal/geometry/volumes/estimation/VoronoiCovarianceMeasure.ih"
292 
293 // //
295 
296 #endif // !defined VoronoiCovarianceMeasure_h
297 
298 #undef VoronoiCovarianceMeasure_RECURSES
299 #endif // else defined(VoronoiCovarianceMeasure_RECURSES)
DGtal::VoronoiCovarianceMeasure::CharacteristicSet
DGtal::ImageContainerBySTLVector< Domain, bool > CharacteristicSet
the type of a binary image that is the characteristic function of K.
Definition: VoronoiCovarianceMeasure.h:91
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::operator()
bool operator()(const Point &p) const
Definition: VoronoiCovarianceMeasure.h:106
DGtal::VoronoiCovarianceMeasure::Scalar
double Scalar
the type for "real" numbers.
Definition: VoronoiCovarianceMeasure.h:117
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::HyperRectDomain< Space >
DGtal::VoronoiCovarianceMeasure::Size
Space::Size Size
the type for counting elements
Definition: VoronoiCovarianceMeasure.h:88
DGtal::concepts::CSpace
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:105
DGtal::VoronoiMap
Aim: Implementation of the linear in time Voronoi map construction.
Definition: VoronoiMap.h:126
DGtal::VoronoiCovarianceMeasure::vcmMap
const Point2MatrixNN & vcmMap() const
DGtal::ImageContainerBySTLVector
Definition: ImageContainerBySTLVector.h:126
DGtal::VoronoiCovarianceMeasure::myVerbose
bool myVerbose
Tells if it is verbose mode.
Definition: VoronoiCovarianceMeasure.h:231
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::CharacteristicSetPredicate
CharacteristicSetPredicate(ConstAlias< CharacteristicSet > aSet)
Definition: VoronoiCovarianceMeasure.h:103
DGtal::VoronoiCovarianceMeasure::myCharSet
CharacteristicSet * myCharSet
A binary image that defines the characteristic set of K.
Definition: VoronoiCovarianceMeasure.h:235
DGtal::VoronoiCovarianceMeasure::operator=
VoronoiCovarianceMeasure & operator=(const VoronoiCovarianceMeasure &other)
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::CharacteristicSetPredicate
CharacteristicSetPredicate()
Definition: VoronoiCovarianceMeasure.h:102
DGtal::VoronoiCovarianceMeasure::Point2MatrixNN
std::map< Point, MatrixNN > Point2MatrixNN
Associates a matrix to points.
Definition: VoronoiCovarianceMeasure.h:123
DGtal::VoronoiCovarianceMeasure::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::SpaceND::Size
size_t Size
Type used to represent sizes in the digital space.
Definition: SpaceND.h:107
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::ptrSet
const CharacteristicSet * ptrSet
Definition: VoronoiCovarianceMeasure.h:112
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::operator=
Self & operator=(const Self &other)
Definition: VoronoiCovarianceMeasure.h:105
DGtal::VoronoiCovarianceMeasure::init
void init(PointInputIterator itb, PointInputIterator ite)
DGtal::SpatialCubicalSubdivision
Aim: This class is a data structure that subdivides a rectangular domains into cubical domains of siz...
Definition: SpatialCubicalSubdivision.h:72
DGtal::VoronoiCovarianceMeasure::~VoronoiCovarianceMeasure
~VoronoiCovarianceMeasure()
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::VoronoiCovarianceMeasure::voronoiMap
const Voronoi & voronoiMap() const
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::CharacteristicSetPredicate
CharacteristicSetPredicate(const Self &other)
Definition: VoronoiCovarianceMeasure.h:104
DGtal::VoronoiCovarianceMeasure::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
DGtal::VoronoiCovarianceMeasure::measure
MatrixNN measure(Point2ScalarFunction chi_r, Point p) const
DGtal::VoronoiCovarianceMeasure::Metric
TSeparableMetric Metric
the type of metric
Definition: VoronoiCovarianceMeasure.h:86
DGtal::SimpleMatrix
Aim: implements basic MxN Matrix services (M,N>=1).
Definition: SimpleMatrix.h:75
DGtal::VoronoiCovarianceMeasure::myVoronoi
Voronoi * myVoronoi
Stores the voronoi map.
Definition: VoronoiCovarianceMeasure.h:237
DGtal::VoronoiCovarianceMeasure::isValid
bool isValid() const
DGtal::VoronoiCovarianceMeasure::domain
const Domain & domain() const
DGtal::VoronoiCovarianceMeasure::myBigR
double myBigR
The parameter R in the VCM, i.e. the offset radius for the compact set K.
Definition: VoronoiCovarianceMeasure.h:224
DGtal::VoronoiCovarianceMeasure::MatrixNN
DGtal::SimpleMatrix< Scalar, Space::dimension, Space::dimension > MatrixNN
the type for nxn matrix of real numbers.
Definition: VoronoiCovarianceMeasure.h:120
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::VoronoiCovarianceMeasure::Space
TSpace Space
the type of digital space
Definition: VoronoiCovarianceMeasure.h:85
DGtal::VoronoiCovarianceMeasure::ProximityStructure
DGtal::SpatialCubicalSubdivision< Space > ProximityStructure
the structure used for proximity queries.
Definition: VoronoiCovarianceMeasure.h:92
DGtal::VoronoiCovarianceMeasure::Point
Space::Point Point
the type of digital point
Definition: VoronoiCovarianceMeasure.h:87
DGtal::VoronoiCovarianceMeasure::VectorN
MatrixNN::RowVector VectorN
the type for N-vector of real numbers
Definition: VoronoiCovarianceMeasure.h:121
DGtal::VoronoiCovarianceMeasure::myDomain
Domain myDomain
The domain in which all computations are done.
Definition: VoronoiCovarianceMeasure.h:233
DGtal::SpaceND::dimension
static const Dimension dimension
static constants to store the dimension.
Definition: SpaceND.h:132
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::Point
Space::Point Point
the type of digital point
Definition: VoronoiCovarianceMeasure.h:101
DGtal::VoronoiCovarianceMeasure
Aim: This class precomputes the Voronoi Covariance Measure of a set of points. It can compute the cov...
Definition: VoronoiCovarianceMeasure.h:79
DGtal::VoronoiCovarianceMeasure::clean
void clean()
DGtal::VoronoiCovarianceMeasure::R
Scalar R() const
DGtal::VoronoiCovarianceMeasure::NotPredicate
DGtal::functors::NotPointPredicate< CharacteristicSetPredicate > NotPredicate
the type of the point predicate used by the voronoi map.
Definition: VoronoiCovarianceMeasure.h:114
DGtal::functors::NotPointPredicate
Aim: The predicate returns true when the point predicate given at construction return false....
Definition: BasicPointPredicates.h:207
DGtal::VoronoiCovarianceMeasure::VoronoiCovarianceMeasure
VoronoiCovarianceMeasure()
DGtal::PointVector< dim, Integer >
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate::Self
CharacteristicSetPredicate Self
Definition: VoronoiCovarianceMeasure.h:100
DGtal::VoronoiCovarianceMeasure::PointContainer
std::vector< Point > PointContainer
the list of points
Definition: VoronoiCovarianceMeasure.h:122
DGtal::VoronoiCovarianceMeasure::Integer
Space::Integer Integer
the type of each digital point coordinate, some integral type
Definition: VoronoiCovarianceMeasure.h:89
DGtal::VoronoiCovarianceMeasure::mySmallR
double mySmallR
Definition: VoronoiCovarianceMeasure.h:227
DGtal::VoronoiCovarianceMeasure::myMetric
Metric myMetric
The metric chosen for the Voronoi map.
Definition: VoronoiCovarianceMeasure.h:229
DGtal::VoronoiCovarianceMeasure::myVCM
Point2MatrixNN myVCM
The map point -> VCM.
Definition: VoronoiCovarianceMeasure.h:239
DGtal::VoronoiCovarianceMeasure::Domain
DGtal::HyperRectDomain< Space > Domain
the type of rectangular domain of the VCM.
Definition: VoronoiCovarianceMeasure.h:90
DGtal::VoronoiCovarianceMeasure::r
Scalar r() const
DGtal::concepts::CSeparableMetric
Aim: defines the concept of separable metrics.
Definition: CSeparableMetric.h:101
DGtal::VoronoiCovarianceMeasure::CharacteristicSetPredicate
Definition: VoronoiCovarianceMeasure.h:99
DGtal::SpaceND::Integer
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
DGtal::VoronoiCovarianceMeasure::Voronoi
DGtal::VoronoiMap< Space, NotPredicate, Metric > Voronoi
the type of the Voronoi map.
Definition: VoronoiCovarianceMeasure.h:115
DGtal::VoronoiCovarianceMeasure::myProximityStructure
ProximityStructure * myProximityStructure
The structure used for proximity queries.
Definition: VoronoiCovarianceMeasure.h:241