DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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/topology/Topology.h"
47 #include "DGtal/topology/SurfelAdjacency.h"
48 #include "DGtal/topology/SurfelNeighborhood.h"
50 
51 namespace DGtal
52 {
53 
55  // template class DigitalSetBoundary
67  template <typename TKSpace, typename TDigitalSet>
69  {
70  public:
71 
75  class Tracker
76  {
77  public:
78  // -------------------- associated types --------------------
79  typedef Tracker Self;
81  typedef typename TKSpace::SCell Surfel;
82 
83  // -------------------- inner types --------------------
84  typedef TKSpace KSpace;
86 
87  public:
93  Tracker( const DigitalSurfaceContainer & aSurface,
94  const Surfel & s );
95 
100  Tracker( const Tracker & other );
101 
105  ~Tracker();
106 
108  const DigitalSurfaceContainer & surface() const;
110  const Surfel & current() const;
112  Dimension orthDir() const;
113 
119  void move( const Surfel & s );
120 
137  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
138 
139  private:
146 
147  };
148 
149  // ----------------------- associated types ------------------------------
150  public:
152  typedef TKSpace KSpace;
153  typedef typename KSpace::SCell Surfel;
154  typedef typename KSpace::Size Size;
155  typedef TDigitalSet DigitalSet;
156  typedef typename std::vector<Surfel> SurfelStorage;
157  typedef typename SurfelStorage::const_iterator SurfelConstIterator;
158  typedef typename KSpace::Space Space;
159  typedef typename DigitalSet::Domain Domain;
160  typedef typename DigitalSet::Point Point;
162 
163  // ----------------------- other types ------------------------------
164  public:
166  typedef typename KSpace::Cell Cell;
167  typedef typename KSpace::SCell SCell;
168 
169  // ----------------------- Standard services ------------------------------
170  public:
171 
176 
181  DigitalSetBoundary ( const DigitalSetBoundary & other );
182 
191  DigitalSetBoundary( const KSpace & aKSpace,
192  const DigitalSet & aSet,
193  const Adjacency & adj = Adjacency( true ) );
194 
196  const Adjacency & surfelAdjacency() const;
200  const DigitalSet & digitalSet() const;
201 
202  // --------- CDigitalSurfaceContainer realization -------------------------
203  public:
204 
206  const KSpace & space() const;
211  bool isInside( const Surfel & s ) const;
212 
215  SurfelConstIterator begin() const;
216 
219  SurfelConstIterator end() const;
220 
222  Size nbSurfels() const;
223 
226  bool empty() const;
227 
233  DigitalSurfaceTracker* newTracker( const Surfel & s ) const;
234 
240 
241  // ----------------------- Interface --------------------------------------
242  public:
243 
248  void selfDisplay ( std::ostream & out ) const;
249 
254  bool isValid() const;
255 
256  // ------------------------- Protected Datas ------------------------------
257  private:
258  // ------------------------- Private Datas --------------------------------
259  private:
261  const KSpace & myKSpace;
268 
269  // ------------------------- Hidden services ------------------------------
270  protected:
274  void computeSurfels();
275 
276 
277  private:
278 
286 
287  // ------------------------- Internals ------------------------------------
288  private:
289 
290  }; // end of class DigitalSetBoundary
291 
292 
305  template <typename TKSpace, typename TDigitalSet>
306  std::ostream&
307  operator<< ( std::ostream & out,
309 
310 } // namespace DGtal
311 
312 
314 // Includes inline functions.
315 #include "DGtal/topology/DigitalSetBoundary.ih"
316 
317 // //
319 
320 #endif // !defined DigitalSetBoundary_h
321 
322 #undef DigitalSetBoundary_RECURSES
323 #endif // else defined(DigitalSetBoundary_RECURSES)