DGtal  1.4.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)
35 #define DigitalSetBoundary_RECURSES
36 
37 #if !defined DigitalSetBoundary_h
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 
107 
111  const Surfel & current() const;
114 
120  void move( const Surfel & s );
121 
138  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
139 
140  private:
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 
183 
193  const DigitalSet & aSet,
194  const Adjacency & adj = Adjacency( true ) );
195 
197  const Adjacency & surfelAdjacency() const;
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 
217 
221 
223  Size nbSurfels() const;
224 
227  bool empty() const;
228 
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;
269 
270  // ------------------------- Hidden services ------------------------------
271  protected:
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
const DigitalSurfaceContainer & surface() const
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
DigitalSetBoundary< TKSpace, TDigitalSet > DigitalSurfaceContainer
const DigitalSurfaceContainer & mySurface
SurfelNeighborhood< KSpace > Neighborhood
const Surfel & current() const
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
Tracker(const Tracker &other)
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
const KSpace & myKSpace
a reference to the cellular space.
SurfelStorage::const_iterator SurfelConstIterator
DigitalSetBoundary(const DigitalSetBoundary &other)
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
void selfDisplay(std::ostream &out) const
Connectedness connectedness() const
DigitalSurfaceTracker * newTracker(const Surfel &s) const
DigitalSetBoundary< TKSpace, TDigitalSet > Self
SurfelConstIterator begin() const
DigitalSetBoundary(ConstAlias< KSpace > aKSpace, const DigitalSet &aSet, const Adjacency &adj=Adjacency(true))
DigitalSet myDigitalSet
a smart pointer to some digital set.
std::vector< Surfel > SurfelStorage
const DigitalSet & digitalSet() const
accessor to digital set
SurfelStorage mySurfels
a vector storing all the surfels of the boundary.
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
bool isInside(const Surfel &s) const
SurfelAdjacency< KSpace::dimension > Adjacency
DigitalSetBoundary & operator=(const DigitalSetBoundary &other)
const KSpace & space() const
SurfelConstIterator end() const
Adjacency & surfelAdjacency()
mutator to surfel adjacency.
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
Z3i::SCell SCell
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.