DGtal 1.4.0
Loading...
Searching...
No Matches
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)
35#define LightImplicitDigitalSurface_RECURSES
36
37#if !defined LightImplicitDigitalSurface_h
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
55namespace DGtal
56{
57
59 // template class LightImplicitDigitalSurface
114 template <typename TKSpace, typename TPointPredicate>
116 {
117 public:
118
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
154
158 const Surfel & current() 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;
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;
272
273 // --------- CDigitalSurfaceContainer realization -------------------------
274 public:
275
277 const KSpace & space() const;
282 bool isInside( const Surfel & s ) const;
283
287
291
296
299 bool empty() const;
300
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
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:
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)
Aim: This class is useful to perform a breadth-first exploration of a graph given a starting point or...
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition ConstAlias.h:187
Aim: Transforms a graph visitor into a single pass input range.
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
std::set< Cell > CellSet
Preferred type for defining a set of Cell(s).
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
LightImplicitDigitalSurface< TKSpace, TPointPredicate > DigitalSurfaceContainer
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
const DigitalSurfaceContainer & surface() const
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
DigitalSurfaceTracker * newTracker(const Surfel &s) const
void writeNeighbors(OutputIterator &it, const Vertex &v, const VertexPredicate &pred) const
LightImplicitDigitalSurface< TKSpace, TPointPredicate > Self
SurfelConstIterator begin() const
SelfVisitorRange::ConstIterator SurfelConstIterator
const PointPredicate & myPointPredicate
a reference to the point predicate defining the shape.
Size degree(const Vertex &v) const
Connectedness connectedness() const
SurfelAdjacency< KSpace::dimension > Adjacency
GraphVisitorRange< SelfVisitor > SelfVisitorRange
LightImplicitDigitalSurface(ConstAlias< KSpace > aKSpace, ConstAlias< PointPredicate > aPP, const Adjacency &adj, const Surfel &s)
Tracker myTracker
Internal tracker for visiting surfels.
const PointPredicate & pointPredicate() const
accessor to point predicate.
Surfel mySurfel
a surfel belonging to the surface.
LightImplicitDigitalSurface & operator=(const LightImplicitDigitalSurface &other)
void writeNeighbors(OutputIterator &it, const Vertex &v) const
bool isInside(const Surfel &s) const
SurfelConstIterator end() const
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
Adjacency & surfelAdjacency()
mutator to surfel adjacency.
KSpace::Size Size
Type for sizes (unsigned integral type).
void selfDisplay(std::ostream &out) const
LightImplicitDigitalSurface(const LightImplicitDigitalSurface &other)
TKSpace KSpace
Model of cellular grid space.
const KSpace & space() const
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
const KSpace & myKSpace
a reference to the cellular space.
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
Aim: This helper class is useful to compute the neighboring surfels of a given surfel,...
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::uint8_t uint8_t
unsigned 8-bit integer.
Definition BasicTypes.h:59
Connectedness
Definition Topology.h:51
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Definition Common.h:136
KSpace::template SurfelMap< Value >::Type Type
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: Defines a predicate on a point.