DGtal 1.3.0
Loading...
Searching...
No Matches
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)
35#define Surfaces_RECURSES
36
37#if !defined Surfaces_h
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
55namespace DGtal
56{
57
59 // template class Surfaces
77 template <typename TKSpace>
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::Vector Vector;
86 typedef typename KSpace::Cell Cell;
87 typedef typename KSpace::SCell SCell;
88 typedef typename KSpace::Surfel Surfel;
90 typedef std::vector<Cell> CellRange;
91
92 // ----------------------- Static services ------------------------------
93 public:
94
115 template <typename PointPredicate>
116 static
118 const PointPredicate & pp,
119 unsigned int nbtries = 1000 );
120
148 template <typename PointPredicate>
149 static
151 const PointPredicate & pp,
152 Point x1, Point x2 );
153
184 template <typename SCellSet, typename PointPredicate >
185 static
186 void trackBoundary( SCellSet & surface,
187 const KSpace & K,
188 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
189 const PointPredicate & pp,
190 const SCell & start_surfel );
191
225 template <typename SCellSet, typename PointPredicate >
226 static
227 void trackClosedBoundary( SCellSet & surface,
228 const KSpace & K,
229 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
230 const PointPredicate & pp,
231 const SCell & start_surfel );
232
233
259 template <typename SCellSet, typename SurfelPredicate >
260 static
261 void trackSurface( SCellSet & surface,
262 const KSpace & K,
263 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
264 const SurfelPredicate & pp,
265 const SCell & start_surfel );
266
294 template <typename SCellSet, typename SurfelPredicate >
295 static
296 void trackClosedSurface( SCellSet & surface,
297 const KSpace & K,
298 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
299 const SurfelPredicate & pp,
300 const SCell & start_surfel );
301
302
335 template <typename PointPredicate >
336 static
337 void track2DBoundary( std::vector<SCell> & aSCellContour2D,
338 const KSpace & K,
339 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
340 const PointPredicate & pp,
341 const SCell & start_surfel );
342
343
344
384 template <typename PointPredicate>
385 static
386 void track2DSliceBoundary( std::vector<SCell> & aSCellContour2D,
387 const KSpace & K,
388 const Dimension & trackDir,
389 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
390 const PointPredicate & pp,
391 const SCell & start_surfel );
392
393
427 template <typename SurfelPredicate >
428 static
429 void track2DSurface( std::vector<SCell> & aSCellContour,
430 const KSpace & K,
431 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
432 const SurfelPredicate & sp,
433 const SCell & start_surfel );
434
435
436
478 template <typename SurfelPredicate>
479 static
480 void track2DSliceSurface( std::vector<SCell> & aSCellContour,
481 const KSpace & K,
482 const Dimension & trackDir,
483 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
484 const SurfelPredicate & sp,
485 const SCell & start_surfel );
486
487
488
513 template <typename PointPredicate>
514 static
515 void
516 track2DBoundaryPoints( std::vector<Point> & aVectorOfPoints,
517 const KSpace & K,
518 const SurfelAdjacency<KSpace::dimension> & surfel_adj,
519 const PointPredicate & pp,
520 const SCell & start_surfel );
521
522
549 template <typename PointPredicate>
550 static
552 ( std::vector< std::vector< Point > > & aVectPointContour2D,
553 const KSpace & aKSpace,
554 const PointPredicate & pp,
555 const SurfelAdjacency<2> &aSAdj );
556
557
558
581 template <typename PointPredicate>
582 static
584 ( std::vector< std::vector<SCell> > & aVectSCellContour2D,
585 const KSpace & aKSpace,
586 const SurfelAdjacency<KSpace::dimension> & aSurfelAdj,
587 const PointPredicate & pp );
588
589
617 template <typename PointPredicate >
618 static
620 ( std::vector< std::vector<SCell> > & aVectConnectedSCell,
621 const KSpace & aKSpace,
622 const SurfelAdjacency<KSpace::dimension> & aSurfelAdj,
623 const PointPredicate & pp,
624 bool forceOrientCellExterior=false );
625
626
627
628
653 template <typename PointPredicate>
654 static
655 void orientSCellExterior(std::vector<SCell> & aVectOfSCell,
656 const KSpace & aKSpace,
657 const PointPredicate & pp );
658
659
660
661
662
663
684 template <typename CellSet, typename PointPredicate >
685 static
686 void uMakeBoundary( CellSet & aBoundary,
687 const KSpace & aKSpace,
688 const PointPredicate & pp,
689 const Point & aLowerBound,
690 const Point & aUpperBound );
691
712 template <typename SCellSet, typename PointPredicate >
713 static
714 void sMakeBoundary( SCellSet & aBoundary,
715 const KSpace & aKSpace,
716 const PointPredicate & pp,
717 const Point & aLowerBound,
718 const Point & aUpperBound );
719
742 template <typename OutputIterator, typename PointPredicate >
743 static
744 void uWriteBoundary( OutputIterator & out_it,
745 const KSpace & aKSpace,
746 const PointPredicate & pp,
747 const Point & aLowerBound,
748 const Point & aUpperBound );
749
772 template <typename OutputIterator, typename PointPredicate >
773 static
774 void sWriteBoundary( OutputIterator & out_it,
775 const KSpace & aKSpace,
776 const PointPredicate & pp,
777 const Point & aLowerBound,
778 const Point & aUpperBound );
779
780
781
782
783
803 template < typename TSurfelPredicate, typename TImageContainer>
804 unsigned int
805 static
806 uFillInterior( const KSpace & aKSpace,
807 const TSurfelPredicate & aSurfPred,
808 TImageContainer & anImage,
809 const typename TImageContainer::Value & aValue,
810 bool empty_is_inside=false,
811 bool incrementMode=true );
812
813
832 template < typename SurfelPredicate, typename TImageContainer>
833 unsigned int
834 static
835 uFillExterior( const KSpace & aKSpace,
836 const SurfelPredicate & aSurfPred,
837 TImageContainer & anImage,
838 const typename TImageContainer::Value & aValue,
839 bool empty_is_outside=true,
840 bool incrementMode=true );
841
842
847 static
849
856 static
857 CellRange getPrimalVertices( const KSpace& K, const Surfel& s, bool ccw );
858
859
860 // ----------------------- Standard services ------------------------------
861 public:
862
867
868 // ----------------------- Interface --------------------------------------
869 public:
870
875 void selfDisplay ( std::ostream & out ) const;
876
881 bool isValid() const;
882
883 // ------------------------- Protected Datas ------------------------------
884 private:
885 // ------------------------- Private Datas --------------------------------
886 private:
887
888 // ------------------------- Hidden services ------------------------------
889 protected:
890
896
897 private:
898
904 Surfaces ( const Surfaces & other );
905
912 Surfaces & operator= ( const Surfaces & other );
913
914 // ------------------------- Internals ------------------------------------
915 private:
916
917 }; // end of class Surfaces
918
919
926 template <typename TKSpace>
927 std::ostream&
928 operator<< ( std::ostream & out, const Surfaces<TKSpace> & object );
929
930} // namespace DGtal
931
932
934// Includes inline functions.
935#include "DGtal/topology/helpers/Surfaces.ih"
936
937// //
939
940#endif // !defined Surfaces_h
941
942#undef Surfaces_RECURSES
943#endif // else defined(Surfaces_RECURSES)
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
SignedKhalimskyCell< dim, Integer > SCell
typename PreCellularGridSpace::DirIterator DirIterator
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Definition: Surfaces.h:79
static void track2DBoundaryPoints(std::vector< Point > &aVectorOfPoints, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static void extractAllConnectedSCell(std::vector< std::vector< SCell > > &aVectConnectedSCell, const KSpace &aKSpace, const SurfelAdjacency< KSpace::dimension > &aSurfelAdj, const PointPredicate &pp, bool forceOrientCellExterior=false)
static void trackClosedBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static void extractAll2DSCellContours(std::vector< std::vector< SCell > > &aVectSCellContour2D, const KSpace &aKSpace, const SurfelAdjacency< KSpace::dimension > &aSurfelAdj, const PointPredicate &pp)
static void trackBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
static void trackSurface(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &pp, const SCell &start_surfel)
KSpace::Surfel Surfel
Definition: Surfaces.h:88
void selfDisplay(std::ostream &out) const
KSpace::SCell SCell
Definition: Surfaces.h:87
static SCell findABel(const KSpace &K, const PointPredicate &pp, Point x1, Point x2)
static void extractAllPointContours4C(std::vector< std::vector< Point > > &aVectPointContour2D, const KSpace &aKSpace, const PointPredicate &pp, const SurfelAdjacency< 2 > &aSAdj)
KSpace::Cell Cell
Definition: Surfaces.h:86
static CellRange getPrimalVertices(const KSpace &K, const SCell &s)
static void uMakeBoundary(CellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
Surfaces & operator=(const Surfaces &other)
Surfaces(const Surfaces &other)
KSpace::Integer Integer
Definition: Surfaces.h:83
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 CellRange getPrimalVertices(const KSpace &K, const Surfel &s, bool ccw)
static void orientSCellExterior(std::vector< SCell > &aVectOfSCell, const KSpace &aKSpace, const PointPredicate &pp)
static void track2DBoundary(std::vector< SCell > &aSCellContour2D, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
std::vector< Cell > CellRange
Definition: Surfaces.h:90
static void sWriteBoundary(OutputIterator &out_it, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
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)
KSpace::Point Point
Definition: Surfaces.h:84
static void uWriteBoundary(OutputIterator &out_it, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
static void trackClosedSurface(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &pp, const SCell &start_surfel)
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::Vector Vector
Definition: Surfaces.h:85
bool isValid() const
static void track2DSurface(std::vector< SCell > &aSCellContour, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &sp, const SCell &start_surfel)
TKSpace KSpace
Definition: Surfaces.h:82
KSpace::DirIterator DirIterator
Definition: Surfaces.h:89
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 sMakeBoundary(SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Definition: Common.h:137
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
KSpace K