DGtal  0.9.2
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;
108  typedef typename DigitalSet::ConstIterator ConstIterator;
114 
115  // ----------------------- Standard services ------------------------------
116  public:
117 
121  ~Expander();
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 
184  ConstIterator begin() const;
185 
189  ConstIterator end() const;
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 
214  const Domain & myEmbeddingDomain;
215 
219  const Object & myObject;
220 
224  ObjectDomain myObjectDomain;
225 
229  ObjectAdjacency myObjectAdjacency;
230 
235  DigitalSet myCore;
236 
240  DigitalSet myLayer;
241 
246 
251 
255  NotInCoreDomainPredicate myNotInCorePred;
256 
257  // ------------------------- Hidden services ------------------------------
258  protected:
259 
264  Expander();
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)
DigitalSet::Size Size
Definition: Object.h:140
DigitalSetDomain< DigitalSet > CoreDomain
Definition: Expander.h:110
DigitalSet::Point Point
Definition: Object.h:141
const DigitalSet & core() const
DigitalSet::ConstIterator ConstIterator
Definition: Expander.h:108
const DigitalSet & layer() const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DigitalSetDomain< DigitalSet > ObjectDomain
Definition: Expander.h:109
TDigitalSet DigitalSet
Definition: Object.h:123
ConstIterator begin() const
DigitalSet myLayer
Definition: Expander.h:240
const Object & myObject
Definition: Expander.h:219
bool isValid() const
Expander & operator=(const Expander &other)
Size distance() const
const Domain & myEmbeddingDomain
Definition: Expander.h:214
Object::Domain Domain
Definition: Expander.h:104
NotInCoreDomainPredicate myNotInCorePred
Definition: Expander.h:255
void selfDisplay(std::ostream &out) const
Aim: This class is useful to visit an object by adjacencies, layer by layer.
Definition: Expander.h:97
DigitalTopology::ForegroundAdjacency ForegroundAdjacency
Definition: Object.h:150
bool finished() const
Object::Size Size
Definition: Expander.h:102
DGtal is the top-level namespace which contains all DGtal functions and types.
ObjectAdjacency myObjectAdjacency
Definition: Expander.h:229
Object::Point Point
Definition: Expander.h:103
Object::DigitalSet DigitalSet
Definition: Expander.h:105
Domain::Space Space
Definition: Expander.h:107
Object::ForegroundAdjacency ForegroundAdjacency
Definition: Expander.h:106
DigitalSet::Domain Domain
Definition: Object.h:145
ObjectDomain myObjectDomain
Definition: Expander.h:224
ConstIterator end() const
DigitalSet myCore
Definition: Expander.h:235
void computeNextLayer(const DigitalSet &src)
DomainAdjacency< ObjectDomain, ForegroundAdjacency > ObjectAdjacency
Definition: Expander.h:111
functors::NotPointPredicate< InCoreDomainPredicate > NotInCoreDomainPredicate
Definition: Expander.h:113
TObject Object
Definition: Expander.h:101
CoreDomain::Predicate InCoreDomainPredicate
Definition: Expander.h:112