DGtal  0.9.2
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:
118  Image* myImgPtr;
120  Set* mySetPtr;
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:
254  Image* myImgPtr;
256  Set* mySetPtr;
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:
381  Image* myImgPtr;
383  Set* mySetPtr;
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:
496  Image* myImgPtr;
498  Set* mySetPtr;
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;
610  Map* myMap;
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;
715  typedef typename DistanceImage::Value DistanceValue;
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:
729  const DistanceImage* myDistImgPtr;
732  const Set* mySetPtr;
734  SpeedFunctor* mySpeedFuncPtr;
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)
Value operator()(const Point &aPoint)
Value operator()(const Point &aPoint)
Value operator()(const Point &aPoint)
Image * myImgPtr
Aliasing pointer on the underlying image.
L2FirstOrderLocalDistanceFromCells(ConstAlias< KSpace > aK, Map &aMap)
void selfDisplay(std::ostream &out) const
Value compute(List &aList) const
void selfDisplay(std::ostream &out) const
Value operator()(const Point &aPoint)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
std::vector< Value > Values
void selfDisplay(std::ostream &out) const
Value compute(Values &aValueList) const
Value compute(Values &aValueList) const
Value getValue(const Value &aValue1, const Value &aValue2) const
std::vector< CoeffValue > List
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
SpeedFunctor::Value Value
Set * mySetPtr
Aliasing pointer on the underlying set.
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
Image * myImgPtr
Aliasing pointer on the underlying image.
const DistanceImage * myDistImgPtr
Aliasing pointer on the underlying image of distance values.
L1LocalDistance & operator=(const L1LocalDistance &other)
const KSpace * myKSpace
Aliasing pointer on the underlying cellular grid.
BOOST_CONCEPT_ASSERT((concepts::CImage< TDistanceImage >))
image
Value gradientNorm(const Value &aValue, const Values &aValueList) const
Value operator()(const Point &aPoint)
L2SecondOrderLocalDistance & operator=(const L2SecondOrderLocalDistance &other)
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
Value operator()(const Point &aPoint)
L2SecondOrderLocalDistance(Image &aImg, TSet &aSet)
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
Set * mySetPtr
Aliasing pointer on the underlying set.
Set * mySetPtr
Aliasing pointer on the underlying set.
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
Image * myImgPtr
Aliasing pointer on the underlying image.
SpeedExtrapolator & operator=(const SpeedExtrapolator &other)
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Class for the computation of the L1-distance at some point p, from the available distance values...
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
DistanceImage::Value DistanceValue
void selfDisplay(std::ostream &out) const
L1LocalDistance(Image &aImg, TSet &aSet)
std::pair< double, Value > CoeffValue
Value compute(Values &aValueList) const
Map * myMap
Aliasing pointer on the underlying mapping.
L2FirstOrderLocalDistanceFromCells & operator=(const L2FirstOrderLocalDistanceFromCells &other)
SpeedFunctor * mySpeedFuncPtr
Aliasing pointer on the underlying image of speed values.
Aim: Defines a functor on points.
Definition: CPointFunctor.h:88
Value compute(Values &aValueList) const
DistanceImage::Point Point
Aim: Class for the computation of the a speed value at some point p, from the available distance valu...
BOOST_STATIC_ASSERT((boost::is_same< Point, typename SpeedFunctor::Point >::value))
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user...
Definition: CDigitalSet.h:138
Image * myImgPtr
Aliasing pointer on the underlying image.
LInfLocalDistance & operator=(const LInfLocalDistance &other)
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:102
SpeedExtrapolator(const DistanceImage &aDistImg, const TSet &aSet, SpeedFunctor &aSpeedFunc)
LInfLocalDistance(Image &aImg, TSet &aSet)
L2FirstOrderLocalDistance & operator=(const L2FirstOrderLocalDistance &other)
L2FirstOrderLocalDistance(Image &aImg, TSet &aSet)
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
void selfDisplay(std::ostream &out) const
Set * mySetPtr
Aliasing pointer on the underlying set.
std::vector< Value > Values
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
Aim: Class for the computation of the LInf-distance at some point p, from the available distance valu...