DGtal 1.3.0
Loading...
Searching...
No Matches
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)
35#define VoronoiCovarianceMeasure_RECURSES
36
37#if !defined VoronoiCovarianceMeasure_h
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
56namespace 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;
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;
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: implements basic MxN Matrix services (M,N>=1).
Definition: SimpleMatrix.h:76
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
size_t Size
Type used to represent sizes in the digital space.
Definition: SpaceND.h:107
static const Dimension dimension
static constants to store the dimension.
Definition: SpaceND.h:132
Aim: This class is a data structure that subdivides a rectangular domains into cubical domains of siz...
Aim: This class precomputes the Voronoi Covariance Measure of a set of points. It can compute the cov...
DGtal::ImageContainerBySTLVector< Domain, bool > CharacteristicSet
the type of a binary image that is the characteristic function of K.
VoronoiCovarianceMeasure(const VoronoiCovarianceMeasure &other)
MatrixNN::RowVector VectorN
the type for N-vector of real numbers
DGtal::HyperRectDomain< Space > Domain
the type of rectangular domain of the VCM.
ProximityStructure * myProximityStructure
The structure used for proximity queries.
MatrixNN measure(Point2ScalarFunction chi_r, Point p) const
Space::Integer Integer
the type of each digital point coordinate, some integral type
VoronoiCovarianceMeasure(double _R, double _r, Metric aMetric=Metric(), bool verbose=false)
DGtal::SpatialCubicalSubdivision< Space > ProximityStructure
the structure used for proximity queries.
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
std::map< Point, MatrixNN > Point2MatrixNN
Associates a matrix to points.
const Voronoi & voronoiMap() const
const Point2MatrixNN & vcmMap() const
Voronoi * myVoronoi
Stores the voronoi map.
Space::Point Point
the type of digital point
DGtal::functors::NotPointPredicate< CharacteristicSetPredicate > NotPredicate
the type of the point predicate used by the voronoi map.
VoronoiCovarianceMeasure & operator=(const VoronoiCovarianceMeasure &other)
Metric myMetric
The metric chosen for the Voronoi map.
DGtal::VoronoiMap< Space, NotPredicate, Metric > Voronoi
the type of the Voronoi map.
void init(PointInputIterator itb, PointInputIterator ite)
CharacteristicSet * myCharSet
A binary image that defines the characteristic set of K.
void selfDisplay(std::ostream &out) const
Domain myDomain
The domain in which all computations are done.
const Domain & domain() const
std::vector< Point > PointContainer
the list of points
bool myVerbose
Tells if it is verbose mode.
double Scalar
the type for "real" numbers.
BOOST_CONCEPT_ASSERT((concepts::CSeparableMetric< TSeparableMetric >))
Point2MatrixNN myVCM
The map point -> VCM.
TSeparableMetric Metric
the type of metric
DGtal::SimpleMatrix< Scalar, Space::dimension, Space::dimension > MatrixNN
the type for nxn matrix of real numbers.
TSpace Space
the type of digital space
double myBigR
The parameter R in the VCM, i.e. the offset radius for the compact set K.
Space::Size Size
the type for counting elements
Aim: Implementation of the linear in time Voronoi map construction.
Definition: VoronoiMap.h:127
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: defines the concept of separable metrics.
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:106
Aim: The predicate returns true when the point predicate given at construction return false....