DGtal  1.3.beta
FMMPointFunctors.h
1 
17 #pragma once
18 
34 #if defined(FMMPointFunctors_RECURSES)
35 #error Recursive header files inclusion detected in FMMPointFunctors.h
36 #else // defined(FMMPointFunctors_RECURSES)
37 
38 #define FMMPointFunctors_RECURSES
39 
40 #if !defined FMMPointFunctors_h
41 
42 #define FMMPointFunctors_h
43 
45 // Inclusions
46 #include <iostream>
47 #include <limits>
48 #include <vector>
49 #include <queue>
50 #include "DGtal/base/Common.h"
51 #include "DGtal/base/ConstAlias.h"
52 
53 #include "DGtal/kernel/sets/CDigitalSet.h"
54 #include "DGtal/kernel/CPointFunctor.h"
55 #include "DGtal/images/CImage.h"
56 #include "DGtal/images/ImageHelper.h"
58 
59 namespace DGtal
60 {
61 
64  // template class L2FirstOrderLocalDistance
92  template <typename TImage, typename TSet>
94  {
95 
96  // ----------------------- Types ------------------------------
97  public:
98 
99 
102  typedef TImage Image;
103  typedef typename Image::Point Point;
104  typedef typename Image::Value Value;
105 
108  typedef TSet Set;
109  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
110 
111  private:
112 
113  typedef std::vector<Value> Values;
114 
115  // ----------------------- Data -------------------------------------
116  public:
121 
122 
123  // ----------------------- Interface --------------------------------------
124  public:
125 
133  L2FirstOrderLocalDistance(Image& aImg, TSet& aSet);
134 
140 
147 
153 
164  Value operator() (const Point& aPoint);
165 
170  void selfDisplay ( std::ostream & out ) const;
171 
172  // ----------------------- Internals -------------------------------------
173 
174  private:
175 
183  Value compute(Values& aValueList) const;
184 
185 
195  Value gradientNorm(const Value& aValue, const Values& aValueList) const;
196  };
197 
199  // template class L2SecondOrderLocalDistance
227  template <typename TImage, typename TSet>
229  {
230 
231  // ----------------------- Types ------------------------------
232  public:
233 
234 
237  typedef TImage Image;
238  typedef typename Image::Point Point;
239  typedef typename Image::Value Value;
240 
243  typedef TSet Set;
244  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
245 
246  private:
247 
248  typedef std::pair<double, Value> CoeffValue;
249  typedef std::vector<CoeffValue> List;
250 
251  // ----------------------- Data -------------------------------------
252  public:
257 
258 
259  // ----------------------- Interface --------------------------------------
260  public:
261 
269  L2SecondOrderLocalDistance(Image& aImg, TSet& aSet);
270 
276 
283 
289 
300  Value operator() (const Point& aPoint);
301 
306  void selfDisplay ( std::ostream & out ) const;
307 
308  // ----------------------- Internals -------------------------------------
309 
310  private:
311 
319  Value compute(List& aList) const;
320 
321 
331  Value getValue(const Value& aValue1, const Value& aValue2) const;
332  };
333 
334 
336  // template class LInfLocalDistance
356  template <typename TImage, typename TSet>
358  {
359  // ----------------------- Types ------------------------------
360  public:
361 
362 
365  typedef TImage Image;
366  typedef typename Image::Point Point;
367  typedef typename Image::Value Value;
368 
371  typedef TSet Set;
372  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
373 
374  private:
375 
376  typedef std::vector<Value> Values;
377 
378  // ----------------------- Data -------------------------------------
379  public:
384 
385 
386  // ----------------------- Interface --------------------------------------
387  public:
388 
396  LInfLocalDistance(Image& aImg, TSet& aSet);
397 
402  LInfLocalDistance ( const LInfLocalDistance & other );
403 
410 
416 
417 
428  Value operator() (const Point& aPoint);
429 
434  void selfDisplay ( std::ostream & out ) const;
435 
436  // ----------------------- Internals -------------------------------------
437 
438  private:
439 
447  Value compute(Values& aValueList) const;
448 
449  };
450 
452  // template class L1LocalDistance
471  template <typename TImage, typename TSet>
473  {
474  // ----------------------- Types ------------------------------
475  public:
476 
477 
480  typedef TImage Image;
481  typedef typename Image::Point Point;
482  typedef typename Image::Value Value;
483 
486  typedef TSet Set;
487  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
488 
489  private:
490 
491  typedef std::vector<Value> Values;
492 
493  // ----------------------- Data -------------------------------------
494  public:
499 
500  // ----------------------- Interface --------------------------------------
501  public:
502 
510  L1LocalDistance(Image& aImg, TSet& aSet);
511 
516  L1LocalDistance ( const L1LocalDistance & other );
517 
523  L1LocalDistance & operator= ( const L1LocalDistance & other);
524 
529  ~L1LocalDistance();
530 
540  Value operator() (const Point& aPoint);
541 
546  void selfDisplay ( std::ostream & out ) const;
547 
548  // ----------------------- Internals -------------------------------------
549 
550  private:
551 
559  Value compute(Values& aValueList) const;
560 
561  };
562 
563 
565  // template class L2FirstOrderLocalDistanceFromCells
584  template <typename TKSpace, typename TMap, bool isIndirect = false>
586  {
587 
588  // ----------------------- Types ------------------------------
589  public:
590 
591 
593  typedef TMap Map;
594  typedef typename Map::mapped_type Value;
595 
597  typedef TKSpace KSpace;
598  typedef typename KSpace::Point Point;
599  typedef typename KSpace::Cell Cell;
600 
601  private:
602 
603  typedef std::vector<Value> Values;
604 
605  // ----------------------- Data -------------------------------------
606  public:
608  const KSpace* myKSpace;
611 
612  // ----------------------- Interface --------------------------------------
613  public:
614 
623 
629 
636 
642 
653  Value operator() (const Point& aPoint);
654 
659  void selfDisplay ( std::ostream & out ) const;
660 
661  // ----------------------- Internals -------------------------------------
662 
663  private:
664 
673  Value compute(Values& aValueList) const;
674 
675  };
676 
677 
679  // template class SpeedExtrapolator
703  template <typename TDistanceImage, typename TSet, typename TSpeedFunctor>
705  {
706 
707  // ----------------------- Types ------------------------------
708  public:
709 
710 
713  typedef TDistanceImage DistanceImage;
714  typedef typename DistanceImage::Point Point;
717  typedef TSpeedFunctor SpeedFunctor;
718  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename SpeedFunctor::Point >::value ));
719  typedef typename SpeedFunctor::Value Value;
720 
723  typedef TSet Set;
724  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
725 
726  // ----------------------- Data -------------------------------------
727  public:
732  const Set* mySetPtr;
735 
736 
737  // ----------------------- Interface --------------------------------------
738  public:
739 
748  SpeedExtrapolator(const DistanceImage& aDistImg, const TSet& aSet, SpeedFunctor& aSpeedFunc);
749 
754  SpeedExtrapolator ( const SpeedExtrapolator & other );
755 
762 
768 
779  Value operator() (const Point& aPoint);
780 
781 
782  };
783 
784 
785 } // namespace DGtal
786 
787 
789 // Includes inline functions.
790 #include "DGtal/geometry/volumes/distance/FMMPointFunctors.ih"
791 
792 // //
794 
795 #endif // !defined FMMPointFunctors_h
796 
797 #undef FMMPointFunctors_RECURSES
798 #endif // else defined(FMMPointFunctors_RECURSES)
DGtal::SpeedExtrapolator::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, typename SpeedFunctor::Point >::value))
DGtal::L1LocalDistance::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::L2SecondOrderLocalDistance::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
DGtal::SpeedExtrapolator::operator()
Value operator()(const Point &aPoint)
DGtal::L2FirstOrderLocalDistance::gradientNorm
Value gradientNorm(const Value &aValue, const Values &aValueList) const
DGtal::SpeedExtrapolator::Value
SpeedFunctor::Value Value
Definition: FMMPointFunctors.h:719
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::L2FirstOrderLocalDistanceFromCells::compute
Value compute(Values &aValueList) const
DGtal::L1LocalDistance::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
DGtal::L2SecondOrderLocalDistance::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
DGtal::SpeedExtrapolator::Set
TSet Set
Definition: FMMPointFunctors.h:723
DGtal::ImageContainerBySTLVector< Domain, Value >::Value
Value Value
Definition: ImageContainerBySTLVector.h:153
DGtal::L2SecondOrderLocalDistance::getValue
Value getValue(const Value &aValue1, const Value &aValue2) const
DGtal::L2FirstOrderLocalDistance::Point
Image::Point Point
Definition: FMMPointFunctors.h:103
DGtal::L2FirstOrderLocalDistanceFromCells::myMap
Map * myMap
Aliasing pointer on the underlying mapping.
Definition: FMMPointFunctors.h:610
DGtal::LInfLocalDistance::Set
TSet Set
Definition: FMMPointFunctors.h:371
DGtal::L2FirstOrderLocalDistance::Values
std::vector< Value > Values
Definition: FMMPointFunctors.h:113
DGtal::L2SecondOrderLocalDistance::operator()
Value operator()(const Point &aPoint)
DGtal::L2FirstOrderLocalDistanceFromCells::Map
TMap Map
map
Definition: FMMPointFunctors.h:593
DGtal::L2FirstOrderLocalDistanceFromCells::Value
Map::mapped_type Value
Definition: FMMPointFunctors.h:594
DGtal::L2SecondOrderLocalDistance::myImgPtr
Image * myImgPtr
Aliasing pointer on the underlying image.
Definition: FMMPointFunctors.h:254
DGtal::L2FirstOrderLocalDistanceFromCells::Cell
KSpace::Cell Cell
Definition: FMMPointFunctors.h:599
aPoint
const Point aPoint(3, 4)
DGtal::SpeedExtrapolator::~SpeedExtrapolator
~SpeedExtrapolator()
DGtal::LInfLocalDistance::LInfLocalDistance
LInfLocalDistance(Image &aImg, TSet &aSet)
DGtal::LInfLocalDistance::myImgPtr
Image * myImgPtr
Aliasing pointer on the underlying image.
Definition: FMMPointFunctors.h:381
DGtal::LInfLocalDistance::Value
Image::Value Value
Definition: FMMPointFunctors.h:367
DGtal::L1LocalDistance::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
DGtal::LInfLocalDistance::Values
std::vector< Value > Values
Definition: FMMPointFunctors.h:376
DGtal::L2SecondOrderLocalDistance
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
Definition: FMMPointFunctors.h:228
DGtal::L2SecondOrderLocalDistance::Set
TSet Set
Definition: FMMPointFunctors.h:243
DGtal::L2SecondOrderLocalDistance::List
std::vector< CoeffValue > List
Definition: FMMPointFunctors.h:249
DGtal::LInfLocalDistance::operator=
LInfLocalDistance & operator=(const LInfLocalDistance &other)
DGtal::L2SecondOrderLocalDistance::Value
Image::Value Value
Definition: FMMPointFunctors.h:239
DGtal::LInfLocalDistance::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
DGtal::L2SecondOrderLocalDistance::L2SecondOrderLocalDistance
L2SecondOrderLocalDistance(Image &aImg, TSet &aSet)
DGtal::L1LocalDistance::Set
TSet Set
Definition: FMMPointFunctors.h:486
DGtal::L2FirstOrderLocalDistance::L2FirstOrderLocalDistance
L2FirstOrderLocalDistance(Image &aImg, TSet &aSet)
DGtal::SpeedExtrapolator::mySetPtr
const Set * mySetPtr
Definition: FMMPointFunctors.h:732
DGtal::L2FirstOrderLocalDistance::operator=
L2FirstOrderLocalDistance & operator=(const L2FirstOrderLocalDistance &other)
DGtal::SpeedExtrapolator::myDistImgPtr
const DistanceImage * myDistImgPtr
Aliasing pointer on the underlying image of distance values.
Definition: FMMPointFunctors.h:729
DGtal::L1LocalDistance::myImgPtr
Image * myImgPtr
Aliasing pointer on the underlying image.
Definition: FMMPointFunctors.h:496
DGtal::LInfLocalDistance
Aim: Class for the computation of the LInf-distance at some point p, from the available distance valu...
Definition: FMMPointFunctors.h:357
DGtal::L2SecondOrderLocalDistance::operator=
L2SecondOrderLocalDistance & operator=(const L2SecondOrderLocalDistance &other)
DGtal::SpeedExtrapolator::DistanceValue
DistanceImage::Value DistanceValue
Definition: FMMPointFunctors.h:715
DGtal::LInfLocalDistance::operator()
Value operator()(const Point &aPoint)
DGtal::L2FirstOrderLocalDistance::Value
Image::Value Value
Definition: FMMPointFunctors.h:104
DGtal::L2FirstOrderLocalDistance::Image
TImage Image
Definition: FMMPointFunctors.h:102
DGtal::L2SecondOrderLocalDistance::mySetPtr
Set * mySetPtr
Aliasing pointer on the underlying set.
Definition: FMMPointFunctors.h:256
DGtal::SpeedExtrapolator
Aim: Class for the computation of the a speed value at some point p, from the available distance valu...
Definition: FMMPointFunctors.h:704
DGtal::SpeedExtrapolator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CImage< TDistanceImage >))
image
DGtal::L2SecondOrderLocalDistance::compute
Value compute(List &aList) const
DGtal::LInfLocalDistance::compute
Value compute(Values &aValueList) const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::LInfLocalDistance::Point
Image::Point Point
Definition: FMMPointFunctors.h:366
DGtal::L1LocalDistance::Value
Image::Value Value
Definition: FMMPointFunctors.h:482
DGtal::L2SecondOrderLocalDistance::~L2SecondOrderLocalDistance
~L2SecondOrderLocalDistance()
DGtal::L2FirstOrderLocalDistanceFromCells::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::L2FirstOrderLocalDistance::operator()
Value operator()(const Point &aPoint)
DGtal::L2FirstOrderLocalDistanceFromCells::Values
std::vector< Value > Values
Definition: FMMPointFunctors.h:603
DGtal::L2SecondOrderLocalDistance::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::L1LocalDistance::~L1LocalDistance
~L1LocalDistance()
DGtal::L1LocalDistance::compute
Value compute(Values &aValueList) const
DGtal::L2FirstOrderLocalDistance::Set
TSet Set
Definition: FMMPointFunctors.h:108
DGtal::L1LocalDistance::Values
std::vector< Value > Values
Definition: FMMPointFunctors.h:491
DGtal::L2FirstOrderLocalDistance::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
DGtal::L2FirstOrderLocalDistanceFromCells::myKSpace
const KSpace * myKSpace
Aliasing pointer on the underlying cellular grid.
Definition: FMMPointFunctors.h:608
DGtal::L2FirstOrderLocalDistance::mySetPtr
Set * mySetPtr
Aliasing pointer on the underlying set.
Definition: FMMPointFunctors.h:120
DGtal::L2FirstOrderLocalDistance
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
Definition: FMMPointFunctors.h:93
DGtal::L2FirstOrderLocalDistanceFromCells::~L2FirstOrderLocalDistanceFromCells
~L2FirstOrderLocalDistanceFromCells()
DGtal::LInfLocalDistance::mySetPtr
Set * mySetPtr
Aliasing pointer on the underlying set.
Definition: FMMPointFunctors.h:383
DGtal::L2FirstOrderLocalDistance::myImgPtr
Image * myImgPtr
Aliasing pointer on the underlying image.
Definition: FMMPointFunctors.h:118
DGtal::LInfLocalDistance::Image
TImage Image
Definition: FMMPointFunctors.h:365
DGtal::L2FirstOrderLocalDistance::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::SpeedExtrapolator::operator=
SpeedExtrapolator & operator=(const SpeedExtrapolator &other)
DGtal::LInfLocalDistance::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::L1LocalDistance
Aim: Class for the computation of the L1-distance at some point p, from the available distance values...
Definition: FMMPointFunctors.h:472
DGtal::L2FirstOrderLocalDistance::~L2FirstOrderLocalDistance
~L2FirstOrderLocalDistance()
DGtal::L2SecondOrderLocalDistance::Image
TImage Image
Definition: FMMPointFunctors.h:237
DGtal::LInfLocalDistance::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
DGtal::L1LocalDistance::operator=
L1LocalDistance & operator=(const L1LocalDistance &other)
DGtal::PointVector< dim, Integer >
DGtal::concepts::CPointFunctor
Aim: Defines a functor on points.
Definition: CPointFunctor.h:88
DGtal::L2SecondOrderLocalDistance::CoeffValue
std::pair< double, Value > CoeffValue
Definition: FMMPointFunctors.h:248
DGtal::SpeedExtrapolator::Point
DistanceImage::Point Point
Definition: FMMPointFunctors.h:714
DGtal::LInfLocalDistance::~LInfLocalDistance
~LInfLocalDistance()
DGtal::L2FirstOrderLocalDistance::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
DGtal::L1LocalDistance::Point
Image::Point Point
Definition: FMMPointFunctors.h:481
DGtal::L2FirstOrderLocalDistanceFromCells::L2FirstOrderLocalDistanceFromCells
L2FirstOrderLocalDistanceFromCells(ConstAlias< KSpace > aK, Map &aMap)
DGtal::L1LocalDistance::L1LocalDistance
L1LocalDistance(Image &aImg, TSet &aSet)
DGtal::L2FirstOrderLocalDistanceFromCells::Point
KSpace::Point Point
Definition: FMMPointFunctors.h:598
DGtal::L2SecondOrderLocalDistance::Point
Image::Point Point
Definition: FMMPointFunctors.h:238
DGtal::L2FirstOrderLocalDistance::compute
Value compute(Values &aValueList) const
DGtal::L2FirstOrderLocalDistanceFromCells::KSpace
TKSpace KSpace
cellular grid
Definition: FMMPointFunctors.h:597
DGtal::SpeedExtrapolator::SpeedExtrapolator
SpeedExtrapolator(const DistanceImage &aDistImg, const TSet &aSet, SpeedFunctor &aSpeedFunc)
DGtal::L2FirstOrderLocalDistanceFromCells::operator()
Value operator()(const Point &aPoint)
DGtal::concepts::CDigitalSet
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user...
Definition: CDigitalSet.h:138
DGtal::L1LocalDistance::operator()
Value operator()(const Point &aPoint)
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::L2FirstOrderLocalDistanceFromCells::operator=
L2FirstOrderLocalDistanceFromCells & operator=(const L2FirstOrderLocalDistanceFromCells &other)
DGtal::L1LocalDistance::Image
TImage Image
Definition: FMMPointFunctors.h:480
DGtal::SpeedExtrapolator::mySpeedFuncPtr
SpeedFunctor * mySpeedFuncPtr
Aliasing pointer on the underlying image of speed values.
Definition: FMMPointFunctors.h:734
DGtal::SpeedExtrapolator::SpeedFunctor
TSpeedFunctor SpeedFunctor
Definition: FMMPointFunctors.h:717
DGtal::L1LocalDistance::mySetPtr
Set * mySetPtr
Aliasing pointer on the underlying set.
Definition: FMMPointFunctors.h:498
DGtal::SpeedExtrapolator::DistanceImage
TDistanceImage DistanceImage
Definition: FMMPointFunctors.h:713
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38
DGtal::L2FirstOrderLocalDistanceFromCells
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
Definition: FMMPointFunctors.h:585
DGtal::KhalimskyCell< dim, Integer >
DGtal::concepts::CImage
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:102