DGtal  1.3.beta
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:
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;
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;
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)
DGtal::DigitalSetBoundary::Tracker
Definition: DigitalSetBoundary.h:76
DGtal::DigitalSetBoundary::SurfelConstIterator
SurfelStorage::const_iterator SurfelConstIterator
Definition: DigitalSetBoundary.h:158
DGtal::DigitalSetBoundary::surfelAdjacency
const Adjacency & surfelAdjacency() const
accessor to surfel adjacency.
DGtal::DigitalSetBoundary::Tracker::KSpace
TKSpace KSpace
Definition: DigitalSetBoundary.h:85
DGtal::DigitalSetBoundary::myKSpace
const KSpace & myKSpace
a reference to the cellular space.
Definition: DigitalSetBoundary.h:262
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::DigitalSetBoundary::Domain
DigitalSet::Domain Domain
Definition: DigitalSetBoundary.h:160
DGtal::DigitalSetBoundary::nbSurfels
Size nbSurfels() const
DGtal::DigitalSetBoundary::isValid
bool isValid() const
DGtal::SurfelNeighborhood< KSpace >
DGtal::DigitalSetBoundary::space
const KSpace & space() const
DGtal::DigitalSetBoundary::Tracker::Tracker
Tracker(ConstAlias< DigitalSurfaceContainer > aSurface, const Surfel &s)
DGtal::SurfelAdjacency< KSpace::dimension >
DGtal::DigitalSetBoundary::~DigitalSetBoundary
~DigitalSetBoundary()
DGtal::DigitalSetBoundary::Tracker::Surfel
TKSpace::SCell Surfel
Definition: DigitalSetBoundary.h:82
DGtal::DigitalSetBoundary::computeSurfels
void computeSurfels()
DGtal::DigitalSetBoundary::KSpace
TKSpace KSpace
Definition: DigitalSetBoundary.h:153
DGtal::DigitalSetBoundary::SCell
KSpace::SCell SCell
Definition: DigitalSetBoundary.h:168
DGtal::DigitalSetBoundary
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
Definition: DigitalSetBoundary.h:69
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::DigitalSetBoundary::Tracker::mySurface
const DigitalSurfaceContainer & mySurface
Definition: DigitalSetBoundary.h:143
DGtal::SignedKhalimskyCell
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Definition: KhalimskySpaceND.h:208
DGtal::DigitalSetBoundary::Tracker::current
const Surfel & current() const
DGtal::Connectedness
Connectedness
Definition: Topology.h:50
DGtal::DigitalSetBoundary::Cell
KSpace::Cell Cell
Definition: DigitalSetBoundary.h:167
DGtal::DigitalSetBoundary::Adjacency
SurfelAdjacency< KSpace::dimension > Adjacency
Definition: DigitalSetBoundary.h:166
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::SpaceND
Definition: SpaceND.h:95
DGtal::DigitalSetBoundary::DigitalSet
TDigitalSet DigitalSet
Definition: DigitalSetBoundary.h:156
DGtal::DigitalSetBoundary::Tracker::orthDir
Dimension orthDir() const
DGtal::DigitalSetBoundary::empty
bool empty() const
DGtal::DigitalSetBoundary::end
SurfelConstIterator end() const
DGtal::DigitalSetBoundary::Size
KSpace::Size Size
Definition: DigitalSetBoundary.h:155
DGtal::KhalimskySpaceND::Size
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
Definition: KhalimskySpaceND.h:407
DGtal::DigitalSetBoundary::isInside
bool isInside(const Surfel &s) const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Domain
HyperRectDomain< Space > Domain
Definition: testSimpleRandomAccessRangeFromPoint.cpp:44
DGtal::DigitalSetBoundary::Tracker::adjacent
uint8_t adjacent(Surfel &s, Dimension d, bool pos) const
DGtal::DigitalSetBoundary::Tracker::~Tracker
~Tracker()
DGtal::DigitalSetBoundary::Surfel
KSpace::SCell Surfel
Definition: DigitalSetBoundary.h:154
DGtal::DigitalSetBoundary::myDigitalSet
DigitalSet myDigitalSet
a smart pointer to some digital set.
Definition: DigitalSetBoundary.h:264
DGtal::DigitalSetBoundary::Self
DigitalSetBoundary< TKSpace, TDigitalSet > Self
Definition: DigitalSetBoundary.h:152
DGtal::DigitalSetBoundary::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::DigitalSetBoundary::Tracker::move
void move(const Surfel &s)
DGtal::DigitalSetBoundary::begin
SurfelConstIterator begin() const
DGtal::DigitalSetBoundary::mySurfelAdjacency
Adjacency mySurfelAdjacency
the surfel adjacency used to determine neighbors.
Definition: DigitalSetBoundary.h:266
DGtal::DigitalSetBoundary::Point
DigitalSet::Point Point
Definition: DigitalSetBoundary.h:161
DGtal::DigitalSetBoundary::digitalSet
const DigitalSet & digitalSet() const
accessor to digital set
DGtal::DigitalSetBoundary::Tracker::myNeighborhood
Neighborhood myNeighborhood
Definition: DigitalSetBoundary.h:146
DGtal::DigitalSetBoundary::SurfelStorage
std::vector< Surfel > SurfelStorage
Definition: DigitalSetBoundary.h:157
DGtal::DigitalSetBoundary::connectedness
Connectedness connectedness() const
DGtal::DigitalSetBoundary::DigitalSurfaceTracker
Tracker DigitalSurfaceTracker
Definition: DigitalSetBoundary.h:162
DGtal::DigitalSetBoundary::DigitalSetBoundary
DigitalSetBoundary(const DigitalSetBoundary &other)
DGtal::DigitalSetBoundary::Tracker::DigitalSurfaceContainer
DigitalSetBoundary< TKSpace, TDigitalSet > DigitalSurfaceContainer
Definition: DigitalSetBoundary.h:81
DGtal::DigitalSetBoundary::mySurfels
SurfelStorage mySurfels
a vector storing all the surfels of the boundary.
Definition: DigitalSetBoundary.h:268
DGtal::DigitalSetBoundary::operator=
DigitalSetBoundary & operator=(const DigitalSetBoundary &other)
DGtal::DigitalSetBoundary::newTracker
DigitalSurfaceTracker * newTracker(const Surfel &s) const
DGtal::DigitalSetBoundary::Space
KSpace::Space Space
Definition: DigitalSetBoundary.h:159
DGtal::DigitalSetBoundary::Tracker::Neighborhood
SurfelNeighborhood< KSpace > Neighborhood
Definition: DigitalSetBoundary.h:86
DGtal::DigitalSetBoundary::Tracker::surface
const DigitalSurfaceContainer & surface() const
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::DigitalSetBoundary::Tracker::Self
Tracker Self
Definition: DigitalSetBoundary.h:80
DGtal::KhalimskyCell< dim, Integer >
DGtal::uint8_t
boost::uint8_t uint8_t
unsigned 8-bit integer.
Definition: BasicTypes.h:59