39#if defined(FreemanChain_RECURSES)
40#error Recursive header files inclusion detected in FreemanChain.h
43#define FreemanChain_RECURSES
45#if !defined FreemanChain_h
56#include "DGtal/kernel/PointVector.h"
57#include "DGtal/base/OrderedAlphabet.h"
58#include "DGtal/base/Circulator.h"
59#include "DGtal/arithmetic/ModuloComputer.h"
61#include "DGtal/base/CConstSinglePassRange.h"
62#include "DGtal/topology/KhalimskySpaceND.h"
63#include "DGtal/base/ConstAlias.h"
112 template <
typename TInteger>
430 if (
this != &other )
445 std::string::size_type
size()
const
464 out <<
"[FreemanChainCodes]" << std::endl;
466 std::copy( this->
begin(), this->
end(), std::ostream_iterator<Value>(out,
"") );
478 object.selfDisplay( out );
534 ConstReverseCirculator
rc()
const {
569 FreemanChain(
const std::string & s =
"", TInteger x = 0, TInteger y = 0 );
608 return (chain == other.
chain) && (
x0 == other.
x0 ) && (
y0 == other.
y0 )
609 && (
xn == other.
xn ) && (
yn == other.
yn );
619 return !( (*this) == other );
683 TInteger& max_x, TInteger& max_y )
const;
857 out << c.x0 <<
" " << c.y0 <<
" " << c.chain << std::endl;
875 template<
typename TConstIterator>
884 template<
typename TRange>
894 std::vector<Point> & aVContour );
915 bool aFlagForAppend=
false);
1035 std::vector<unsigned int> & aPl2pix,
1036 std::vector<unsigned int> & aPix2pl,
1039 innerContour( aPixChain, aPl2pix, aPix2pl, aPlChain,
true );
1070 std::vector<unsigned int> & aOuter2inner,
1071 std::vector<unsigned int> & aInner2outer,
1099 std::vector<unsigned int> & aC2clean,
1100 std::vector<unsigned int> & aClean2c,
1202 template<
typename TInteger>
1212#include "DGtal/geometry/curves/FreemanChain.ih"
1219#undef FreemanChain_RECURSES
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Aim: model of CRange that provides services to (circularly)iterate over the letters of the freeman ch...
friend std::ostream & operator<<(std::ostream &out, const CodesRange &object)
ConstIterator end() const
void selfDisplay(std::ostream &out) const
Circulator< ConstIterator > ConstCirculator
CodesRange & operator=(const CodesRange &other)
CodesRange(const CodesRange &aOther)
ConstReverseIterator rend() const
ConstIterator begin() const
ConstCirculator c() const
ConstReverseCirculator rc() const
std::reverse_iterator< ConstCirculator > ConstReverseCirculator
CodesRange(const std::string &aChain)
std::string::const_reverse_iterator ConstReverseIterator
ConstReverseIterator rbegin() const
std::string::size_type size() const
std::string::const_iterator ConstIterator
ConstIterator(const ConstIterator &aOther)
Index myPos
The current position in the word.
const FreemanChain * myFc
The Freeman chain visited by the iterator.
bool operator<(const ConstIterator &aOther) const
const Point & get() const
const FreemanChain * getChain() const
ConstIterator operator--(int)
ConstIterator & operator++()
ConstIterator(ConstAlias< FreemanChain > aChain, Index n=0)
const Point & operator*() const
ConstIterator & operator=(const ConstIterator &other)
ConstIterator(ConstAlias< FreemanChain > aChain, Index n, const Point &XY)
ConstIterator & operator--()
bool operator==(const ConstIterator &aOther) const
Point myXY
The current coordinates of the iterator.
ConstIterator operator++(int)
std::bidirectional_iterator_tag iterator_category
bool operator!=(const ConstIterator &aOther) const
void computeBoundingBox(TInteger &min_x, TInteger &min_y, TInteger &max_x, TInteger &max_y) const
FreemanChain(const std::vector< Point > &vectPoints)
PointVector< 2, Integer > Vector
char code(Index pos) const
FreemanChain & operator=(const FreemanChain &other)
FreemanChain(const std::string &s="", TInteger x=0, TInteger y=0)
static void write(std::ostream &out, const FreemanChain &c)
ConstIterator end() const
bool operator==(const FreemanChain &other) const
void selfDisplay(std::ostream &out) const
static void displacement(int &dx, int &dy, char aCode)
ConstIterator begin() const
CodesRange getCodesRange()
FreemanChain & operator+=(const FreemanChain &other)
static char turnedCode(char aCode, bool ccw=true)
PointVector< 2, Integer > Point
static char addToCode(char code, int n)
FreemanChain< Integer > Self
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Index next(Index pos) const
static Point displacement(char aCode)
Vector totalDisplacement() const
static void innerContour(FreemanChain &aInnerChain, std::vector< unsigned int > &aOuter2inner, std::vector< unsigned int > &aInner2outer, const FreemanChain &aOuterChain, bool ccw=true)
static void getInterPixelLinels(const KhalimskySpaceND< 2, TInteger > &aKSpace, const FreemanChain &fc, typename KhalimskySpaceND< 2, TInteger >::SCellSet &aSCellContour, bool aFlagForAppend=false)
bool operator!=(const FreemanChain &other) const
Self::ConstIterator findQuadrantChange(OrderedAlphabet &A) const
FreemanChain & retract(Size n=1)
static void readFromPointsRange(const TRange &aRange, FreemanChain &c)
FreemanChain operator+(const FreemanChain &other) const
FreemanChain(std::istream &in)
Point getPoint(Index pos) const
FreemanChain(const FreemanChain &other)
static void read(std::istream &in, FreemanChain &c)
static void getContourPoints(const FreemanChain &fc, std::vector< Point > &aVContour)
static void readFromPointsRange(const TConstIterator &itBegin, const TConstIterator &itEnd, FreemanChain &c)
static void pointel2pixel(FreemanChain &aPixChain, std::vector< unsigned int > &aPl2pix, std::vector< unsigned int > &aPix2pl, const FreemanChain &aPlChain)
Self::ConstIterator findQuadrantChange4(OrderedAlphabet &A) const
FreemanChain & extend(char code)
static void movePointFromFC(Point &aPoint, char aCode)
static short freemanCode4C(int dx, int dy)
std::string className() const
Index previous(Index pos) const
FreemanChain subChain(Index pos, Size n) const
static char movement(char aCode1, char aCode2, bool ccw=true)
static bool cleanOuterSpikes(FreemanChain &aCleanC, std::vector< unsigned int > &aC2clean, std::vector< unsigned int > &aClean2c, const FreemanChain &c, bool ccw=true)
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
Aim: Describes an alphabet over an interval of (ascii) letters, where the lexicographic order can be ...
Aim: Implements basic operations that will be used in Point and Vector classes.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...