DGtal  1.5.beta
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)
35 #define SetOfSurfels_RECURSES
36 
37 #if !defined SetOfSurfels_h
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 
111 
115  const Surfel & current() const;
118 
124  void move( const Surfel & s );
125 
142  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
143 
144  private:
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 
191 
198  SetOfSurfels ( const SetOfSurfels & other );
199 
213  const Adjacency & adj,
214  SurfelSet aSetOfSurfels = SurfelSet() );
215 
216  // Mutator to set of surfels.
218  // Accessor to set of surfels.
219  const SurfelSet & surfelSet() const;
220 
222  const Adjacency & surfelAdjacency() const;
227 
228  // --------- CDigitalSurfaceContainer realization -------------------------
229  public:
230 
232  const KSpace & space() const;
237  bool isInside( const Surfel & s ) const;
238 
242 
246 
249  Size nbSurfels() const;
250 
253  bool empty() const;
254 
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;
295 
296  // ------------------------- Hidden services ------------------------------
297  protected:
298 
299  private:
300 
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
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).
SurfelNeighborhood< KSpace > Neighborhood
Definition: SetOfSurfels.h:90
Tracker(const Tracker &other)
Dimension orthDir() const
const DigitalSurfaceContainer & surface() const
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
const DigitalSurfaceContainer & mySurface
Definition: SetOfSurfels.h:147
SetOfSurfels< TKSpace, TSurfelSet > DigitalSurfaceContainer
Definition: SetOfSurfels.h:85
void move(const Surfel &s)
const Surfel & current() const
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Definition: SetOfSurfels.h:74
KSpace::SCellSet SCellSet
Definition: SetOfSurfels.h:181
functors::SurfelSetPredicate< SurfelSet, Surfel > SurfelPredicate
Definition: SetOfSurfels.h:182
KSpace::Space Space
Definition: SetOfSurfels.h:171
SurfelConstIterator begin() const
DigitalSurfaceTracker * newTracker(const Surfel &s) const
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
KSpace::Cell Cell
Definition: SetOfSurfels.h:178
KSpace::Size Size
Type for sizes (unsigned integral type).
Definition: SetOfSurfels.h:162
SurfelConstIterator end() const
bool empty() const
TSurfelSet SurfelSet
Definition: SetOfSurfels.h:164
KSpace::Point Point
Definition: SetOfSurfels.h:172
Tracker DigitalSurfaceTracker
Definition: SetOfSurfels.h:173
SurfelSet mySurfelSet
the set of surfels
Definition: SetOfSurfels.h:290
KSpace::SCell SCell
Definition: SetOfSurfels.h:179
SurfelSet & surfelSet()
const SurfelPredicate & surfelPredicate() const
accessor to surfel predicate.
KSpace::CellSet CellSet
Definition: SetOfSurfels.h:180
bool isValid() const
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
Definition: SetOfSurfels.h:294
const SurfelSet & surfelSet() const
SetOfSurfels(const SetOfSurfels &other)
TKSpace KSpace
Model of cellular grid space.
Definition: SetOfSurfels.h:158
KSpace::SCell Surfel
Type for surfels.
Definition: SetOfSurfels.h:160
SetOfSurfels< TKSpace, TSurfelSet > Self
Definition: SetOfSurfels.h:156
SurfelSet::const_iterator SurfelConstIterator
Definition: SetOfSurfels.h:170
SurfelPredicate mySurfelPredicate
the surfel predicate defining the shape (related to mySurfelSet).
Definition: SetOfSurfels.h:292
SetOfSurfels & operator=(const SetOfSurfels &other)
SurfelAdjacency< KSpace::dimension > Adjacency
Definition: SetOfSurfels.h:177
Adjacency & surfelAdjacency()
mutator to surfel adjacency.
const KSpace & myKSpace
a reference to the cellular space.
Definition: SetOfSurfels.h:288
Connectedness connectedness() const
Size nbSurfels() const
SetOfSurfels(ConstAlias< KSpace > aKSpace, const Adjacency &adj, SurfelSet aSetOfSurfels=SurfelSet())
void selfDisplay(std::ostream &out) const
const KSpace & space() const
bool isInside(const Surfel &s) const
Z3i::SCell SCell
MyDigitalSurface::SurfelSet SurfelSet
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 ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::uint32_t Dimension
Definition: Common.h:136
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.