DGtal  1.5.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)
38 #define FMMPointFunctors_RECURSES
39 
40 #if !defined FMMPointFunctors_h
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 
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 
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 
403 
410 
416 
417 
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 
524 
530 
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 
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 
755 
762 
768 
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Class for the computation of the L1-distance at some point p, from the available distance values...
L1LocalDistance(const L1LocalDistance &other)
Set * mySetPtr
Aliasing pointer on the underlying set.
std::vector< Value > Values
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
Image * myImgPtr
Aliasing pointer on the underlying image.
Value compute(Values &aValueList) const
L1LocalDistance & operator=(const L1LocalDistance &other)
Value operator()(const Point &aPoint)
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
void selfDisplay(std::ostream &out) const
L1LocalDistance(Image &aImg, TSet &aSet)
BOOST_CONCEPT_ASSERT((concepts::CDigitalSet< TSet >))
set
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
Value operator()(const Point &aPoint)
Value compute(Values &aValueList) const
L2FirstOrderLocalDistanceFromCells & operator=(const L2FirstOrderLocalDistanceFromCells &other)
L2FirstOrderLocalDistanceFromCells(ConstAlias< KSpace > aK, Map &aMap)
L2FirstOrderLocalDistanceFromCells(const L2FirstOrderLocalDistanceFromCells &other)
void selfDisplay(std::ostream &out) const
const KSpace * myKSpace
Aliasing pointer on the underlying cellular grid.
Map * myMap
Aliasing pointer on the underlying mapping.
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
void selfDisplay(std::ostream &out) const
L2FirstOrderLocalDistance(Image &aImg, TSet &aSet)
Value operator()(const Point &aPoint)
Value gradientNorm(const Value &aValue, const Values &aValueList) const
Value compute(Values &aValueList) const
L2FirstOrderLocalDistance & operator=(const L2FirstOrderLocalDistance &other)
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
Set * mySetPtr
Aliasing pointer on the underlying set.
Image * myImgPtr
Aliasing pointer on the underlying image.
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
BOOST_CONCEPT_ASSERT((concepts::CDigitalSet< TSet >))
set
L2FirstOrderLocalDistance(const L2FirstOrderLocalDistance &other)
Aim: Class for the computation of the Euclidean distance at some point p, from the available distance...
std::pair< double, Value > CoeffValue
Value operator()(const Point &aPoint)
Set * mySetPtr
Aliasing pointer on the underlying set.
std::vector< CoeffValue > List
void selfDisplay(std::ostream &out) const
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
Value getValue(const Value &aValue1, const Value &aValue2) const
Value compute(List &aList) const
L2SecondOrderLocalDistance(const L2SecondOrderLocalDistance &other)
L2SecondOrderLocalDistance(Image &aImg, TSet &aSet)
BOOST_CONCEPT_ASSERT((concepts::CDigitalSet< TSet >))
set
Image * myImgPtr
Aliasing pointer on the underlying image.
L2SecondOrderLocalDistance & operator=(const L2SecondOrderLocalDistance &other)
Aim: Class for the computation of the LInf-distance at some point p, from the available distance valu...
LInfLocalDistance(Image &aImg, TSet &aSet)
BOOST_CONCEPT_ASSERT((concepts::CDigitalSet< TSet >))
set
std::vector< Value > Values
LInfLocalDistance & operator=(const LInfLocalDistance &other)
Value compute(Values &aValueList) const
Set * mySetPtr
Aliasing pointer on the underlying set.
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
void selfDisplay(std::ostream &out) const
Value operator()(const Point &aPoint)
Image * myImgPtr
Aliasing pointer on the underlying image.
BOOST_CONCEPT_ASSERT((concepts::CImage< TImage >))
image
LInfLocalDistance(const LInfLocalDistance &other)
Aim: Class for the computation of the a speed value at some point p, from the available distance valu...
SpeedFunctor::Value Value
SpeedExtrapolator & operator=(const SpeedExtrapolator &other)
Value operator()(const Point &aPoint)
BOOST_CONCEPT_ASSERT((concepts::CImage< TDistanceImage >))
image
SpeedFunctor * mySpeedFuncPtr
Aliasing pointer on the underlying image of speed values.
BOOST_STATIC_ASSERT((boost::is_same< Point, typename SpeedFunctor::Point >::value))
SpeedExtrapolator(const DistanceImage &aDistImg, const TSet &aSet, SpeedFunctor &aSpeedFunc)
BOOST_CONCEPT_ASSERT((concepts::CDigitalSet< TSet >))
set
BOOST_CONCEPT_ASSERT((concepts::CPointFunctor< TSpeedFunctor >))
const DistanceImage * myDistImgPtr
Aliasing pointer on the underlying image of distance values.
BOOST_STATIC_ASSERT((boost::is_same< Point, typename TSet::Point >::value))
DistanceImage::Value DistanceValue
SpeedExtrapolator(const SpeedExtrapolator &other)
DistanceImage::Point Point
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user...
Definition: CDigitalSet.h:141
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:103
Aim: Defines a functor on points.
Definition: CPointFunctor.h:89
MyPointD Point
Definition: testClone2.cpp:383
const Point aPoint(3, 4)