34#if defined(SegmentComputerUtils_RECURSES)
35#error Recursive header files inclusion detected in SegmentComputerUtils.h
38#define SegmentComputerUtils_RECURSES
40#if !defined SegmentComputerUtils_h
42#define SegmentComputerUtils_h
45#include "DGtal/base/Circulator.h"
131 unsigned int k = c/2;
163template <
typename SC>
166 while ( (s.end() != end)
167 && (s.extendFront()) ) {}
173template <
typename SC>
177 const typename SC::ConstIterator newEnd( s.begin() );
178 while ( (s.extendFront())
179 && (s.end() != newEnd) ) {}
187template <
typename SC>
197template <
typename SC>
200 while ( (s.begin() != begin)
201 && (s.extendBack()) ) {}
202 if (s.begin() == begin) s.extendBack();
208template <
typename SC>
211 boost::ignore_unused_variable_warning( begin );
213 const typename SC::ConstIterator newBegin( s.end() );
214 while ( (s.extendBack())
215 && (s.begin() != newBegin) ) {}
224template <
typename SC>
235template <
typename SC>
237 const typename SC::ConstIterator& begin,
238 const typename SC::ConstIterator& end,
242 bool flagForward =
true;
248 if ( s.end() != end ) flagOk = s.extendFront();
252 if ( s.begin() != begin ) flagOk = s.extendBack();
257 if (s.begin() != begin ) {
258 if (s.extendBack())
return !s.extendFront();
269template <
typename SC>
271 const typename SC::ConstIterator& begin,
272 const typename SC::ConstIterator& end,
275 boost::ignore_unused_variable_warning( begin );
276 boost::ignore_unused_variable_warning( end );
279 bool flagForward =
true;
282 while ( (flagOk) && ( s.end() != s.begin() ) ) {
285 flagOk = s.extendFront();
288 flagOk = s.extendBack();
304template <
typename SC>
306 const typename SC::ConstIterator& begin,
307 const typename SC::ConstIterator& end) {
322template <
typename SC>
325 if ( isNotEmpty<typename SC::ConstIterator>(s.end(),end) ) {
326 while ( (! s.isExtendableFront() )
327 &&(s.retractBack() ) ) {}
329 while ( s.retractBack() ) {}
340template <
typename SC>
343 if ( isNotEmpty<typename SC::ConstIterator>(s.begin(),begin) ) {
344 while ( (! s.isExtendableBack() )
345 &&(s.retractFront() ) ) {}
347 while ( s.retractFront() ) {}
358template <
typename SC>
360 const typename SC::ConstIterator& i,
361 const typename SC::ConstIterator& end,
373template <
typename SC>
375 const typename SC::ConstIterator& i,
376 const typename SC::ConstIterator& end,
390template <
typename SC>
392 const typename SC::ConstIterator& i,
393 const typename SC::ConstIterator& end)
411template <
typename SC>
413 const typename SC::ConstIterator& i,
414 const typename SC::ConstIterator& begin,
415 const typename SC::ConstIterator& end,
420 typedef typename SC::Reverse ReverseSegmentComputer;
421 typedef typename ReverseSegmentComputer::ConstIterator ConstReverseIterator;
423 if ( isNotEmpty<ConstIterator>(i,end) ) {
427 ConstReverseIterator rit( it );
428 ConstReverseIterator rend( begin );
429 ReverseSegmentComputer r( s.getReverse() );
448template <
typename SC>
450 const typename SC::ConstIterator& i,
451 const typename SC::ConstIterator& begin,
452 const typename SC::ConstIterator& end,
470template <
typename SC>
472 const typename SC::ConstIterator& i,
473 const typename SC::ConstIterator& begin,
474 const typename SC::ConstIterator& end,
489template <
typename SC>
491 const typename SC::ConstIterator& i,
492 const typename SC::ConstIterator& begin,
493 const typename SC::ConstIterator& end,
507template <
typename SC>
509 const typename SC::ConstIterator& i,
510 const typename SC::ConstIterator& begin,
511 const typename SC::ConstIterator& end )
513 firstMaximalSegment<SC>(s, i, begin, end,
528template <
typename SC>
530 const typename SC::ConstIterator& i,
531 const typename SC::ConstIterator& begin,
532 const typename SC::ConstIterator& end,
537 typedef typename SC::Reverse ReverseSegmentComputer;
538 typedef typename ReverseSegmentComputer::ConstIterator ConstReverseIterator;
550 if ( isNotEmpty<ConstIterator>(s.end(),end) ) {
554 ConstReverseIterator rit( it );
555 ConstReverseIterator rend( s.begin() );
556 ReverseSegmentComputer r( s.getReverse() );
559 ASSERT( newBegin != s.begin() );
586template <
typename SC>
588 const typename SC::ConstIterator& i,
589 const typename SC::ConstIterator& begin,
590 const typename SC::ConstIterator& end,
622template <
typename SC>
624 const typename SC::ConstIterator& i,
625 const typename SC::ConstIterator& begin,
626 const typename SC::ConstIterator& end,
641template <
typename SC>
643 const typename SC::ConstIterator& i,
644 const typename SC::ConstIterator& begin,
645 const typename SC::ConstIterator& end,
659template <
typename SC>
661 const typename SC::ConstIterator& i,
662 const typename SC::ConstIterator& begin,
663 const typename SC::ConstIterator& end )
665 mostCenteredMaximalSegment<SC>(s, i, begin, end,
680template <
typename SC>
682 const typename SC::ConstIterator& i,
683 const typename SC::ConstIterator& begin,
684 const typename SC::ConstIterator& end,
689 typedef typename SC::Reverse ReverseSegmentComputer;
690 typedef typename ReverseSegmentComputer::ConstIterator ConstReverseIterator;
698 ConstReverseIterator rit( it );
699 ConstReverseIterator rend( begin );
700 ReverseSegmentComputer r( s.getReverse() );
716template <
typename SC>
718 const typename SC::ConstIterator& i,
719 const typename SC::ConstIterator& begin,
720 const typename SC::ConstIterator& end,
738template <
typename SC>
740 const typename SC::ConstIterator& i,
741 const typename SC::ConstIterator& begin,
742 const typename SC::ConstIterator& end,
757template <
typename SC>
759 const typename SC::ConstIterator& i,
760 const typename SC::ConstIterator& begin,
761 const typename SC::ConstIterator& end,
775template <
typename SC>
777 const typename SC::ConstIterator& i,
778 const typename SC::ConstIterator& begin,
779 const typename SC::ConstIterator& end )
781 lastMaximalSegment<SC>(s, i, begin, end,
796template <
typename SC>
798 const typename SC::ConstIterator& end,
812template <
typename SC>
814 const typename SC::ConstIterator& end,
827template <
typename SC>
829 const typename SC::ConstIterator& end,
841 if ( i == s.end() ) {
842 if ( isNotEmpty<ConstIterator>(i, end) ) {
860template <
typename SC>
862 const typename SC::ConstIterator& end,
875template <
typename SC>
877 const typename SC::ConstIterator& end )
879 nextMaximalSegment<SC>(s, end,
894template <
typename SC>
896 const typename SC::ConstIterator& begin,
899 if ( isNotEmpty<typename SC::ConstIterator>(s.begin(),begin) )
911template <
typename SC>
913 const typename SC::ConstIterator& begin,
916 if ( isNotEmpty<typename SC::ConstIterator>(s.begin(),begin) )
927template <
typename SC>
929 const typename SC::ConstIterator& begin,
942 if ( i == s.begin() ) {
943 if ( isNotEmpty<ConstIterator>(i, begin) ) {
962template <
typename SC>
964 const typename SC::ConstIterator& end,
977template <
typename SC>
979 const typename SC::ConstIterator& begin )
994#undef SegmentComputerUtils_RECURSES
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
void oppositeEndMaximalRetraction(SC &s, const typename SC::ConstIterator &begin)
void lastMaximalSegment(SC &s, const typename SC::ConstIterator &i, const typename SC::ConstIterator &begin, const typename SC::ConstIterator &end, DGtal::ForwardSegmentComputer)
void mostCenteredMaximalSegment(SC &s, const typename SC::ConstIterator &i, const typename SC::ConstIterator &begin, const typename SC::ConstIterator &end, DGtal::ForwardSegmentComputer)
void longestSegment(SC &s, const typename SC::ConstIterator &i, const typename SC::ConstIterator &end, IteratorType)
void oppositeEndMaximalExtension(SC &s, const typename SC::ConstIterator &begin, IteratorType)
void maximalExtension(SC &s, const typename SC::ConstIterator &end, IteratorType)
bool isNotEmpty(const IC &itb, const IC &ite)
IC getMiddleIterator(const IC &itb, const IC &ite, RandomAccessCategory)
void nextMaximalSegment(SC &s, const typename SC::ConstIterator &end, DGtal::ForwardSegmentComputer)
void maximalRetraction(SC &s, const typename SC::ConstIterator &end)
bool maximalSymmetricExtension(SC &s, const typename SC::ConstIterator &begin, const typename SC::ConstIterator &end, IteratorType)
void previousMaximalSegment(SC &s, const typename SC::ConstIterator &begin, DGtal::ForwardSegmentComputer)
void firstMaximalSegment(SC &s, const typename SC::ConstIterator &i, const typename SC::ConstIterator &begin, const typename SC::ConstIterator &end, DGtal::ForwardSegmentComputer)
ToDGtalCategory< typenameboost::iterator_category< IC >::type >::Category Category
Aim: Provides the category of the segment computer {ForwardSegmentComputer,BidirectionalSegmentComp...
ForwardSegmentComputer Category