DGtal  1.3.beta
LightImplicitDigitalSurface.h
1 
17 #pragma once
18 
31 #if defined(LightImplicitDigitalSurface_RECURSES)
32 #error Recursive header files inclusion detected in LightImplicitDigitalSurface.h
33 #else // defined(LightImplicitDigitalSurface_RECURSES)
34 
35 #define LightImplicitDigitalSurface_RECURSES
36 
37 #if !defined LightImplicitDigitalSurface_h
38 
39 #define LightImplicitDigitalSurface_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/kernel/CPointPredicate.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 LightImplicitDigitalSurface
114  template <typename TKSpace, typename TPointPredicate>
116  {
117  public:
118 
122  class Tracker
123  {
124  public:
125  // -------------------- associated types --------------------
126  typedef Tracker Self;
129  typedef typename TKSpace::SCell Surfel;
130 
131  // -------------------- inner types --------------------
132  typedef TKSpace KSpace;
134 
135  public:
142  const Surfel & s );
143 
148  Tracker( const Tracker & other );
149 
153  ~Tracker();
154 
156  const DigitalSurfaceContainer & surface() const;
158  const Surfel & current() const;
160  Dimension orthDir() const;
161 
167  void move( const Surfel & s );
168 
185  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
186 
187  private:
194 
195  };
196 
197  // ----------------------- associated types ------------------------------
198  public:
201  typedef TKSpace KSpace;
203  typedef typename KSpace::SCell Surfel;
205  typedef typename KSpace::Size Size;
206  // Model of concepts::CPointPredicate
207  typedef TPointPredicate PointPredicate;
208 
209  // BOOST_CONCEPT_ASSERT(( CCellularGridSpaceND< KSpace > ));
211 
212  // ----------------------- other types ------------------------------
213  public:
215  typedef typename KSpace::Cell Cell;
216  typedef typename KSpace::SCell SCell;
217  typedef typename KSpace::CellSet CellSet;
218  typedef typename KSpace::SCellSet SCellSet;
219 
220 
221  // ----------------- UndirectedSimpleLocalGraph types ------------------
222  typedef Surfel Vertex;
223  typedef SCellSet VertexSet;
224  template <typename Value>
225  struct VertexMap {
226  typedef typename KSpace::template SurfelMap<Value>::Type Type;
227  };
228 
229  // -------------------- specific types ------------------------------
233  typedef typename KSpace::Space Space;
234  typedef typename KSpace::Point Point;
236 
237  // ----------------------- Standard services ------------------------------
238  public:
239 
244 
250 
263  const Adjacency & adj,
264  const Surfel & s );
265 
267  const Adjacency & surfelAdjacency() const;
271  const PointPredicate & pointPredicate() const;
272 
273  // --------- CDigitalSurfaceContainer realization -------------------------
274  public:
275 
277  const KSpace & space() const;
282  bool isInside( const Surfel & s ) const;
283 
286  SurfelConstIterator begin() const;
287 
290  SurfelConstIterator end() const;
291 
295  Size nbSurfels() const;
296 
299  bool empty() const;
300 
306  DigitalSurfaceTracker* newTracker( const Surfel & s ) const;
307 
313 
314  // ----------------- UndirectedSimplePreGraph realization --------------------
315  public:
316 
321  Size degree( const Vertex & v ) const;
322 
335  template <typename OutputIterator>
336  void writeNeighbors( OutputIterator & it,
337  const Vertex & v ) const;
338 
356  template <typename OutputIterator, typename VertexPredicate>
357  void writeNeighbors( OutputIterator & it,
358  const Vertex & v,
359  const VertexPredicate & pred ) const;
360 
369  Size bestCapacity() const;
370 
371 
372  // ----------------------- Interface --------------------------------------
373  public:
374 
379  void selfDisplay ( std::ostream & out ) const;
380 
385  bool isValid() const;
386 
387  // ------------------------- Protected Datas ------------------------------
388  private:
389  // ------------------------- Private Datas --------------------------------
390  private:
392  const KSpace & myKSpace;
401 
402  // ------------------------- Hidden services ------------------------------
403  protected:
404 
405 
406  private:
407 
415 
416  // ------------------------- Internals ------------------------------------
417  private:
418 
419  }; // end of class LightImplicitDigitalSurface
420 
421 
434  template <typename TKSpace, typename TPointPredicate>
435  std::ostream&
436  operator<< ( std::ostream & out,
438 
439 } // namespace DGtal
440 
441 
443 // Includes inline functions.
444 #include "DGtal/topology/LightImplicitDigitalSurface.ih"
445 
446 // //
448 
449 #endif // !defined LightImplicitDigitalSurface_h
450 
451 #undef LightImplicitDigitalSurface_RECURSES
452 #endif // else defined(LightImplicitDigitalSurface_RECURSES)
DGtal::LightImplicitDigitalSurface::myPointPredicate
const PointPredicate & myPointPredicate
a reference to the point predicate defining the shape.
Definition: LightImplicitDigitalSurface.h:394
DGtal::LightImplicitDigitalSurface::myTracker
Tracker myTracker
Internal tracker for visiting surfels.
Definition: LightImplicitDigitalSurface.h:400
DGtal::LightImplicitDigitalSurface::empty
bool empty() const
DGtal::LightImplicitDigitalSurface::Tracker::Tracker
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
DGtal::LightImplicitDigitalSurface::KSpace
TKSpace KSpace
Model of cellular grid space.
Definition: LightImplicitDigitalSurface.h:201
DGtal::LightImplicitDigitalSurface::begin
SurfelConstIterator begin() const
DGtal::LightImplicitDigitalSurface::pointPredicate
const PointPredicate & pointPredicate() const
accessor to point predicate.
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::LightImplicitDigitalSurface::operator=
LightImplicitDigitalSurface & operator=(const LightImplicitDigitalSurface &other)
DGtal::LightImplicitDigitalSurface::Size
KSpace::Size Size
Type for sizes (unsigned integral type).
Definition: LightImplicitDigitalSurface.h:205
DGtal::GraphVisitorRange
Aim: Transforms a graph visitor into a single pass input range.
Definition: GraphVisitorRange.h:71
DGtal::LightImplicitDigitalSurface::mySurfel
Surfel mySurfel
a surfel belonging to the surface.
Definition: LightImplicitDigitalSurface.h:398
DGtal::SurfelAdjacency< KSpace::dimension >
DGtal::LightImplicitDigitalSurface::writeNeighbors
void writeNeighbors(OutputIterator &it, const Vertex &v) const
DGtal::LightImplicitDigitalSurface::Adjacency
SurfelAdjacency< KSpace::dimension > Adjacency
Definition: LightImplicitDigitalSurface.h:214
DGtal::LightImplicitDigitalSurface::SurfelConstIterator
SelfVisitorRange::ConstIterator SurfelConstIterator
Definition: LightImplicitDigitalSurface.h:232
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::LightImplicitDigitalSurface::Tracker::~Tracker
~Tracker()
DGtal::LightImplicitDigitalSurface::Tracker::KSpace
TKSpace KSpace
Definition: LightImplicitDigitalSurface.h:132
DGtal::LightImplicitDigitalSurface::SelfVisitorRange
GraphVisitorRange< SelfVisitor > SelfVisitorRange
Definition: LightImplicitDigitalSurface.h:231
DGtal::LightImplicitDigitalSurface::Tracker::orthDir
Dimension orthDir() const
SCell
Z3i::SCell SCell
Definition: fullConvexityShortestPaths3D.cpp:83
DGtal::LightImplicitDigitalSurface::Tracker::adjacent
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
DGtal::LightImplicitDigitalSurface::Space
KSpace::Space Space
Definition: LightImplicitDigitalSurface.h:233
DGtal::SignedKhalimskyCell
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Definition: KhalimskySpaceND.h:208
DGtal::LightImplicitDigitalSurface::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
DGtal::Connectedness
Connectedness
Definition: Topology.h:50
DGtal::LightImplicitDigitalSurface::myKSpace
const KSpace & myKSpace
a reference to the cellular space.
Definition: LightImplicitDigitalSurface.h:392
DGtal::LightImplicitDigitalSurface::bestCapacity
Size bestCapacity() const
DGtal::LightImplicitDigitalSurface::Tracker::current
const Surfel & current() const
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::LightImplicitDigitalSurface::end
SurfelConstIterator end() const
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::LightImplicitDigitalSurface::DigitalSurfaceTracker
Tracker DigitalSurfaceTracker
Definition: LightImplicitDigitalSurface.h:235
DGtal::LightImplicitDigitalSurface::isInside
bool isInside(const Surfel &s) const
DGtal::KhalimskySpaceND::CellSet
std::set< Cell > CellSet
Preferred type for defining a set of Cell(s).
Definition: KhalimskySpaceND.h:444
DGtal::LightImplicitDigitalSurface::newTracker
DigitalSurfaceTracker * newTracker(const Surfel &s) const
DGtal::LightImplicitDigitalSurface::Vertex
Surfel Vertex
Definition: LightImplicitDigitalSurface.h:222
DGtal::LightImplicitDigitalSurface::Tracker::move
void move(const Surfel &s)
DGtal::LightImplicitDigitalSurface::Tracker::surface
const DigitalSurfaceContainer & surface() const
DGtal::LightImplicitDigitalSurface
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Definition: LightImplicitDigitalSurface.h:115
DGtal::LightImplicitDigitalSurface::surfelAdjacency
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
DGtal::LightImplicitDigitalSurface::Tracker::Self
Tracker Self
Definition: LightImplicitDigitalSurface.h:126
DGtal::LightImplicitDigitalSurface::PointPredicate
TPointPredicate PointPredicate
Definition: LightImplicitDigitalSurface.h:207
DGtal::LightImplicitDigitalSurface::VertexSet
SCellSet VertexSet
Definition: LightImplicitDigitalSurface.h:223
DGtal::KhalimskySpaceND::Size
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
Definition: KhalimskySpaceND.h:407
DGtal::LightImplicitDigitalSurface::Tracker::Neighborhood
SurfelNeighborhood< KSpace > Neighborhood
Definition: LightImplicitDigitalSurface.h:133
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::LightImplicitDigitalSurface::nbSurfels
Size nbSurfels() const
DGtal::LightImplicitDigitalSurface::Self
LightImplicitDigitalSurface< TKSpace, TPointPredicate > Self
Definition: LightImplicitDigitalSurface.h:199
DGtal::LightImplicitDigitalSurface::SCellSet
KSpace::SCellSet SCellSet
Definition: LightImplicitDigitalSurface.h:218
DGtal::LightImplicitDigitalSurface::Cell
KSpace::Cell Cell
Definition: LightImplicitDigitalSurface.h:215
DGtal::LightImplicitDigitalSurface::CellSet
KSpace::CellSet CellSet
Definition: LightImplicitDigitalSurface.h:217
DGtal::LightImplicitDigitalSurface::SCell
KSpace::SCell SCell
Definition: LightImplicitDigitalSurface.h:216
DGtal::LightImplicitDigitalSurface::degree
Size degree(const Vertex &v) const
DGtal::LightImplicitDigitalSurface::connectedness
Connectedness connectedness() const
DGtal::GraphVisitorRange::GenericConstIterator
Definition: GraphVisitorRange.h:117
DGtal::LightImplicitDigitalSurface::Tracker
Definition: LightImplicitDigitalSurface.h:122
DGtal::LightImplicitDigitalSurface::Surfel
KSpace::SCell Surfel
Type for surfels.
Definition: LightImplicitDigitalSurface.h:203
DGtal::LightImplicitDigitalSurface::Tracker::Surfel
TKSpace::SCell Surfel
Definition: LightImplicitDigitalSurface.h:129
DGtal::PointVector< dim, Integer >
DGtal::LightImplicitDigitalSurface::~LightImplicitDigitalSurface
~LightImplicitDigitalSurface()
DGtal::LightImplicitDigitalSurface::space
const KSpace & space() const
DGtal::concepts::CPointPredicate
Aim: Defines a predicate on a point.
Definition: CPointPredicate.h:80
DGtal::LightImplicitDigitalSurface::Tracker::mySurface
const DigitalSurfaceContainer & mySurface
Definition: LightImplicitDigitalSurface.h:190
DGtal::LightImplicitDigitalSurface::VertexMap
Definition: LightImplicitDigitalSurface.h:225
DGtal::LightImplicitDigitalSurface::VertexMap::Type
KSpace::template SurfelMap< Value >::Type Type
Definition: LightImplicitDigitalSurface.h:226
DGtal::LightImplicitDigitalSurface::Point
KSpace::Point Point
Definition: LightImplicitDigitalSurface.h:234
DGtal::LightImplicitDigitalSurface::isValid
bool isValid() const
DGtal::LightImplicitDigitalSurface::SelfVisitor
BreadthFirstVisitor< Self > SelfVisitor
Definition: LightImplicitDigitalSurface.h:230
DGtal::LightImplicitDigitalSurface::mySurfelAdjacency
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
Definition: LightImplicitDigitalSurface.h:396
DGtal::LightImplicitDigitalSurface::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::LightImplicitDigitalSurface::Tracker::myNeighborhood
Neighborhood myNeighborhood
Definition: LightImplicitDigitalSurface.h:193
DGtal::LightImplicitDigitalSurface::Tracker::DigitalSurfaceContainer
LightImplicitDigitalSurface< TKSpace, TPointPredicate > DigitalSurfaceContainer
Definition: LightImplicitDigitalSurface.h:128
DGtal::KhalimskyCell< dim, Integer >
DGtal::LightImplicitDigitalSurface::LightImplicitDigitalSurface
LightImplicitDigitalSurface(const LightImplicitDigitalSurface &other)
DGtal::uint8_t
boost::uint8_t uint8_t
unsigned 8-bit integer.
Definition: BasicTypes.h:59