DGtal  1.4.beta
VoronoiMapComplete.h
1 
17 #pragma once
18 
34 #if defined(VoronoiMapComplete_RECURSES)
35 #error Recursive header files inclusion detected in VoronoiMapComplete.h
36 #else // defined(VoronoiMapComplete_RECURSES)
37 
38 #define VoronoiMapComplete_RECURSES
39 
40 #if !defined VoronoiMapComplete_h
41 
42 #define VoronoiMapComplete_h
43 
45 // Inclusions
46 #include <iostream>
47 #include <vector>
48 #include <array>
49 #include <set>
50 #include "DGtal/base/Common.h"
51 #include "DGtal/base/CountedPtr.h"
52 #include "DGtal/images/ImageContainerBySTLVector.h"
53 #include "DGtal/images/CImage.h"
54 #include "DGtal/kernel/CPointPredicate.h"
55 #include "DGtal/kernel/domains/HyperRectDomain.h"
56 #include "DGtal/geometry/volumes/distance/CSeparableMetric.h"
57 #include "DGtal/kernel/domains/HyperRectDomain.h"
58 #include "DGtal/base/ConstAlias.h"
60 
61 namespace DGtal
62 {
63 
65  // template class VoronoiMapComplete
128  template < typename TSpace,
129  typename TPointPredicate,
130  typename TSeparableMetric,
131  typename TImageContainer =
132  ImageContainerBySTLVector<HyperRectDomain<TSpace>,
133  std::set<typename TSpace::Vector> >
134  >
136  {
137 
138  public:
143 
145  BOOST_STATIC_ASSERT ((boost::is_same< typename TSpace::Point,
146  typename TPointPredicate::Point >::value ));
147 
148  //ImageContainer::Domain::Space must match with TSpace
149  BOOST_STATIC_ASSERT ((boost::is_same< TSpace,
150  typename TImageContainer::Domain::Space >::value ));
151 
152  //ImageContainer value type must be std::vector<TSpace::Vector>
153  BOOST_STATIC_ASSERT ((boost::is_same< std::set<typename TSpace::Vector>,
154  typename TImageContainer::Value >::value ));
155 
156  //ImageContainer domain type must be HyperRectangular
158  typename TImageContainer::Domain >::value ));
159 
161  typedef TSpace Space;
162 
164  typedef TPointPredicate PointPredicate;
165 
167  typedef typename TImageContainer::Domain Domain;
168 
170  typedef TSeparableMetric SeparableMetric;
171 
174 
175  typedef typename Space::Vector Vector;
176  typedef typename Space::Point Point;
177  typedef typename Space::Dimension Dimension;
178  typedef typename Space::Size Size;
180 
183 
185  typedef typename OutputImage::Value Value;
186 
189 
191  typedef VoronoiMapComplete< TSpace, TPointPredicate,
192  TSeparableMetric,TImageContainer > Self;
193 
194 
196  typedef std::array< bool, Space::dimension > PeriodicitySpec;
197 
218  ConstAlias<PointPredicate> predicate,
220 
246  ConstAlias<PointPredicate> predicate,
248  PeriodicitySpec const & aPeriodicitySpec);
252  ~VoronoiMapComplete() = default;
253 
257  VoronoiMapComplete() = delete;
258 
259  public:
260  // ------------------- ConstImage model ------------------------
261 
268  Self & operator=(const Self &aOtherVoronoiMap ) = default;
269 
274  const Domain & domain() const
275  {
276  return *myDomainPtr;
277  }
278 
284  {
285  return myImagePtr->constRange();
286  }
287 
294  Value operator()(const Point &aPoint) const
295  {
296  return myImagePtr->operator()(aPoint);
297  }
298 
302  const SeparableMetric* metric() const
303  {
304  return myMetricPtr;
305  }
306 
312  {
313  return myPeriodicitySpec;
314  }
315 
321  bool isPeriodic( const Dimension n ) const
322  {
323  return myPeriodicitySpec[ n ];
324  }
325 
336  Point projectPoint( Point aPoint ) const;
337 
343  void selfDisplay ( std::ostream & out ) const;
344 
345  // ------------------- Private functions ------------------------
346  private:
347 
354  void compute ( ) ;
355 
361  void computeOtherSteps(const Dimension dim) const;
371  void computeOtherStep1D (const Point &row,
372  const Dimension dim) const;
373 
385  typename Point::Coordinate projectCoordinate( typename Point::Coordinate aCoordinate, const Dimension aDim ) const;
386 
387  // ------------------- Private members ------------------------
388  private:
389 
392 
395 
398 
401 
404 
406  std::vector< Dimension > myPeriodicityIndex; // Could be boost::static_vector but it needs Boost >= 1.54.
407 
410 
411  protected:
412 
415 
418 
421 
422  }; // end of class VoronoiMapComplete
423 
430  template <typename S, typename P,
431  typename Sep, typename TI>
432  std::ostream&
433  operator<< ( std::ostream & out, const VoronoiMapComplete<S,P,Sep,TI> & object );
434 
435 
436 } // namespace DGtal
437 
438 
440 // Includes inline functions.
441 #include "DGtal/geometry/volumes/distance/VoronoiMapComplete.ih"
442 
443 // //
445 
446 #endif // !defined VoronoiMap_h
447 
448 #undef VoronoiMapComplete_RECURSES
449 #endif // else defined(VoronoiMapComplete_RECURSES)
DGtal::VoronoiMapComplete::PointPredicate
TPointPredicate PointPredicate
Copy of the point predicate type.
Definition: VoronoiMapComplete.h:164
DGtal::SpaceND::Dimension
DGtal::Dimension Dimension
Copy of the type used for the dimension.
Definition: SpaceND.h:129
DGtal::VoronoiMapComplete::myPeriodicitySpec
PeriodicitySpec myPeriodicitySpec
Periodicity along each dimension.
Definition: VoronoiMapComplete.h:420
DGtal::VoronoiMapComplete::Space
TSpace Space
Copy of the space type.
Definition: VoronoiMapComplete.h:161
DGtal::VoronoiMapComplete
Aim: Implementation of the linear in time Voronoi map construction.
Definition: VoronoiMapComplete.h:135
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
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Definition: HyperRectDomain.h:99
DGtal::VoronoiMapComplete::myImagePtr
CountedPtr< OutputImage > myImagePtr
Voronoi map image.
Definition: VoronoiMapComplete.h:417
DGtal::ImageContainerBySTLVector::Domain
TDomain Domain
Definition: ImageContainerBySTLVector.h:137
DGtal::concepts::CSpace
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:105
DGtal::SimpleRandomAccessConstRangeFromPoint
Aim: model of CConstBidirectionalRangeFromPoint that adapts any range of elements bounded by two iter...
Definition: SimpleRandomAccessConstRangeFromPoint.h:73
DGtal::VoronoiMapComplete::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
DGtal::ImageContainerBySTLVector::Value
TValue Value
Definition: ImageContainerBySTLVector.h:153
DGtal::VoronoiMapComplete::myInfinity
Point myInfinity
Value to act as a +infinity value.
Definition: VoronoiMapComplete.h:403
DGtal::ImageContainerBySTLVector
Definition: ImageContainerBySTLVector.h:126
DGtal::PointVector< dim, Integer >::Coordinate
Component Coordinate
Type for Point elements.
Definition: PointVector.h:617
DGtal::VoronoiMapComplete::operator=
Self & operator=(const Self &aOtherVoronoiMap)=default
DGtal::VoronoiMapComplete::myUpperBoundCopy
Point myUpperBoundCopy
Copy of the image lower bound.
Definition: VoronoiMapComplete.h:400
DGtal::VoronoiMapComplete::Point
Space::Point Point
Definition: VoronoiMapComplete.h:176
DGtal::VoronoiMapComplete::projectCoordinate
Point::Coordinate projectCoordinate(typename Point::Coordinate aCoordinate, const Dimension aDim) const
DGtal::VoronoiMapComplete::myPeriodicityIndex
std::vector< Dimension > myPeriodicityIndex
Index of the periodic dimensions.
Definition: VoronoiMapComplete.h:406
DGtal::VoronoiMapComplete::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< typename TSpace::Point, typename TPointPredicate::Point >::value))
Both Space points and PointPredicate points must be the same.
DGtal::VoronoiMapComplete::Domain
TImageContainer::Domain Domain
Definition of the underlying domain type.
Definition: VoronoiMapComplete.h:167
DGtal::VoronoiMapComplete::constRange
ConstRange constRange() const
Definition: VoronoiMapComplete.h:283
DGtal::VoronoiMapComplete::myPointPredicatePtr
const PointPredicate * myPointPredicatePtr
Pointer to the point predicate.
Definition: VoronoiMapComplete.h:394
aPoint
const Point aPoint(3, 4)
DGtal::VoronoiMapComplete::OutputImage
TImageContainer OutputImage
Type of resulting image.
Definition: VoronoiMapComplete.h:182
DGtal::ImageContainerBySTLVector::constRange
ConstRange constRange() const
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::VoronoiMapComplete::computeOtherStep1D
void computeOtherStep1D(const Point &row, const Dimension dim) const
DGtal::SpaceND::Size
size_t Size
Type used to represent sizes in the digital space.
Definition: SpaceND.h:107
DGtal::VoronoiMapComplete::ConstRange
OutputImage::ConstRange ConstRange
Definition of the image value type.
Definition: VoronoiMapComplete.h:188
DGtal::VoronoiMapComplete::myLowerBoundCopy
Point myLowerBoundCopy
Copy of the image lower bound.
Definition: VoronoiMapComplete.h:397
dim
unsigned int dim(const Vector &z)
Definition: viewDualSurface.cpp:174
DGtal::VoronoiMapComplete::isPeriodic
bool isPeriodic(const Dimension n) const
Definition: VoronoiMapComplete.h:321
DGtal::VoronoiMapComplete::myDomainExtent
Point myDomainExtent
Domain extent.
Definition: VoronoiMapComplete.h:409
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::VoronoiMapComplete::compute
void compute()
DGtal::VoronoiMapComplete::domain
const Domain & domain() const
Definition: VoronoiMapComplete.h:274
DGtal::VoronoiMapComplete::getPeriodicitySpec
const PeriodicitySpec & getPeriodicitySpec() const
Definition: VoronoiMapComplete.h:311
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::VoronoiMapComplete::Self
VoronoiMapComplete< TSpace, TPointPredicate, TSeparableMetric, TImageContainer > Self
Self type.
Definition: VoronoiMapComplete.h:192
DGtal::VoronoiMapComplete::Dimension
Space::Dimension Dimension
Definition: VoronoiMapComplete.h:177
DGtal::VoronoiMapComplete::Vector
Space::Vector Vector
Definition: VoronoiMapComplete.h:175
DGtal::VoronoiMapComplete::SeparableMetric
TSeparableMetric SeparableMetric
Definition of the separable metric type.
Definition: VoronoiMapComplete.h:170
DGtal::VoronoiMapComplete::~VoronoiMapComplete
~VoronoiMapComplete()=default
DGtal::CountedPtr< OutputImage >
DGtal::VoronoiMapComplete::metric
const SeparableMetric * metric() const
Definition: VoronoiMapComplete.h:302
DGtal::VoronoiMapComplete::PeriodicitySpec
std::array< bool, Space::dimension > PeriodicitySpec
Periodicity specification type.
Definition: VoronoiMapComplete.h:196
DGtal::VoronoiMapComplete::myMetricPtr
const SeparableMetric * myMetricPtr
Pointer to the separable metric instance.
Definition: VoronoiMapComplete.h:414
DGtal::VoronoiMapComplete::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::VoronoiMapComplete::myDomainPtr
const Domain * myDomainPtr
Pointer to the computation domain.
Definition: VoronoiMapComplete.h:391
DGtal::PointVector< dim, Integer >
DGtal::VoronoiMapComplete::Size
Space::Size Size
Definition: VoronoiMapComplete.h:178
DGtal::concepts::CPointPredicate
Aim: Defines a predicate on a point.
Definition: CPointPredicate.h:80
Space
SpaceND< 2 > Space
Definition: testSimpleRandomAccessRangeFromPoint.cpp:42
DGtal::VoronoiMapComplete::Abscissa
Space::Point::Coordinate Abscissa
Definition: VoronoiMapComplete.h:179
DGtal::VoronoiMapComplete::VoronoiMapComplete
VoronoiMapComplete()=delete
DGtal::int64_t
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
DGtal::VoronoiMapComplete::projectPoint
Point projectPoint(Point aPoint) const
DGtal::VoronoiMapComplete::Value
OutputImage::Value Value
Definition of the image value type.
Definition: VoronoiMapComplete.h:185
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::concepts::CSeparableMetric
Aim: defines the concept of separable metrics.
Definition: CSeparableMetric.h:101
DGtal::VoronoiMapComplete::operator()
Value operator()(const Point &aPoint) const
Definition: VoronoiMapComplete.h:294
DGtal::VoronoiMapComplete::IntegerLong
DGtal::int64_t IntegerLong
Large integer type for SeparableMetricHelper construction.
Definition: VoronoiMapComplete.h:173
DGtal::VoronoiMapComplete::computeOtherSteps
void computeOtherSteps(const Dimension dim) const
DGtal::concepts::CImage
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:102