DGtal  1.2.0
ImplicitDigitalSurface.h
1 
17 #pragma once
18 
31 #if defined(ImplicitDigitalSurface_RECURSES)
32 #error Recursive header files inclusion detected in ImplicitDigitalSurface.h
33 #else // defined(ImplicitDigitalSurface_RECURSES)
35 #define ImplicitDigitalSurface_RECURSES
36 
37 #if !defined ImplicitDigitalSurface_h
39 #define ImplicitDigitalSurface_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"
52 
53 namespace DGtal
54 {
55 
57  // template class ImplicitDigitalSurface
70  template <typename TKSpace, typename TPointPredicate>
72  {
73  public:
74 
78  class Tracker
79  {
80  public:
81  // -------------------- associated types --------------------
82  typedef Tracker Self;
85  typedef typename TKSpace::SCell Surfel;
86 
87  // -------------------- inner types --------------------
88  typedef TKSpace KSpace;
90 
91  public:
98  const Surfel & s );
99 
104  Tracker( const Tracker & other );
105 
110 
114  const Surfel & current() const;
117 
123  void move( const Surfel & s );
124 
141  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
142 
143  private:
150 
151  };
152 
153  // ----------------------- associated types ------------------------------
154  public:
157  typedef TKSpace KSpace;
159  typedef typename KSpace::SCell Surfel;
161  typedef typename KSpace::Size Size;
162  // Model of concepts::CPointPredicate
163  typedef TPointPredicate PointPredicate;
164 
167 
168  // -------------------- specific types ------------------------------
169  typedef typename std::vector<Surfel> SurfelStorage;
170  typedef typename SurfelStorage::const_iterator SurfelConstIterator;
171  typedef typename KSpace::Space Space;
172  typedef typename KSpace::Point Point;
174 
175  // ----------------------- other types ------------------------------
176  public:
178  typedef typename KSpace::Cell Cell;
179  typedef typename KSpace::SCell SCell;
180  typedef typename KSpace::CellSet CellSet;
181  typedef typename KSpace::SCellSet SCellSet;
182 
183  // ----------------------- Standard services ------------------------------
184  public:
185 
190 
200 
222  const Adjacency & adj,
223  const Surfel & s,
224  bool closed = false );
225 
227  const Adjacency & surfelAdjacency() const;
232 
233  // --------- CDigitalSurfaceContainer realization -------------------------
234  public:
235 
237  const KSpace & space() const;
242  bool isInside( const Surfel & s ) const;
243 
247 
251 
254  Size nbSurfels() const;
255 
258  bool empty() const;
259 
266 
272 
273  // ----------------------- Interface --------------------------------------
274  public:
275 
280  void selfDisplay ( std::ostream & out ) const;
281 
286  bool isValid() const;
287 
288  // ------------------------- Protected Datas ------------------------------
289  private:
290  // ------------------------- Private Datas --------------------------------
291  private:
293  const KSpace & myKSpace;
300 
301  // ------------------------- Hidden services ------------------------------
302  protected:
313  void computeSurfels( const Surfel & p,
314  bool closed );
315 
316 
317  private:
318 
326 
327  // ------------------------- Internals ------------------------------------
328  private:
329 
330  }; // end of class ImplicitDigitalSurface
331 
332 
345  template <typename TKSpace, typename TPointPredicate>
346  std::ostream&
347  operator<< ( std::ostream & out,
349 
350 } // namespace DGtal
351 
352 
354 // Includes inline functions.
355 #include "DGtal/topology/ImplicitDigitalSurface.ih"
356 
357 // //
359 
360 #endif // !defined ImplicitDigitalSurface_h
361 
362 #undef ImplicitDigitalSurface_RECURSES
363 #endif // else defined(ImplicitDigitalSurface_RECURSES)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
SurfelNeighborhood< KSpace > Neighborhood
const DigitalSurfaceContainer & surface() const
ImplicitDigitalSurface< TKSpace, TPointPredicate > DigitalSurfaceContainer
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
const DigitalSurfaceContainer & mySurface
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
ImplicitDigitalSurface(const ImplicitDigitalSurface &other)
const PointPredicate & myPointPredicate
a reference to the point predicate defining the shape.
SurfelAdjacency< KSpace::dimension > Adjacency
void computeSurfels(const Surfel &p, bool closed)
SurfelConstIterator begin() const
TKSpace KSpace
Model of cellular grid space.
ImplicitDigitalSurface & operator=(const ImplicitDigitalSurface &other)
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
const KSpace & myKSpace
a reference to the cellular space.
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
void selfDisplay(std::ostream &out) const
DigitalSurfaceTracker * newTracker(const Surfel &s) const
ImplicitDigitalSurface< TKSpace, TPointPredicate > Self
KSpace::SCell Surfel
Type for surfels.
Adjacency & surfelAdjacency()
mutator to surfel adjacency.
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
ImplicitDigitalSurface(ConstAlias< KSpace > aKSpace, ConstAlias< PointPredicate > aPP, const Adjacency &adj, const Surfel &s, bool closed=false)
bool isInside(const Surfel &s) const
const PointPredicate & pointPredicate() const
accessor to point predicate.
const KSpace & space() const
KSpace::Size Size
Type for sizes (unsigned integral type).
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< KSpace >))
SurfelStorage mySurfels
a vector storing all the surfels of the boundary.
SurfelConstIterator end() const
Connectedness connectedness() const
SurfelStorage::const_iterator SurfelConstIterator
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).
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:137
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Aim: Defines a predicate on a point.