DGtal  0.9.2
SetOfSurfels.h
1 
17 #pragma once
18 
31 #if defined(SetOfSurfels_RECURSES)
32 #error Recursive header files inclusion detected in SetOfSurfels.h
33 #else // defined(SetOfSurfels_RECURSES)
34 
35 #define SetOfSurfels_RECURSES
36 
37 #if !defined SetOfSurfels_h
38 
39 #define SetOfSurfels_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"
50 #include "DGtal/topology/SurfelSetPredicate.h"
52 
53 namespace DGtal
54 {
55 
57  // template class SetOfSurfels
71  template < typename TKSpace,
72  typename TSurfelSet = typename TKSpace::SurfelSet >
74  {
75  public:
76 
80  class Tracker
81  {
82  public:
83  // -------------------- associated types --------------------
84  typedef Tracker Self;
86  typedef typename TKSpace::SCell Surfel;
87 
88  // -------------------- inner types --------------------
89  typedef TKSpace KSpace;
91 
92  public:
99  const Surfel & s );
100 
105  Tracker( const Tracker & other );
106 
110  ~Tracker();
111 
113  const DigitalSurfaceContainer & surface() const;
115  const Surfel & current() const;
117  Dimension orthDir() const;
118 
124  void move( const Surfel & s );
125 
142  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
143 
144  private:
147  const DigitalSurfaceContainer & mySurface;
150  Neighborhood myNeighborhood;
151 
152  };
153 
154  // ----------------------- associated types ------------------------------
155  public:
158  typedef TKSpace KSpace;
160  typedef typename KSpace::SCell Surfel;
162  typedef typename KSpace::Size Size;
163  // Model of CSurfelSet
164  typedef TSurfelSet SurfelSet;
165 
166  // BOOST_CONCEPT_ASSERT(( CCellularGridSpaceND< KSpace > ));
167  // BOOST_CONCEPT_ASSERT(( CSurfelSet< SurfelSet > ));
168 
169  // -------------------- specific types ------------------------------
170  typedef typename SurfelSet::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;
183 
184  // ----------------------- Standard services ------------------------------
185  public:
186 
190  ~SetOfSurfels();
191 
198  SetOfSurfels ( const SetOfSurfels & other );
199 
213  const Adjacency & adj,
214  SurfelSet aSetOfSurfels = SurfelSet() );
215 
216  // Mutator to set of surfels.
217  SurfelSet & surfelSet();
218  // Accessor to set of surfels.
219  const SurfelSet & surfelSet() const;
220 
222  const Adjacency & surfelAdjacency() const;
224  Adjacency & surfelAdjacency();
226  const SurfelPredicate & surfelPredicate() const;
227 
228  // --------- CDigitalSurfaceContainer realization -------------------------
229  public:
230 
232  const KSpace & space() const;
237  bool isInside( const Surfel & s ) const;
238 
241  SurfelConstIterator begin() const;
242 
245  SurfelConstIterator end() const;
246 
249  Size nbSurfels() const;
250 
253  bool empty() const;
254 
260  DigitalSurfaceTracker* newTracker( const Surfel & s ) const;
261 
267 
268  // ----------------------- Interface --------------------------------------
269  public:
270 
275  void selfDisplay ( std::ostream & out ) const;
276 
281  bool isValid() const;
282 
283  // ------------------------- Protected Datas ------------------------------
284  private:
285  // ------------------------- Private Datas --------------------------------
286  private:
288  const KSpace & myKSpace;
290  SurfelSet mySurfelSet;
292  SurfelPredicate mySurfelPredicate;
294  Adjacency mySurfelAdjacency;
295 
296  // ------------------------- Hidden services ------------------------------
297  protected:
298 
299  private:
300 
307  SetOfSurfels & operator= ( const SetOfSurfels & other );
308 
309  // ------------------------- Internals ------------------------------------
310  private:
311 
312  }; // end of class SetOfSurfels
313 
314 
327  template <typename TKSpace, typename TSurfelSet>
328  std::ostream&
329  operator<< ( std::ostream & out,
330  const SetOfSurfels<TKSpace, TSurfelSet> & object );
331 
332 } // namespace DGtal
333 
334 
336 // Includes inline functions.
337 #include "DGtal/topology/SetOfSurfels.ih"
338 
339 // //
341 
342 #endif // !defined SetOfSurfels_h
343 
344 #undef SetOfSurfels_RECURSES
345 #endif // else defined(SetOfSurfels_RECURSES)
KSpace::Cell Cell
Definition: SetOfSurfels.h:178
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
Definition: SetOfSurfels.h:294
void selfDisplay(std::ostream &out) const
const Surfel & current() const
KSpace::SCellSet SCellSet
Definition: SetOfSurfels.h:181
SurfelPredicate mySurfelPredicate
the surfel predicate defining the shape (related to mySurfelSet).
Definition: SetOfSurfels.h:292
functors::SurfelSetPredicate< SurfelSet, Surfel > SurfelPredicate
Definition: SetOfSurfels.h:182
Connectedness connectedness() const
Size nbSurfels() const
SetOfSurfels(const SetOfSurfels &other)
SurfelConstIterator end() const
const SurfelPredicate & surfelPredicate() const
accessor to surfel predicate.
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::uint32_t Dimension
Definition: Common.h:113
DigitalSurfaceTracker * newTracker(const Surfel &s) const
bool isInside(const Surfel &s) const
KSpace::Space Space
Definition: SetOfSurfels.h:171
KSpace::SCell SCell
Definition: SetOfSurfels.h:179
SurfelAdjacency< KSpace::dimension > Adjacency
Definition: SetOfSurfels.h:177
bool empty() const
KSpace::Point Point
Definition: SetOfSurfels.h:172
SurfelSet & surfelSet()
KSpace::SCell Surfel
Type for surfels.
Definition: SetOfSurfels.h:160
const DigitalSurfaceContainer & surface() const
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
SurfelNeighborhood< KSpace > Neighborhood
Definition: SetOfSurfels.h:90
SurfelConstIterator begin() const
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
TSurfelSet SurfelSet
Definition: SetOfSurfels.h:164
Tracker DigitalSurfaceTracker
Definition: SetOfSurfels.h:173
const KSpace & myKSpace
a reference to the cellular space.
Definition: SetOfSurfels.h:288
KSpace::CellSet CellSet
Definition: SetOfSurfels.h:180
Dimension orthDir() const
const KSpace & space() const
SetOfSurfels< TKSpace, TSurfelSet > Self
Definition: SetOfSurfels.h:156
SetOfSurfels< TKSpace, TSurfelSet > DigitalSurfaceContainer
Definition: SetOfSurfels.h:85
void move(const Surfel &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
SurfelSet::const_iterator SurfelConstIterator
Definition: SetOfSurfels.h:170
KSpace::Size Size
Type for sizes (unsigned integral type).
Definition: SetOfSurfels.h:162
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels...
Definition: SetOfSurfels.h:73
bool isValid() const
const DigitalSurfaceContainer & mySurface
Definition: SetOfSurfels.h:147
Connectedness
Definition: Topology.h:50
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
SurfelSet mySurfelSet
the set of surfels
Definition: SetOfSurfels.h:290
SetOfSurfels & operator=(const SetOfSurfels &other)
TKSpace KSpace
Model of cellular grid space.
Definition: SetOfSurfels.h:158