DGtal  1.3.beta
GreedySegmentation.h
1 
17 #pragma once
18 
31 #if defined(GreedySegmentation_RECURSES)
32 #error Recursive header files inclusion detected in GreedySegmentation.h
33 #else // defined(GreedySegmentation_RECURSES)
34 
35 #define GreedySegmentation_RECURSES
36 
37 #if !defined GreedySegmentation_h
38 
39 #define GreedySegmentation_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/geometry/curves/SegmentComputerUtils.h"
46 #include "DGtal/geometry/curves/CForwardSegmentComputer.h"
47 
49 
50 namespace DGtal
51 {
52 
54  // template class GreedySegmentation
148  template <typename TSegmentComputer>
150  {
151 
152  public:
153 
155  typedef TSegmentComputer SegmentComputer;
157 
158  // ----------------------- Standard services ------------------------------
159  public:
160 
161 
162 
164  // template class SegmentComputerIterator
170  {
171 
172  // ------------------------- inner Types -----------------------
173 
174  public:
177 
178  // ------------------------- data -----------------------
179  private:
180 
185 
190 
195 
202 
209 
214 
215 
216 
217  // ------------------------- Standard services -----------------------
218  public:
219  friend class GreedySegmentation<TSegmentComputer>;
220 
221 
222 
233  const TSegmentComputer& aSegmentComputer,
234  const bool& aFlag );
235 
236 
242 
249 
254 
259  bool isValid() const { return myFlagIsValid; }
260 
261  // ------------------------- iteration services -------------------------
262  public:
263 
267  const SegmentComputer& operator*() const;
268 
269 
273  SegmentComputer get() const;
274 
275 
279  const SegmentComputer* operator->() const;
280 
288 
294  void next();
295 
296 
303  bool operator==( const SegmentComputerIterator & aOther ) const;
304 
311  bool operator!=( const SegmentComputerIterator & aOther ) const;
312 
313  // ----------------------- accessors --------------------------------------
314 
319  bool intersectNext() const;
320 
325  bool intersectPrevious() const;
326 
330  const ConstIterator begin() const;
331 
335  const ConstIterator end() const;
336 
337  // ----------------------- hidden services --------------------------------------
338 
339  private:
340 
347  void longestSegment(const ConstIterator& it);
348 
357  bool doesIntersectNext(const ConstIterator& it,
358  const ConstIterator& itb, const ConstIterator& ite);
359  bool doesIntersectNext(const ConstIterator& it,
360  const ConstIterator& itb, const ConstIterator& ite, IteratorType);
361  bool doesIntersectNext(const ConstIterator& it,
362  const ConstIterator& itb, const ConstIterator& ite, CirculatorType);
363 
371  bool doesIntersectNext(const ConstIterator& it);
372 
373 
374  };
375 
376 
377  // ----------------------- Interface --------------------------------------
378  public:
379 
386 
393  GreedySegmentation(const ConstIterator& itb,
394  const ConstIterator& ite,
395  const SegmentComputer& aSegmentComputer);
396 
404  void setSubRange(const ConstIterator& itb,
405  const ConstIterator& ite);
406 
407 
413  void setMode(const std::string& aMode);
414 
415 
420 
426 
432 
433 
438  void selfDisplay ( std::ostream & out ) const;
439 
444  bool isValid() const;
445 
446  // ------------------------- Protected Datas ------------------------------
447  private:
448  // ------------------------- Private Datas --------------------------------
449  private:
450 
455 
460 
465 
470 
474  std::string myMode;
475 
480 
481  // ------------------------- Hidden services ------------------------------
482 
483 
484  private:
485 
490  GreedySegmentation ( const GreedySegmentation & other );
491 
498 
499  // ------------------------- Internals ------------------------------------
500  private:
501 
502  }; // end of class GreedySegmentation
503 
504 
511  template <typename SegmentComputer>
512  std::ostream&
513  operator<< ( std::ostream & out, const GreedySegmentation<SegmentComputer> & object );
514 
515 } // namespace DGtal
516 
517 
519 // Includes inline functions.
520 #include "DGtal/geometry/curves/GreedySegmentation.ih"
521 
522 // //
524 
525 #endif // !defined GreedySegmentation_h
526 
527 #undef GreedySegmentation_RECURSES
528 #endif // else defined(GreedySegmentation_RECURSES)
DGtal::GreedySegmentation::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CForwardSegmentComputer< TSegmentComputer >))
DGtal::GreedySegmentation::SegmentComputerIterator::operator=
SegmentComputerIterator & operator=(const SegmentComputerIterator &aOther)
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::GreedySegmentation::SegmentComputerIterator::next
void next()
DGtal::GreedySegmentation::SegmentComputerIterator::myFlagIsValid
bool myFlagIsValid
Definition: GreedySegmentation.h:194
DGtal::GreedySegmentation::SegmentComputerIterator::myFlagIntersectNext
bool myFlagIntersectNext
Definition: GreedySegmentation.h:201
DGtal::GreedySegmentation::SegmentComputerIterator::mySegmentComputer
SegmentComputer mySegmentComputer
Definition: GreedySegmentation.h:189
DGtal::GreedySegmentation::~GreedySegmentation
~GreedySegmentation()
DGtal::GreedySegmentation::myBegin
ConstIterator myBegin
Definition: GreedySegmentation.h:454
SegmentComputer
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
Definition: testArithmeticalDSSComputerOnSurfels.cpp:55
DGtal::GreedySegmentation::SegmentComputer
TSegmentComputer SegmentComputer
Definition: GreedySegmentation.h:155
DGtal::GreedySegmentation::begin
GreedySegmentation::SegmentComputerIterator begin() const
DGtal::GreedySegmentation::myEnd
ConstIterator myEnd
Definition: GreedySegmentation.h:459
DGtal::GreedySegmentation::SegmentComputerIterator::isValid
bool isValid() const
Definition: GreedySegmentation.h:259
DGtal::GreedySegmentation::SegmentComputerIterator::get
SegmentComputer get() const
DGtal::GreedySegmentation::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::GreedySegmentation::SegmentComputerIterator::operator->
const SegmentComputer * operator->() const
DGtal::GreedySegmentation::SegmentComputerIterator::operator==
bool operator==(const SegmentComputerIterator &aOther) const
DGtal::GreedySegmentation::myStop
ConstIterator myStop
Definition: GreedySegmentation.h:469
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::GreedySegmentation::SegmentComputerIterator::operator!=
bool operator!=(const SegmentComputerIterator &aOther) const
DGtal::ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 >::ConstIterator
std::vector< Z2i::Point >::const_iterator ConstIterator
Definition: ArithmeticalDSSComputer.h:95
DGtal::GreedySegmentation
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators....
Definition: GreedySegmentation.h:149
DGtal::GreedySegmentation::setSubRange
void setSubRange(const ConstIterator &itb, const ConstIterator &ite)
DGtal::GreedySegmentation::SegmentComputerIterator::~SegmentComputerIterator
~SegmentComputerIterator()
DGtal::GreedySegmentation::myStart
ConstIterator myStart
Definition: GreedySegmentation.h:464
DGtal::GreedySegmentation::SegmentComputerIterator::end
const ConstIterator end() const
DGtal::GreedySegmentation::SegmentComputerIterator::SegmentComputerIterator
SegmentComputerIterator(const GreedySegmentation< TSegmentComputer > *aSegmentation, const TSegmentComputer &aSegmentComputer, const bool &aFlag)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::GreedySegmentation::SegmentComputerIterator::myFlagIntersectPrevious
bool myFlagIntersectPrevious
Definition: GreedySegmentation.h:208
DGtal::GreedySegmentation::GreedySegmentation
GreedySegmentation()
Definition: GreedySegmentation.h:385
DGtal::GreedySegmentation::SegmentComputerIterator
Aim: Specific iterator to visit all the segments of a greedy segmentation.
Definition: GreedySegmentation.h:169
DGtal::GreedySegmentation::SegmentComputerIterator::operator++
SegmentComputerIterator & operator++()
DGtal::GreedySegmentation::ConstIterator
SegmentComputer::ConstIterator ConstIterator
Definition: GreedySegmentation.h:156
DGtal::GreedySegmentation::end
GreedySegmentation::SegmentComputerIterator end() const
DGtal::GreedySegmentation::isValid
bool isValid() const
DGtal::GreedySegmentation::SegmentComputerIterator::intersectPrevious
bool intersectPrevious() const
DGtal::GreedySegmentation::SegmentComputerIterator::doesIntersectNext
bool doesIntersectNext(const ConstIterator &it, const ConstIterator &itb, const ConstIterator &ite)
DGtal::CirculatorType
Definition: IteratorCirculatorTraits.h:52
DGtal::GreedySegmentation::mySegmentComputer
SegmentComputer mySegmentComputer
Definition: GreedySegmentation.h:479
DGtal::concepts::CForwardSegmentComputer
Aim: Defines the concept describing a forward segment computer. Like any model of CIncrementalSegment...
Definition: CForwardSegmentComputer.h:101
DGtal::IteratorType
Definition: IteratorCirculatorTraits.h:51
DGtal::GreedySegmentation::SegmentComputerIterator::begin
const ConstIterator begin() const
DGtal::GreedySegmentation::SegmentComputerIterator::longestSegment
void longestSegment(const ConstIterator &it)
DGtal::GreedySegmentation::SegmentComputerIterator::myFlagIsLast
bool myFlagIsLast
Definition: GreedySegmentation.h:213
DGtal::GreedySegmentation::myMode
std::string myMode
Definition: GreedySegmentation.h:474
DGtal::GreedySegmentation::SegmentComputerIterator::myS
const GreedySegmentation< TSegmentComputer > * myS
Definition: GreedySegmentation.h:184
DGtal::GreedySegmentation::SegmentComputerIterator::ConstIterator
SegmentComputer::ConstIterator ConstIterator
Definition: GreedySegmentation.h:176
DGtal::GreedySegmentation::setMode
void setMode(const std::string &aMode)
DGtal::GreedySegmentation::SegmentComputerIterator::SegmentComputer
GreedySegmentation::SegmentComputer SegmentComputer
Definition: GreedySegmentation.h:175
DGtal::GreedySegmentation::operator=
GreedySegmentation & operator=(const GreedySegmentation &other)
DGtal::GreedySegmentation::SegmentComputerIterator::operator*
const SegmentComputer & operator*() const
DGtal::GreedySegmentation::SegmentComputerIterator::intersectNext
bool intersectNext() const