DGtal  1.1.0
Expander.h
1 
17 #pragma once
18 
31 #if defined(Expander_RECURSES)
32 #error Recursive header files inclusion detected in Expander.h
33 #else // defined(Expander_RECURSES)
34 
35 #define Expander_RECURSES
36 
37 #if !defined Expander_h
38 
39 #define Expander_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/kernel/sets/DigitalSetSelector.h"
47 #include "DGtal/kernel/sets/DigitalSetDomain.h"
48 #include "DGtal/topology/DomainAdjacency.h"
49 #include "DGtal/topology/Object.h"
51 
52 namespace DGtal
53 {
54 
56  // template class Expander
96  template <typename TObject>
97  class Expander
98  {
99  // ----------------------- Associated types ------------------------------
100  public:
101  typedef TObject Object;
102  typedef typename Object::Size Size;
103  typedef typename Object::Point Point;
104  typedef typename Object::Domain Domain;
105  typedef typename Object::DigitalSet DigitalSet;
107  typedef typename Domain::Space Space;
114 
115  // ----------------------- Standard services ------------------------------
116  public:
117 
122 
130  Expander( ConstAlias<Object> object, const Point & p );
131 
143  template <typename PointInputIterator>
145  PointInputIterator b, PointInputIterator e );
146 
147 
148  // ----------------------- Expansion services ------------------------------
149  public:
150 
154  bool finished() const;
155 
160  Size distance() const;
161 
169  bool nextLayer();
170 
174  const DigitalSet & core() const;
175 
179  const DigitalSet & layer() const;
180 
185 
190 
191  // ----------------------- Interface --------------------------------------
192  public:
193 
198  void selfDisplay ( std::ostream & out ) const;
199 
204  bool isValid() const;
205 
206  // ------------------------- Protected Datas ------------------------------
207  private:
208  // ------------------------- Private Datas --------------------------------
209  private:
210 
215 
219  const Object & myObject;
220 
225 
230 
236 
241 
246 
251 
256 
257  // ------------------------- Hidden services ------------------------------
258  protected:
259 
265 
274  void computeNextLayer( const DigitalSet & src );
275 
280  void endLayer();
281 
282  private:
283 
289  Expander ( const Expander & other );
290 
297  Expander & operator= ( const Expander & other );
298 
299  // ------------------------- Internals ------------------------------------
300  private:
301 
302  }; // end of class Expander
303 
304 
311  template <typename T>
312  std::ostream&
313  operator<< ( std::ostream & out, const Expander<T> & object );
314 
315 } // namespace DGtal
316 
317 
319 // Includes inline functions.
320 #include "DGtal/graph/Expander.ih"
321 
322 // //
324 
325 #endif // !defined Expander_h
326 
327 #undef Expander_RECURSES
328 #endif // else defined(Expander_RECURSES)
DGtal::Object::Domain
DigitalSet::Domain Domain
Definition: Object.h:145
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::Expander::Expander
Expander(ConstAlias< Object > object, const Point &p)
DGtal::Expander::computeNextLayer
void computeNextLayer(const DigitalSet &src)
DGtal::HyperRectDomain< Space >::Space
Space Space
Definition: HyperRectDomain.h:110
DGtal::Expander::distance
Size distance() const
DGtal::Expander::core
const DigitalSet & core() const
DGtal::Expander::myLayer
DigitalSet myLayer
Definition: Expander.h:240
DGtal::Expander::layer
const DigitalSet & layer() const
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
DGtal::Expander::myFinished
bool myFinished
Definition: Expander.h:250
DGtal::Expander::ObjectDomain
DigitalSetDomain< DigitalSet > ObjectDomain
Definition: Expander.h:109
DGtal::Expander::myDistance
Size myDistance
Definition: Expander.h:245
DGtal::DomainAdjacency< ObjectDomain, ForegroundAdjacency >
DGtal::Expander::operator=
Expander & operator=(const Expander &other)
DGtal::Expander::Domain
Object::Domain Domain
Definition: Expander.h:104
DGtal::Expander::myEmbeddingDomain
const Domain & myEmbeddingDomain
Definition: Expander.h:214
DGtal::Expander::begin
ConstIterator begin() const
DGtal::Expander::end
ConstIterator end() const
DGtal::Expander::myObject
const Object & myObject
Definition: Expander.h:219
DGtal::Object::DigitalSet
TDigitalSet DigitalSet
Definition: Object.h:123
DGtal::Expander::Size
Object::Size Size
Definition: Expander.h:102
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::Expander::DigitalSet
Object::DigitalSet DigitalSet
Definition: Expander.h:105
DGtal::Expander::Space
Domain::Space Space
Definition: Expander.h:107
DGtal::Expander
Aim: This class is useful to visit an object by adjacencies, layer by layer.
Definition: Expander.h:98
DGtal::Expander::myNotInCorePred
NotInCoreDomainPredicate myNotInCorePred
Definition: Expander.h:255
DGtal::Object::Point
DigitalSet::Point Point
Definition: Object.h:141
DGtal::Expander::myObjectAdjacency
ObjectAdjacency myObjectAdjacency
Definition: Expander.h:229
DGtal::Expander::Point
Object::Point Point
Definition: Expander.h:103
DGtal::Expander::myCore
DigitalSet myCore
Definition: Expander.h:235
DGtal::Expander::Expander
Expander(ConstAlias< Object > object, PointInputIterator b, PointInputIterator e)
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::Expander::isValid
bool isValid() const
DGtal::Expander::~Expander
~Expander()
DGtal::Expander::myObjectDomain
ObjectDomain myObjectDomain
Definition: Expander.h:224
DGtal::Object::Size
DigitalSet::Size Size
Definition: Object.h:140
DGtal::functors::NotPointPredicate< InCoreDomainPredicate >
DGtal::Expander::ObjectAdjacency
DomainAdjacency< ObjectDomain, ForegroundAdjacency > ObjectAdjacency
Definition: Expander.h:111
DGtal::Expander::nextLayer
bool nextLayer()
DGtal::Expander::ForegroundAdjacency
Object::ForegroundAdjacency ForegroundAdjacency
Definition: Expander.h:106
DGtal::Expander::finished
bool finished() const
DGtal::DigitalSetDomain< DigitalSet >::Predicate
DigitalSet Predicate
Definition: DigitalSetDomain.h:73
DGtal::Expander::Object
TObject Object
Definition: Expander.h:101
DGtal::Expander::Expander
Expander(const Expander &other)
DGtal::DigitalSetDomain< DigitalSet >
DGtal::Expander::InCoreDomainPredicate
CoreDomain::Predicate InCoreDomainPredicate
Definition: Expander.h:112
DGtal::Expander::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Expander::endLayer
void endLayer()
DGtal::Expander::Expander
Expander()
DGtal::Object::ForegroundAdjacency
DigitalTopology::ForegroundAdjacency ForegroundAdjacency
Definition: Object.h:150
DGtal::Expander::CoreDomain
DigitalSetDomain< DigitalSet > CoreDomain
Definition: Expander.h:110
DGtal::Expander::NotInCoreDomainPredicate
functors::NotPointPredicate< InCoreDomainPredicate > NotInCoreDomainPredicate
Definition: Expander.h:113
DGtal::Expander::ConstIterator
DigitalSet::ConstIterator ConstIterator
Definition: Expander.h:108