DGtal  1.3.beta
LightExplicitDigitalSurface.h
1 
17 #pragma once
18 
31 #if defined(LightExplicitDigitalSurface_RECURSES)
32 #error Recursive header files inclusion detected in LightExplicitDigitalSurface.h
33 #else // defined(LightExplicitDigitalSurface_RECURSES)
34 
35 #define LightExplicitDigitalSurface_RECURSES
36 
37 #if !defined LightExplicitDigitalSurface_h
38 
39 #define LightExplicitDigitalSurface_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"
51 #include "DGtal/graph/BreadthFirstVisitor.h"
52 #include "DGtal/graph/GraphVisitorRange.h"
54 
55 namespace DGtal
56 {
57 
59  // template class LightExplicitDigitalSurface
117  template <typename TKSpace, typename TSurfelPredicate>
119  {
120  public:
121 
125  class Tracker
126  {
127  public:
128  // -------------------- associated types --------------------
129  typedef Tracker Self;
132  typedef typename TKSpace::SCell Surfel;
133 
134  // -------------------- inner types --------------------
135  typedef TKSpace KSpace;
137 
138  public:
145  const Surfel & s );
146 
151  Tracker( const Tracker & other );
152 
156  ~Tracker();
157 
159  const DigitalSurfaceContainer & surface() const;
161  const Surfel & current() const;
163  Dimension orthDir() const;
164 
170  void move( const Surfel & s );
171 
188  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
189 
190  private:
197 
198  };
199 
200  // ----------------------- associated types ------------------------------
201  public:
204  typedef TKSpace KSpace;
206  typedef typename KSpace::SCell Surfel;
208  typedef typename KSpace::Size Size;
209  // Model of CSurfelPredicate
210  typedef TSurfelPredicate SurfelPredicate;
211 
212  // BOOST_CONCEPT_ASSERT(( CCellularGridSpaceND< KSpace > ));
214 
215  // ----------------------- other types ------------------------------
216  public:
218  typedef typename KSpace::Cell Cell;
219  typedef typename KSpace::SCell SCell;
220  typedef typename KSpace::CellSet CellSet;
221  typedef typename KSpace::SCellSet SCellSet;
222 
223 
224  // ----------------- UndirectedSimplePreGraph types ------------------
225  typedef Surfel Vertex;
226  typedef SCellSet VertexSet;
227  template <typename Value>
228  struct VertexMap {
229  typedef typename KSpace::template SurfelMap<Value>::Type Type;
230  };
231 
232  // -------------------- specific types ------------------------------
236  typedef typename KSpace::Space Space;
237  typedef typename KSpace::Point Point;
239 
240  // ----------------------- Standard services ------------------------------
241  public:
242 
247 
253 
266  const Adjacency & adj,
267  const Surfel & s );
268 
270  const Adjacency & surfelAdjacency() const;
274  const SurfelPredicate & surfelPredicate() const;
276  const Surfel & surfel() const;
278  void setSurfel(const Surfel& aSurfel);
279 
280  // --------- CDigitalSurfaceContainer realization -------------------------
281  public:
282 
284  const KSpace & space() const;
289  bool isInside( const Surfel & s ) const;
290 
293  SurfelConstIterator begin() const;
294 
297  SurfelConstIterator end() const;
298 
302  Size nbSurfels() const;
303 
306  bool empty() const;
307 
313  DigitalSurfaceTracker* newTracker( const Surfel & s ) const;
314 
319 
320  // ----------------- CUndirectedSimplePreGraph realization -----------------
321  public:
322 
327  Size degree( const Vertex & v ) const;
328 
341  template <typename OutputIterator>
342  void writeNeighbors( OutputIterator & it,
343  const Vertex & v ) const;
344 
362  template <typename OutputIterator, typename VertexPredicate>
363  void writeNeighbors( OutputIterator & it,
364  const Vertex & v,
365  const VertexPredicate & pred ) const;
366 
375  Size bestCapacity() const;
376 
377 
378  // ----------------------- Interface --------------------------------------
379  public:
380 
385  void selfDisplay ( std::ostream & out ) const;
386 
391  bool isValid() const;
392 
393  // ------------------------- Protected Datas ------------------------------
394  private:
395  // ------------------------- Private Datas --------------------------------
396  private:
398  const KSpace & myKSpace;
407 
408  // ------------------------- Hidden services ------------------------------
409  protected:
410 
411 
412  private:
413 
421 
422  // ------------------------- Internals ------------------------------------
423  private:
424 
425  }; // end of class LightExplicitDigitalSurface
426 
427 
440  template <typename TKSpace, typename TSurfelPredicate>
441  std::ostream&
442  operator<< ( std::ostream & out,
444 
445 } // namespace DGtal
446 
447 
449 // Includes inline functions.
450 #include "DGtal/topology/LightExplicitDigitalSurface.ih"
451 
452 // //
454 
455 #endif // !defined LightExplicitDigitalSurface_h
456 
457 #undef LightExplicitDigitalSurface_RECURSES
458 #endif // else defined(LightExplicitDigitalSurface_RECURSES)
DGtal::LightExplicitDigitalSurface::connectedness
Connectedness connectedness() const
DGtal::LightExplicitDigitalSurface::SelfVisitor
BreadthFirstVisitor< Self > SelfVisitor
Definition: LightExplicitDigitalSurface.h:233
DGtal::LightExplicitDigitalSurface::mySurfelAdjacency
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
Definition: LightExplicitDigitalSurface.h:402
DGtal::LightExplicitDigitalSurface::newTracker
DigitalSurfaceTracker * newTracker(const Surfel &s) const
DGtal::LightExplicitDigitalSurface::Tracker::DigitalSurfaceContainer
LightExplicitDigitalSurface< TKSpace, TSurfelPredicate > DigitalSurfaceContainer
Definition: LightExplicitDigitalSurface.h:131
DGtal::LightExplicitDigitalSurface::setSurfel
void setSurfel(const Surfel &aSurfel)
mutator to starting surfel.
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::SurfelNeighborhood< KSpace >
DGtal::LightExplicitDigitalSurface::SelfVisitorRange
GraphVisitorRange< SelfVisitor > SelfVisitorRange
Definition: LightExplicitDigitalSurface.h:234
DGtal::LightExplicitDigitalSurface::Size
KSpace::Size Size
Type for sizes (unsigned integral type).
Definition: LightExplicitDigitalSurface.h:208
DGtal::LightExplicitDigitalSurface::Tracker::Self
Tracker Self
Definition: LightExplicitDigitalSurface.h:129
DGtal::LightExplicitDigitalSurface::Space
KSpace::Space Space
Definition: LightExplicitDigitalSurface.h:236
DGtal::LightExplicitDigitalSurface::degree
Size degree(const Vertex &v) const
DGtal::GraphVisitorRange
Aim: Transforms a graph visitor into a single pass input range.
Definition: GraphVisitorRange.h:71
DGtal::LightExplicitDigitalSurface::surfelPredicate
const SurfelPredicate & surfelPredicate() const
accessor to surfel predicate.
DGtal::LightExplicitDigitalSurface::DigitalSurfaceTracker
Tracker DigitalSurfaceTracker
Definition: LightExplicitDigitalSurface.h:238
DGtal::SurfelAdjacency< KSpace::dimension >
DGtal::LightExplicitDigitalSurface::nbSurfels
Size nbSurfels() const
DGtal::LightExplicitDigitalSurface::isValid
bool isValid() const
DGtal::concepts::CSurfelPredicate
Aim: Defines a predicate on a surfel.
Definition: CSurfelPredicate.h:76
DGtal::LightExplicitDigitalSurface::myKSpace
const KSpace & myKSpace
a reference to the cellular space.
Definition: LightExplicitDigitalSurface.h:398
DGtal::LightExplicitDigitalSurface::Tracker::Neighborhood
SurfelNeighborhood< KSpace > Neighborhood
Definition: LightExplicitDigitalSurface.h:136
DGtal::LightExplicitDigitalSurface::Point
KSpace::Point Point
Definition: LightExplicitDigitalSurface.h:237
DGtal::BreadthFirstVisitor
Aim: This class is useful to perform a breadth-first exploration of a graph given a starting point or...
Definition: BreadthFirstVisitor.h:94
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::LightExplicitDigitalSurface::KSpace
TKSpace KSpace
Model of cellular grid space.
Definition: LightExplicitDigitalSurface.h:204
DGtal::LightExplicitDigitalSurface::LightExplicitDigitalSurface
LightExplicitDigitalSurface(const LightExplicitDigitalSurface &other)
DGtal::LightExplicitDigitalSurface::VertexMap::Type
KSpace::template SurfelMap< Value >::Type Type
Definition: LightExplicitDigitalSurface.h:229
DGtal::LightExplicitDigitalSurface::VertexMap
Definition: LightExplicitDigitalSurface.h:228
DGtal::LightExplicitDigitalSurface::Tracker::orthDir
Dimension orthDir() const
SCell
Z3i::SCell SCell
Definition: fullConvexityShortestPaths3D.cpp:83
DGtal::LightExplicitDigitalSurface::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::LightExplicitDigitalSurface::SCell
KSpace::SCell SCell
Definition: LightExplicitDigitalSurface.h:219
DGtal::SignedKhalimskyCell
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Definition: KhalimskySpaceND.h:208
DGtal::LightExplicitDigitalSurface::Tracker::surface
const DigitalSurfaceContainer & surface() const
DGtal::Connectedness
Connectedness
Definition: Topology.h:50
DGtal::LightExplicitDigitalSurface::myTracker
Tracker myTracker
Internal tracker for visiting surfels.
Definition: LightExplicitDigitalSurface.h:406
DGtal::LightExplicitDigitalSurface::bestCapacity
Size bestCapacity() const
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::LightExplicitDigitalSurface::surfel
const Surfel & surfel() const
accessor to starting surfel.
DGtal::KhalimskySpaceND::SCellSet
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
Definition: KhalimskySpaceND.h:447
DGtal::LightExplicitDigitalSurface
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Definition: LightExplicitDigitalSurface.h:118
DGtal::SpaceND
Definition: SpaceND.h:95
DGtal::LightExplicitDigitalSurface::Cell
KSpace::Cell Cell
Definition: LightExplicitDigitalSurface.h:218
DGtal::KhalimskySpaceND::CellSet
std::set< Cell > CellSet
Preferred type for defining a set of Cell(s).
Definition: KhalimskySpaceND.h:444
DGtal::LightExplicitDigitalSurface::Tracker::adjacent
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
DGtal::LightExplicitDigitalSurface::Tracker::myNeighborhood
Neighborhood myNeighborhood
Definition: LightExplicitDigitalSurface.h:196
DGtal::LightExplicitDigitalSurface::Self
LightExplicitDigitalSurface< TKSpace, TSurfelPredicate > Self
Definition: LightExplicitDigitalSurface.h:202
DGtal::KhalimskySpaceND::Size
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
Definition: KhalimskySpaceND.h:407
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::LightExplicitDigitalSurface::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CSurfelPredicate< SurfelPredicate >))
DGtal::LightExplicitDigitalSurface::~LightExplicitDigitalSurface
~LightExplicitDigitalSurface()
DGtal::LightExplicitDigitalSurface::Tracker
Definition: LightExplicitDigitalSurface.h:125
DGtal::LightExplicitDigitalSurface::SCellSet
KSpace::SCellSet SCellSet
Definition: LightExplicitDigitalSurface.h:221
DGtal::LightExplicitDigitalSurface::operator=
LightExplicitDigitalSurface & operator=(const LightExplicitDigitalSurface &other)
DGtal::LightExplicitDigitalSurface::SurfelPredicate
TSurfelPredicate SurfelPredicate
Definition: LightExplicitDigitalSurface.h:210
DGtal::LightExplicitDigitalSurface::SurfelConstIterator
SelfVisitorRange::ConstIterator SurfelConstIterator
Definition: LightExplicitDigitalSurface.h:235
DGtal::GraphVisitorRange::GenericConstIterator
Definition: GraphVisitorRange.h:117
DGtal::LightExplicitDigitalSurface::Tracker::Surfel
TKSpace::SCell Surfel
Definition: LightExplicitDigitalSurface.h:132
DGtal::LightExplicitDigitalSurface::Tracker::mySurface
const DigitalSurfaceContainer & mySurface
Definition: LightExplicitDigitalSurface.h:193
DGtal::LightExplicitDigitalSurface::space
const KSpace & space() const
DGtal::LightExplicitDigitalSurface::mySurfel
Surfel mySurfel
a surfel belonging to the surface.
Definition: LightExplicitDigitalSurface.h:404
DGtal::LightExplicitDigitalSurface::Vertex
Surfel Vertex
Definition: LightExplicitDigitalSurface.h:225
DGtal::PointVector< dim, Integer >
DGtal::LightExplicitDigitalSurface::Tracker::~Tracker
~Tracker()
DGtal::LightExplicitDigitalSurface::empty
bool empty() const
DGtal::LightExplicitDigitalSurface::mySurfelPredicate
const SurfelPredicate & mySurfelPredicate
a reference to the surfel predicate defining the shape.
Definition: LightExplicitDigitalSurface.h:400
DGtal::LightExplicitDigitalSurface::Tracker::Tracker
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
DGtal::LightExplicitDigitalSurface::Tracker::move
void move(const Surfel &s)
DGtal::LightExplicitDigitalSurface::surfelAdjacency
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
DGtal::LightExplicitDigitalSurface::end
SurfelConstIterator end() const
DGtal::LightExplicitDigitalSurface::writeNeighbors
void writeNeighbors(OutputIterator &it, const Vertex &v) const
DGtal::LightExplicitDigitalSurface::Tracker::current
const Surfel & current() const
DGtal::LightExplicitDigitalSurface::begin
SurfelConstIterator begin() const
DGtal::LightExplicitDigitalSurface::isInside
bool isInside(const Surfel &s) const
DGtal::LightExplicitDigitalSurface::Surfel
KSpace::SCell Surfel
Type for surfels.
Definition: LightExplicitDigitalSurface.h:206
DGtal::LightExplicitDigitalSurface::VertexSet
SCellSet VertexSet
Definition: LightExplicitDigitalSurface.h:226
DGtal::KhalimskyCell< dim, Integer >
DGtal::LightExplicitDigitalSurface::Tracker::KSpace
TKSpace KSpace
Definition: LightExplicitDigitalSurface.h:135
DGtal::uint8_t
boost::uint8_t uint8_t
unsigned 8-bit integer.
Definition: BasicTypes.h:59
DGtal::LightExplicitDigitalSurface::CellSet
KSpace::CellSet CellSet
Definition: LightExplicitDigitalSurface.h:220
DGtal::LightExplicitDigitalSurface::Adjacency
SurfelAdjacency< KSpace::dimension > Adjacency
Definition: LightExplicitDigitalSurface.h:217