DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 
52 #include "DGtal/kernel/sets/CDigitalSet.h"
53 #include "DGtal/kernel/CPointFunctor.h"
54 #include "DGtal/images/CImage.h"
55 #include "DGtal/images/ImageHelper.h"
57 
58 namespace DGtal
59 {
60 
63  // template class L2FirstOrderLocalDistance
91  template <typename TImage, typename TSet>
93  {
94 
95  // ----------------------- Types ------------------------------
96  public:
97 
98 
101  typedef TImage Image;
102  typedef typename Image::Point Point;
103  typedef typename Image::Value Value;
104 
107  typedef TSet Set;
108  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
109 
110  private:
111 
112  typedef std::vector<Value> Values;
113 
114  // ----------------------- Data -------------------------------------
115  public:
120 
121 
122  // ----------------------- Interface --------------------------------------
123  public:
124 
132  L2FirstOrderLocalDistance(Image& aImg, TSet& aSet);
133 
139 
146 
152 
163  Value operator() (const Point& aPoint);
164 
169  void selfDisplay ( std::ostream & out ) const;
170 
171  // ----------------------- Internals -------------------------------------
172 
173  private:
174 
182  Value compute(Values& aValueList) const;
183 
184 
194  Value gradientNorm(const Value& aValue, const Values& aValueList) const;
195  };
196 
198  // template class L2SecondOrderLocalDistance
226  template <typename TImage, typename TSet>
228  {
229 
230  // ----------------------- Types ------------------------------
231  public:
232 
233 
236  typedef TImage Image;
237  typedef typename Image::Point Point;
238  typedef typename Image::Value Value;
239 
242  typedef TSet Set;
243  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
244 
245  private:
246 
247  typedef std::pair<double, Value> CoeffValue;
248  typedef std::vector<CoeffValue> List;
249 
250  // ----------------------- Data -------------------------------------
251  public:
256 
257 
258  // ----------------------- Interface --------------------------------------
259  public:
260 
268  L2SecondOrderLocalDistance(Image& aImg, TSet& aSet);
269 
275 
282 
288 
299  Value operator() (const Point& aPoint);
300 
305  void selfDisplay ( std::ostream & out ) const;
306 
307  // ----------------------- Internals -------------------------------------
308 
309  private:
310 
318  Value compute(List& aList) const;
319 
320 
330  Value getValue(const Value& aValue1, const Value& aValue2) const;
331  };
332 
333 
335  // template class LInfLocalDistance
355  template <typename TImage, typename TSet>
357  {
358  // ----------------------- Types ------------------------------
359  public:
360 
361 
364  typedef TImage Image;
365  typedef typename Image::Point Point;
366  typedef typename Image::Value Value;
367 
370  typedef TSet Set;
371  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
372 
373  private:
374 
375  typedef std::vector<Value> Values;
376 
377  // ----------------------- Data -------------------------------------
378  public:
383 
384 
385  // ----------------------- Interface --------------------------------------
386  public:
387 
395  LInfLocalDistance(Image& aImg, TSet& aSet);
396 
401  LInfLocalDistance ( const LInfLocalDistance & other );
402 
409 
415 
416 
427  Value operator() (const Point& aPoint);
428 
433  void selfDisplay ( std::ostream & out ) const;
434 
435  // ----------------------- Internals -------------------------------------
436 
437  private:
438 
446  Value compute(Values& aValueList) const;
447 
448  };
449 
451  // template class L1LocalDistance
470  template <typename TImage, typename TSet>
472  {
473  // ----------------------- Types ------------------------------
474  public:
475 
476 
479  typedef TImage Image;
480  typedef typename Image::Point Point;
481  typedef typename Image::Value Value;
482 
485  typedef TSet Set;
486  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
487 
488  private:
489 
490  typedef std::vector<Value> Values;
491 
492  // ----------------------- Data -------------------------------------
493  public:
498 
499  // ----------------------- Interface --------------------------------------
500  public:
501 
509  L1LocalDistance(Image& aImg, TSet& aSet);
510 
515  L1LocalDistance ( const L1LocalDistance & other );
516 
522  L1LocalDistance & operator= ( const L1LocalDistance & other);
523 
528  ~L1LocalDistance();
529 
539  Value operator() (const Point& aPoint);
540 
545  void selfDisplay ( std::ostream & out ) const;
546 
547  // ----------------------- Internals -------------------------------------
548 
549  private:
550 
558  Value compute(Values& aValueList) const;
559 
560  };
561 
562 
564  // template class L2FirstOrderLocalDistanceFromCells
583  template <typename TKSpace, typename TMap, bool isIndirect = false>
585  {
586 
587  // ----------------------- Types ------------------------------
588  public:
589 
590 
592  typedef TMap Map;
593  typedef typename Map::mapped_type Value;
594 
596  typedef TKSpace KSpace;
597  typedef typename KSpace::Point Point;
598  typedef typename KSpace::Cell Cell;
599 
600  private:
601 
602  typedef std::vector<Value> Values;
603 
604  // ----------------------- Data -------------------------------------
605  public:
607  const KSpace* myKSpace;
610 
611  // ----------------------- Interface --------------------------------------
612  public:
613 
621 
627 
634 
640 
651  Value operator() (const Point& aPoint);
652 
657  void selfDisplay ( std::ostream & out ) const;
658 
659  // ----------------------- Internals -------------------------------------
660 
661  private:
662 
671  Value compute(Values& aValueList) const;
672 
673  };
674 
675 
677  // template class SpeedExtrapolator
701  template <typename TDistanceImage, typename TSet, typename TSpeedFunctor>
703  {
704 
705  // ----------------------- Types ------------------------------
706  public:
707 
708 
711  typedef TDistanceImage DistanceImage;
712  typedef typename DistanceImage::Point Point;
713  typedef typename DistanceImage::Value DistanceValue;
715  typedef TSpeedFunctor SpeedFunctor;
716  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename SpeedFunctor::Point >::value ));
717  typedef typename SpeedFunctor::Value Value;
718 
721  typedef TSet Set;
722  BOOST_STATIC_ASSERT(( boost::is_same< Point, typename TSet::Point >::value ));
723 
724  // ----------------------- Data -------------------------------------
725  public:
730  const Set* mySetPtr;
733 
734 
735  // ----------------------- Interface --------------------------------------
736  public:
737 
746  SpeedExtrapolator(const DistanceImage& aDistImg, const TSet& aSet, SpeedFunctor& aSpeedFunc);
747 
752  SpeedExtrapolator ( const SpeedExtrapolator & other );
753 
760 
766 
777  Value operator() (const Point& aPoint);
778 
779 
780  };
781 
782 
783 } // namespace DGtal
784 
785 
787 // Includes inline functions.
788 #include "DGtal/geometry/volumes/distance/FMMPointFunctors.ih"
789 
790 // //
792 
793 #endif // !defined FMMPointFunctors_h
794 
795 #undef FMMPointFunctors_RECURSES
796 #endif // else defined(FMMPointFunctors_RECURSES)