DGtal  0.9.2
Surfaces.h
1 
17 #pragma once
18 
31 #if defined(Surfaces_RECURSES)
32 #error Recursive header files inclusion detected in Surfaces.h
33 #else // defined(Surfaces_RECURSES)
34 
35 #define Surfaces_RECURSES
36 
37 #if !defined Surfaces_h
38 
39 #define Surfaces_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/Exceptions.h"
46 #include "DGtal/topology/SurfelAdjacency.h"
47 #include "DGtal/topology/SurfelNeighborhood.h"
48 
50 
51 #ifdef _MSC_VER
52 #pragma warning(disable : 4290)
53 #endif
54 
55 namespace DGtal
56 {
57 
59  // template class Surfaces
77  template <typename TKSpace>
78  class Surfaces
79  {
80  // ----------------------- Types ------------------------------
81  public:
82  typedef TKSpace KSpace;
83  typedef typename KSpace::Integer Integer;
84  typedef typename KSpace::Point Point;
85  typedef typename KSpace::Cell Cell;
86  typedef typename KSpace::SCell SCell;
87  typedef typename KSpace::DirIterator DirIterator;
88 
89  // ----------------------- Static services ------------------------------
90  public:
91 
112  template <typename PointPredicate>
113  static
114  SCell findABel( const KSpace & K,
115  const PointPredicate & pp,
116  unsigned int nbtries = 1000 ) throw (DGtal::InputException);
117 
145  template <typename PointPredicate>
146  static
147  SCell findABel( const KSpace & K,
148  const PointPredicate & pp,
149  Point x1, Point x2 );
150 
181  template <typename SCellSet, typename PointPredicate >
182  static
183  void trackBoundary( SCellSet & surface,
184  const KSpace & K,
185  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
186  const PointPredicate & pp,
187  const SCell & start_surfel );
188 
222  template <typename SCellSet, typename PointPredicate >
223  static
224  void trackClosedBoundary( SCellSet & surface,
225  const KSpace & K,
226  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
227  const PointPredicate & pp,
228  const SCell & start_surfel );
229 
230 
256  template <typename SCellSet, typename SurfelPredicate >
257  static
258  void trackSurface( SCellSet & surface,
259  const KSpace & K,
260  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
261  const SurfelPredicate & pp,
262  const SCell & start_surfel );
263 
291  template <typename SCellSet, typename SurfelPredicate >
292  static
293  void trackClosedSurface( SCellSet & surface,
294  const KSpace & K,
295  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
296  const SurfelPredicate & pp,
297  const SCell & start_surfel );
298 
299 
332  template <typename PointPredicate >
333  static
334  void track2DBoundary( std::vector<SCell> & aSCellContour2D,
335  const KSpace & K,
336  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
337  const PointPredicate & pp,
338  const SCell & start_surfel );
339 
340 
341 
381  template <typename PointPredicate>
382  static
383  void track2DSliceBoundary( std::vector<SCell> & aSCellContour2D,
384  const KSpace & K,
385  const Dimension & trackDir,
386  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
387  const PointPredicate & pp,
388  const SCell & start_surfel );
389 
390 
424  template <typename SurfelPredicate >
425  static
426  void track2DSurface( std::vector<SCell> & aSCellContour,
427  const KSpace & K,
428  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
429  const SurfelPredicate & sp,
430  const SCell & start_surfel );
431 
432 
433 
475  template <typename SurfelPredicate>
476  static
477  void track2DSliceSurface( std::vector<SCell> & aSCellContour,
478  const KSpace & K,
479  const Dimension & trackDir,
480  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
481  const SurfelPredicate & sp,
482  const SCell & start_surfel );
483 
484 
485 
510  template <typename PointPredicate>
511  static
512  void
513  track2DBoundaryPoints( std::vector<Point> & aVectorOfPoints,
514  const KSpace & K,
515  const SurfelAdjacency<KSpace::dimension> & surfel_adj,
516  const PointPredicate & pp,
517  const SCell & start_surfel );
518 
519 
546  template <typename PointPredicate>
547  static
549  ( std::vector< std::vector< Point > > & aVectPointContour2D,
550  const KSpace & aKSpace,
551  const PointPredicate & pp,
552  const SurfelAdjacency<2> &aSAdj );
553 
554 
555 
578  template <typename PointPredicate>
579  static
581  ( std::vector< std::vector<SCell> > & aVectSCellContour2D,
582  const KSpace & aKSpace,
583  const SurfelAdjacency<KSpace::dimension> & aSurfelAdj,
584  const PointPredicate & pp );
585 
586 
614  template <typename PointPredicate >
615  static
617  ( std::vector< std::vector<SCell> > & aVectConnectedSCell,
618  const KSpace & aKSpace,
619  const SurfelAdjacency<KSpace::dimension> & aSurfelAdj,
620  const PointPredicate & pp,
621  bool forceOrientCellExterior=false );
622 
623 
624 
625 
650  template <typename PointPredicate>
651  static
652  void orientSCellExterior(std::vector<SCell> & aVectOfSCell,
653  const KSpace & aKSpace,
654  const PointPredicate & pp );
655 
656 
657 
658 
659 
660 
681  template <typename CellSet, typename PointPredicate >
682  static
683  void uMakeBoundary( CellSet & aBoundary,
684  const KSpace & aKSpace,
685  const PointPredicate & pp,
686  const Point & aLowerBound,
687  const Point & aUpperBound );
688 
709  template <typename SCellSet, typename PointPredicate >
710  static
711  void sMakeBoundary( SCellSet & aBoundary,
712  const KSpace & aKSpace,
713  const PointPredicate & pp,
714  const Point & aLowerBound,
715  const Point & aUpperBound );
716 
739  template <typename OutputIterator, typename PointPredicate >
740  static
741  void uWriteBoundary( OutputIterator & out_it,
742  const KSpace & aKSpace,
743  const PointPredicate & pp,
744  const Point & aLowerBound,
745  const Point & aUpperBound );
746 
769  template <typename OutputIterator, typename PointPredicate >
770  static
771  void sWriteBoundary( OutputIterator & out_it,
772  const KSpace & aKSpace,
773  const PointPredicate & pp,
774  const Point & aLowerBound,
775  const Point & aUpperBound );
776 
777 
778 
779 
780 
800  template < typename TSurfelPredicate, typename TImageContainer>
801  unsigned int
802  static
803  uFillInterior( const KSpace & aKSpace,
804  const TSurfelPredicate & aSurfPred,
805  TImageContainer & anImage,
806  const typename TImageContainer::Value & aValue,
807  bool empty_is_inside=false,
808  bool incrementMode=true );
809 
810 
829  template < typename SurfelPredicate, typename TImageContainer>
830  unsigned int
831  static
832  uFillExterior( const KSpace & aKSpace,
833  const SurfelPredicate & aSurfPred,
834  TImageContainer & anImage,
835  const typename TImageContainer::Value & aValue,
836  bool empty_is_outside=true,
837  bool incrementMode=true );
838 
839 
840 
841 
842  // ----------------------- Standard services ------------------------------
843  public:
844 
848  ~Surfaces();
849 
850  // ----------------------- Interface --------------------------------------
851  public:
852 
857  void selfDisplay ( std::ostream & out ) const;
858 
863  bool isValid() const;
864 
865  // ------------------------- Protected Datas ------------------------------
866  private:
867  // ------------------------- Private Datas --------------------------------
868  private:
869 
870  // ------------------------- Hidden services ------------------------------
871  protected:
872 
877  Surfaces();
878 
879  private:
880 
886  Surfaces ( const Surfaces & other );
887 
894  Surfaces & operator= ( const Surfaces & other );
895 
896  // ------------------------- Internals ------------------------------------
897  private:
898 
899  }; // end of class Surfaces
900 
901 
908  template <typename TKSpace>
909  std::ostream&
910  operator<< ( std::ostream & out, const Surfaces<TKSpace> & object );
911 
912 } // namespace DGtal
913 
914 
916 // Includes inline functions.
917 #include "DGtal/topology/helpers/Surfaces.ih"
918 
919 // //
921 
922 #endif // !defined Surfaces_h
923 
924 #undef Surfaces_RECURSES
925 #endif // else defined(Surfaces_RECURSES)
static void uMakeBoundary(CellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
static void orientSCellExterior(std::vector< SCell > &aVectOfSCell, const KSpace &aKSpace, const PointPredicate &pp)
static void extractAllPointContours4C(std::vector< std::vector< Point > > &aVectPointContour2D, const KSpace &aKSpace, const PointPredicate &pp, const SurfelAdjacency< 2 > &aSAdj)
KSpace::DirIterator DirIterator
Definition: Surfaces.h:87
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Definition: Surfaces.h:78
DGtal::uint32_t Dimension
Definition: Common.h:113
static void track2DSurface(std::vector< SCell > &aSCellContour, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &sp, const SCell &start_surfel)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
STL namespace.
static void track2DSliceBoundary(std::vector< SCell > &aSCellContour2D, const KSpace &K, const Dimension &trackDir, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
KSpace::Cell Cell
Definition: Surfaces.h:85
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
static void sMakeBoundary(SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
bool isValid() const
static void track2DBoundary(std::vector< SCell > &aSCellContour2D, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static void trackBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static void trackClosedSurface(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &pp, const SCell &start_surfel)
static void uWriteBoundary(OutputIterator &out_it, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
KSpace::Integer Integer
Definition: Surfaces.h:83
static void extractAllConnectedSCell(std::vector< std::vector< SCell > > &aVectConnectedSCell, const KSpace &aKSpace, const SurfelAdjacency< KSpace::dimension > &aSurfelAdj, const PointPredicate &pp, bool forceOrientCellExterior=false)
TKSpace KSpace
Definition: Surfaces.h:82
KSpace::SCell SCell
Definition: Surfaces.h:86
DGtal is the top-level namespace which contains all DGtal functions and types.
void selfDisplay(std::ostream &out) const
KSpace::Point Point
Definition: Surfaces.h:84
static void sWriteBoundary(OutputIterator &out_it, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
static void extractAll2DSCellContours(std::vector< std::vector< SCell > > &aVectSCellContour2D, const KSpace &aKSpace, const SurfelAdjacency< KSpace::dimension > &aSurfelAdj, const PointPredicate &pp)
static void track2DBoundaryPoints(std::vector< Point > &aVectorOfPoints, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
unsigned static int uFillInterior(const KSpace &aKSpace, const TSurfelPredicate &aSurfPred, TImageContainer &anImage, const typename TImageContainer::Value &aValue, bool empty_is_inside=false, bool incrementMode=true)
static void trackClosedBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static void trackSurface(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &pp, const SCell &start_surfel)
unsigned static int uFillExterior(const KSpace &aKSpace, const SurfelPredicate &aSurfPred, TImageContainer &anImage, const typename TImageContainer::Value &aValue, bool empty_is_outside=true, bool incrementMode=true)
static void track2DSliceSurface(std::vector< SCell > &aSCellContour, const KSpace &K, const Dimension &trackDir, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &sp, const SCell &start_surfel)