DGtal  1.3.beta
ExplicitDigitalSurface.h
1 
17 #pragma once
18 
31 #if defined(ExplicitDigitalSurface_RECURSES)
32 #error Recursive header files inclusion detected in ExplicitDigitalSurface.h
33 #else // defined(ExplicitDigitalSurface_RECURSES)
34 
35 #define ExplicitDigitalSurface_RECURSES
36 
37 #if !defined ExplicitDigitalSurface_h
38 
39 #define ExplicitDigitalSurface_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/ConstAlias.h"
47 #include "DGtal/topology/CSurfelPredicate.h"
48 #include "DGtal/topology/Topology.h"
49 #include "DGtal/topology/SurfelAdjacency.h"
50 #include "DGtal/topology/SurfelNeighborhood.h"
52 
53 namespace DGtal
54 {
55 
57  // template class ExplicitDigitalSurface
80  template <typename TKSpace, typename TSurfelPredicate>
82  {
83  public:
84 
88  class Tracker
89  {
90  public:
91  // -------------------- associated types --------------------
92  typedef Tracker Self;
95  typedef typename TKSpace::SCell Surfel;
96 
97  // -------------------- inner types --------------------
98  typedef TKSpace KSpace;
100 
101  public:
108  const Surfel & s );
109 
114  Tracker( const Tracker & other );
115 
119  ~Tracker();
120 
122  const DigitalSurfaceContainer & surface() const;
124  const Surfel & current() const;
126  Dimension orthDir() const;
127 
133  void move( const Surfel & s );
134 
151  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
152 
153  private:
160 
161  };
162 
163  // ----------------------- associated types ------------------------------
164  public:
167  typedef TKSpace KSpace;
169  typedef typename KSpace::SCell Surfel;
171  typedef typename KSpace::Size Size;
172  // Model of CSurfelPredicate
173  typedef TSurfelPredicate SurfelPredicate;
174 
175  // BOOST_CONCEPT_ASSERT(( CCellularGridSpaceND< KSpace > ));
177 
178  // -------------------- specific types ------------------------------
179  typedef typename std::vector<Surfel> SurfelStorage;
180  typedef typename SurfelStorage::const_iterator SurfelConstIterator;
181  typedef typename KSpace::Space Space;
182  typedef typename KSpace::Point Point;
184 
185  // ----------------------- other types ------------------------------
186  public:
188  typedef typename KSpace::Cell Cell;
189  typedef typename KSpace::SCell SCell;
190  typedef typename KSpace::CellSet CellSet;
191  typedef typename KSpace::SCellSet SCellSet;
192 
193  // ----------------------- Standard services ------------------------------
194  public:
195 
200 
210 
231  const SurfelPredicate & aSP,
232  const Adjacency & adj,
233  const Surfel & s,
234  bool closed = false );
235 
237  const Adjacency & surfelAdjacency() const;
241  const SurfelPredicate & surfelPredicate() const;
242 
243  // --------- CDigitalSurfaceContainer realization -------------------------
244  public:
245 
247  const KSpace & space() const;
252  bool isInside( const Surfel & s ) const;
253 
256  SurfelConstIterator begin() const;
257 
260  SurfelConstIterator end() const;
261 
264  Size nbSurfels() const;
265 
268  bool empty() const;
269 
275  DigitalSurfaceTracker* newTracker( const Surfel & s ) const;
276 
281 
282  // ----------------------- Interface --------------------------------------
283  public:
284 
289  void selfDisplay ( std::ostream & out ) const;
290 
295  bool isValid() const;
296 
297  // ------------------------- Protected Datas ------------------------------
298  private:
299  // ------------------------- Private Datas --------------------------------
300  private:
302  const KSpace & myKSpace;
309 
310  // ------------------------- Hidden services ------------------------------
311  protected:
322  void computeSurfels( const Surfel & p,
323  bool closed );
324 
325 
326  private:
327 
335 
336  // ------------------------- Internals ------------------------------------
337  private:
338 
339  }; // end of class ExplicitDigitalSurface
340 
341 
354  template <typename TKSpace, typename TSurfelPredicate>
355  std::ostream&
356  operator<< ( std::ostream & out,
358 
359 } // namespace DGtal
360 
361 
363 // Includes inline functions.
364 #include "DGtal/topology/ExplicitDigitalSurface.ih"
365 
366 // //
368 
369 #endif // !defined ExplicitDigitalSurface_h
370 
371 #undef ExplicitDigitalSurface_RECURSES
372 #endif // else defined(ExplicitDigitalSurface_RECURSES)
DGtal::ExplicitDigitalSurface::SurfelConstIterator
SurfelStorage::const_iterator SurfelConstIterator
Definition: ExplicitDigitalSurface.h:180
DGtal::ExplicitDigitalSurface::SurfelPredicate
TSurfelPredicate SurfelPredicate
Definition: ExplicitDigitalSurface.h:173
DGtal::ExplicitDigitalSurface::KSpace
TKSpace KSpace
Model of cellular grid space.
Definition: ExplicitDigitalSurface.h:167
DGtal::ExplicitDigitalSurface::Tracker::orthDir
Dimension orthDir() const
DGtal::ExplicitDigitalSurface::SurfelStorage
std::vector< Surfel > SurfelStorage
Definition: ExplicitDigitalSurface.h:179
DGtal::ExplicitDigitalSurface::Tracker::DigitalSurfaceContainer
ExplicitDigitalSurface< TKSpace, TSurfelPredicate > DigitalSurfaceContainer
Definition: ExplicitDigitalSurface.h:94
DGtal::ExplicitDigitalSurface::Tracker::surface
const DigitalSurfaceContainer & surface() const
DGtal::ExplicitDigitalSurface::mySurfelPredicate
const SurfelPredicate & mySurfelPredicate
a reference to the surfel predicate defining the shape.
Definition: ExplicitDigitalSurface.h:304
DGtal::ExplicitDigitalSurface::Adjacency
SurfelAdjacency< KSpace::dimension > Adjacency
Definition: ExplicitDigitalSurface.h:187
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::ExplicitDigitalSurface::Tracker::move
void move(const Surfel &s)
DGtal::SurfelNeighborhood< KSpace >
DGtal::ExplicitDigitalSurface::Tracker::KSpace
TKSpace KSpace
Definition: ExplicitDigitalSurface.h:98
DGtal::SurfelAdjacency< KSpace::dimension >
DGtal::ExplicitDigitalSurface::operator=
ExplicitDigitalSurface & operator=(const ExplicitDigitalSurface &other)
DGtal::ExplicitDigitalSurface::space
const KSpace & space() const
DGtal::concepts::CSurfelPredicate
Aim: Defines a predicate on a surfel.
Definition: CSurfelPredicate.h:76
DGtal::ExplicitDigitalSurface::empty
bool empty() const
DGtal::ExplicitDigitalSurface::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::ExplicitDigitalSurface::SCell
KSpace::SCell SCell
Definition: ExplicitDigitalSurface.h:189
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::ExplicitDigitalSurface::Tracker::Tracker
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
DGtal::ExplicitDigitalSurface::Tracker::myNeighborhood
Neighborhood myNeighborhood
Definition: ExplicitDigitalSurface.h:159
SCell
Z3i::SCell SCell
Definition: fullConvexityShortestPaths3D.cpp:83
DGtal::ExplicitDigitalSurface::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CSurfelPredicate< SurfelPredicate >))
DGtal::ExplicitDigitalSurface::mySurfels
SurfelStorage mySurfels
a vector storing all the surfels of the boundary.
Definition: ExplicitDigitalSurface.h:308
DGtal::SignedKhalimskyCell
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Definition: KhalimskySpaceND.h:208
DGtal::Connectedness
Connectedness
Definition: Topology.h:50
DGtal::ExplicitDigitalSurface::Tracker::mySurface
const DigitalSurfaceContainer & mySurface
Definition: ExplicitDigitalSurface.h:156
DGtal::ExplicitDigitalSurface::Tracker
Definition: ExplicitDigitalSurface.h:88
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::ExplicitDigitalSurface::ExplicitDigitalSurface
ExplicitDigitalSurface(const ExplicitDigitalSurface &other)
DGtal::KhalimskySpaceND::SCellSet
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
Definition: KhalimskySpaceND.h:447
DGtal::SpaceND
Definition: SpaceND.h:95
DGtal::KhalimskySpaceND::CellSet
std::set< Cell > CellSet
Preferred type for defining a set of Cell(s).
Definition: KhalimskySpaceND.h:444
DGtal::ExplicitDigitalSurface::myKSpace
const KSpace & myKSpace
a reference to the cellular space.
Definition: ExplicitDigitalSurface.h:302
DGtal::ExplicitDigitalSurface::Tracker::adjacent
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
DGtal::KhalimskySpaceND::Size
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
Definition: KhalimskySpaceND.h:407
DGtal::ExplicitDigitalSurface::Tracker::Neighborhood
SurfelNeighborhood< KSpace > Neighborhood
Definition: ExplicitDigitalSurface.h:99
DGtal::ExplicitDigitalSurface::nbSurfels
Size nbSurfels() const
DGtal::ExplicitDigitalSurface::Space
KSpace::Space Space
Definition: ExplicitDigitalSurface.h:181
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::ExplicitDigitalSurface
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Definition: ExplicitDigitalSurface.h:81
DGtal::ExplicitDigitalSurface::surfelPredicate
const SurfelPredicate & surfelPredicate() const
accessor to point predicate.
DGtal::ExplicitDigitalSurface::surfelAdjacency
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
DGtal::ExplicitDigitalSurface::Tracker::Surfel
TKSpace::SCell Surfel
Definition: ExplicitDigitalSurface.h:95
DGtal::ExplicitDigitalSurface::DigitalSurfaceTracker
Tracker DigitalSurfaceTracker
Definition: ExplicitDigitalSurface.h:183
DGtal::ExplicitDigitalSurface::isValid
bool isValid() const
DGtal::ExplicitDigitalSurface::begin
SurfelConstIterator begin() const
DGtal::ExplicitDigitalSurface::Point
KSpace::Point Point
Definition: ExplicitDigitalSurface.h:182
DGtal::ExplicitDigitalSurface::Tracker::current
const Surfel & current() const
DGtal::ExplicitDigitalSurface::Tracker::Self
Tracker Self
Definition: ExplicitDigitalSurface.h:92
DGtal::ExplicitDigitalSurface::mySurfelAdjacency
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
Definition: ExplicitDigitalSurface.h:306
DGtal::ExplicitDigitalSurface::computeSurfels
void computeSurfels(const Surfel &p, bool closed)
DGtal::PointVector< dim, Integer >
DGtal::ExplicitDigitalSurface::Surfel
KSpace::SCell Surfel
Type for surfels.
Definition: ExplicitDigitalSurface.h:169
DGtal::ExplicitDigitalSurface::Self
ExplicitDigitalSurface< TKSpace, TSurfelPredicate > Self
Definition: ExplicitDigitalSurface.h:165
DGtal::ExplicitDigitalSurface::end
SurfelConstIterator end() const
DGtal::ExplicitDigitalSurface::Size
KSpace::Size Size
Type for sizes (unsigned integral type).
Definition: ExplicitDigitalSurface.h:171
DGtal::ExplicitDigitalSurface::newTracker
DigitalSurfaceTracker * newTracker(const Surfel &s) const
DGtal::ExplicitDigitalSurface::Cell
KSpace::Cell Cell
Definition: ExplicitDigitalSurface.h:188
DGtal::ExplicitDigitalSurface::Tracker::~Tracker
~Tracker()
DGtal::ExplicitDigitalSurface::~ExplicitDigitalSurface
~ExplicitDigitalSurface()
DGtal::ExplicitDigitalSurface::connectedness
Connectedness connectedness() const
DGtal::KhalimskyCell< dim, Integer >
DGtal::ExplicitDigitalSurface::isInside
bool isInside(const Surfel &s) const
DGtal::uint8_t
boost::uint8_t uint8_t
unsigned 8-bit integer.
Definition: BasicTypes.h:59
DGtal::ExplicitDigitalSurface::SCellSet
KSpace::SCellSet SCellSet
Definition: ExplicitDigitalSurface.h:191
DGtal::ExplicitDigitalSurface::CellSet
KSpace::CellSet CellSet
Definition: ExplicitDigitalSurface.h:190