DGtal  0.9.2
DigitalSetBoundary.h
1 
17 #pragma once
18 
31 #if defined(DigitalSetBoundary_RECURSES)
32 #error Recursive header files inclusion detected in DigitalSetBoundary.h
33 #else // defined(DigitalSetBoundary_RECURSES)
34 
35 #define DigitalSetBoundary_RECURSES
36 
37 #if !defined DigitalSetBoundary_h
38 
39 #define DigitalSetBoundary_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/Topology.h"
48 #include "DGtal/topology/SurfelAdjacency.h"
49 #include "DGtal/topology/SurfelNeighborhood.h"
51 
52 namespace DGtal
53 {
54 
56  // template class DigitalSetBoundary
68  template <typename TKSpace, typename TDigitalSet>
70  {
71  public:
72 
76  class Tracker
77  {
78  public:
79  // -------------------- associated types --------------------
80  typedef Tracker Self;
82  typedef typename TKSpace::SCell Surfel;
83 
84  // -------------------- inner types --------------------
85  typedef TKSpace KSpace;
87 
88  public:
95  const Surfel & s );
96 
101  Tracker( const Tracker & other );
102 
106  ~Tracker();
107 
109  const DigitalSurfaceContainer & surface() const;
111  const Surfel & current() const;
113  Dimension orthDir() const;
114 
120  void move( const Surfel & s );
121 
138  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
139 
140  private:
143  const DigitalSurfaceContainer & mySurface;
146  Neighborhood myNeighborhood;
147 
148  };
149 
150  // ----------------------- associated types ------------------------------
151  public:
153  typedef TKSpace KSpace;
154  typedef typename KSpace::SCell Surfel;
155  typedef typename KSpace::Size Size;
156  typedef TDigitalSet DigitalSet;
157  typedef typename std::vector<Surfel> SurfelStorage;
158  typedef typename SurfelStorage::const_iterator SurfelConstIterator;
159  typedef typename KSpace::Space Space;
160  typedef typename DigitalSet::Domain Domain;
161  typedef typename DigitalSet::Point Point;
163 
164  // ----------------------- other types ------------------------------
165  public:
167  typedef typename KSpace::Cell Cell;
168  typedef typename KSpace::SCell SCell;
169 
170  // ----------------------- Standard services ------------------------------
171  public:
172 
177 
182  DigitalSetBoundary ( const DigitalSetBoundary & other );
183 
193  const DigitalSet & aSet,
194  const Adjacency & adj = Adjacency( true ) );
195 
197  const Adjacency & surfelAdjacency() const;
199  Adjacency & surfelAdjacency();
201  const DigitalSet & digitalSet() const;
202 
203  // --------- CDigitalSurfaceContainer realization -------------------------
204  public:
205 
207  const KSpace & space() const;
212  bool isInside( const Surfel & s ) const;
213 
216  SurfelConstIterator begin() const;
217 
220  SurfelConstIterator end() const;
221 
223  Size nbSurfels() const;
224 
227  bool empty() const;
228 
234  DigitalSurfaceTracker* newTracker( const Surfel & s ) const;
235 
241 
242  // ----------------------- Interface --------------------------------------
243  public:
244 
249  void selfDisplay ( std::ostream & out ) const;
250 
255  bool isValid() const;
256 
257  // ------------------------- Protected Datas ------------------------------
258  private:
259  // ------------------------- Private Datas --------------------------------
260  private:
262  const KSpace & myKSpace;
264  DigitalSet myDigitalSet;
266  Adjacency mySurfelAdjacency;
268  SurfelStorage mySurfels;
269 
270  // ------------------------- Hidden services ------------------------------
271  protected:
275  void computeSurfels();
276 
277 
278  private:
279 
287 
288  // ------------------------- Internals ------------------------------------
289  private:
290 
291  }; // end of class DigitalSetBoundary
292 
293 
306  template <typename TKSpace, typename TDigitalSet>
307  std::ostream&
308  operator<< ( std::ostream & out,
310 
311 } // namespace DGtal
312 
313 
315 // Includes inline functions.
316 #include "DGtal/topology/DigitalSetBoundary.ih"
317 
318 // //
320 
321 #endif // !defined DigitalSetBoundary_h
322 
323 #undef DigitalSetBoundary_RECURSES
324 #endif // else defined(DigitalSetBoundary_RECURSES)
SurfelConstIterator begin() const
Connectedness connectedness() const
const DigitalSurfaceContainer & surface() const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DigitalSetBoundary(const DigitalSetBoundary &other)
DGtal::uint32_t Dimension
Definition: Common.h:113
const KSpace & space() const
SurfelConstIterator end() const
const DigitalSet & digitalSet() const
accessor to digital set
DigitalSet myDigitalSet
a smart pointer to some digital set.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
SurfelStorage::const_iterator SurfelConstIterator
DigitalSetBoundary< TKSpace, TDigitalSet > Self
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
SurfelAdjacency< KSpace::dimension > Adjacency
const Surfel & current() const
std::vector< Surfel > SurfelStorage
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
const DigitalSurfaceContainer & mySurface
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
SurfelNeighborhood< KSpace > Neighborhood
bool isInside(const Surfel &s) const
void selfDisplay(std::ostream &out) const
DigitalSetBoundary< TKSpace, TDigitalSet > DigitalSurfaceContainer
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
DigitalSetBoundary & operator=(const DigitalSetBoundary &other)
const KSpace & myKSpace
a reference to the cellular space.
Connectedness
Definition: Topology.h:50
DigitalSurfaceTracker * newTracker(const Surfel &s) const
SurfelStorage mySurfels
a vector storing all the surfels of the boundary.
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.