DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::FreemanChain< TInteger > Class Template Reference

#include <DGtal/geometry/curves/FreemanChain.h>

Data Structures

class  CodesRange
 Aim: model of CRange that provides services to (circularly)iterate over the letters of the freeman chain. More...
 
class  ConstIterator
 

Public Types

typedef TInteger Integer
 
typedef FreemanChain< IntegerSelf
 
typedef PointVector< 2, IntegerPoint
 
typedef PointVector< 2, IntegerVector
 
typedef unsigned int Size
 
typedef unsigned int Index
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CInteger< TInteger >))
 
CodesRange getCodesRange ()
 
 ~FreemanChain ()
 
 FreemanChain (const std::string &s="", TInteger x=0, TInteger y=0)
 
 FreemanChain (const std::vector< Point > &vectPoints)
 
 FreemanChain (std::istream &in)
 
 FreemanChain (const FreemanChain &other)
 
FreemanChainoperator= (const FreemanChain &other)
 
bool operator== (const FreemanChain &other) const
 
bool operator!= (const FreemanChain &other) const
 
char code (Index pos) const
 
Size size () const
 
FreemanChain subChain (Index pos, Size n) const
 
FreemanChain operator+ (const FreemanChain &other) const
 
FreemanChainoperator+= (const FreemanChain &other)
 
void computeBoundingBox (TInteger &min_x, TInteger &min_y, TInteger &max_x, TInteger &max_y) const
 
Self::ConstIterator findQuadrantChange (OrderedAlphabet &A) const
 
Self::ConstIterator findQuadrantChange4 (OrderedAlphabet &A) const
 
int isClosed () const
 
int ccwLoops () const
 
Point getPoint (Index pos) const
 
Point firstPoint () const
 
Point lastPoint () const
 
Vector totalDisplacement () const
 
FreemanChainextend (char code)
 
FreemanChainretract (Size n=1)
 
ConstIterator begin () const
 
ConstIterator end () const
 
Index next (Index pos) const
 
Index previous (Index pos) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 

Static Public Member Functions

static void write (std::ostream &out, const FreemanChain &c)
 
static void read (std::istream &in, FreemanChain &c)
 
template<typename TConstIterator >
static void readFromPointsRange (const TConstIterator &itBegin, const TConstIterator &itEnd, FreemanChain &c)
 
template<typename TRange >
static void readFromPointsRange (const TRange &aRange, FreemanChain &c)
 
static void getContourPoints (const FreemanChain &fc, std::vector< Point > &aVContour)
 
static void getInterPixelLinels (const KhalimskySpaceND< 2, TInteger > &aKSpace, const FreemanChain &fc, typename KhalimskySpaceND< 2, TInteger >::SCellSet &aSCellContour, bool aFlagForAppend=false)
 
static void movePointFromFC (Point &aPoint, char aCode)
 
static char movement (char aCode1, char aCode2, bool ccw=true)
 
static char addToCode (char code, int n)
 
static short freemanCode4C (int dx, int dy)
 
static void displacement (int &dx, int &dy, char aCode)
 
static Point displacement (char aCode)
 
static char turnedCode (char aCode, bool ccw=true)
 
static void pointel2pixel (FreemanChain &aPixChain, std::vector< unsigned int > &aPl2pix, std::vector< unsigned int > &aPix2pl, const FreemanChain &aPlChain)
 
static void innerContour (FreemanChain &aInnerChain, std::vector< unsigned int > &aOuter2inner, std::vector< unsigned int > &aInner2outer, const FreemanChain &aOuterChain, bool ccw=true)
 
static bool cleanOuterSpikes (FreemanChain &aCleanC, std::vector< unsigned int > &aC2clean, std::vector< unsigned int > &aClean2c, const FreemanChain &c, bool ccw=true)
 

Data Fields

std::string chain
 
Integer x0
 
Integer y0
 
Integer xn
 
Integer yn
 

Private Member Functions

void computeLastPoint ()
 

Detailed Description

template<typename TInteger>
class DGtal::FreemanChain< TInteger >

Aim: Describes a digital 4-connected contour as a string of '0', '1', '2', and '3' and the coordinate of the first point. When it is a loop, it is the clockwise boundary of the shape.

Example :

// A Freeman chain code is a string composed by the coordinates of the first
// pixel, and the list of elementary displacements.
std::stringstream ss (stringstream::in | stringstream::out);
ss << "0 0 00001111222233" << endl;
// Construct the Freeman chain
// Compute a bounding box
int minX, maxX, minY, maxY;
fc.computeBoundingBox(minX, minY, maxX, maxY);
// Compute the list of points of the contour
vector<FreemanChain<int>::Point> aContourPointVector;
fc.getContourPoints(fc, aContourPointVector);
// Draw the Freeman chain
Board2D aBoard;
aBoard.setUnit(Board::UMillimeter);
aBoard << fc;
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition Board2D.h:71
void setUnit(Unit unit)
Definition Board.cpp:239
Template Parameters
TIntegertype of the coordinates of the starting point
See also
freemanChainDisplay.cpp freemanChainFromImage.cpp testFreemanChain.cpp
Examples
geometry/curves/convex-and-concave-parts.cpp, geometry/curves/exampleAlphaThickSegment.cpp, geometry/curves/exampleDigitalConvexity.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/curves/exampleRationalConvexity.cpp, geometry/curves/greedy-dss-decomposition.cpp, topology/ctopo-fillContours.cpp, and tutorial-examples/freemanChainFromImage.cpp.

Definition at line 113 of file FreemanChain.h.

Member Typedef Documentation

◆ Index

template<typename TInteger >
typedef unsigned int DGtal::FreemanChain< TInteger >::Index

Definition at line 126 of file FreemanChain.h.

◆ Integer

template<typename TInteger >
typedef TInteger DGtal::FreemanChain< TInteger >::Integer

Definition at line 119 of file FreemanChain.h.

◆ Point

template<typename TInteger >
typedef PointVector<2, Integer> DGtal::FreemanChain< TInteger >::Point

Definition at line 122 of file FreemanChain.h.

◆ Self

template<typename TInteger >
typedef FreemanChain<Integer> DGtal::FreemanChain< TInteger >::Self

Definition at line 120 of file FreemanChain.h.

◆ Size

template<typename TInteger >
typedef unsigned int DGtal::FreemanChain< TInteger >::Size

Definition at line 125 of file FreemanChain.h.

◆ Vector

template<typename TInteger >
typedef PointVector<2, Integer> DGtal::FreemanChain< TInteger >::Vector

Definition at line 123 of file FreemanChain.h.

Constructor & Destructor Documentation

◆ ~FreemanChain()

template<typename TInteger >
DGtal::FreemanChain< TInteger >::~FreemanChain ( )
inline

Destructor.

Definition at line 560 of file FreemanChain.h.

561 { }

◆ FreemanChain() [1/4]

template<typename TInteger >
DGtal::FreemanChain< TInteger >::FreemanChain ( const std::string & s = "",
TInteger x = 0,
TInteger y = 0 )

Constructor.

Parameters
sthe chain code.
xthe x-coordinate of the first point.
ythe y-coordinate of the first point.

◆ FreemanChain() [2/4]

template<typename TInteger >
DGtal::FreemanChain< TInteger >::FreemanChain ( const std::vector< Point > & vectPoints)

Constructor.

Parameters
vectPointsthe vector containing all the points.

◆ FreemanChain() [3/4]

template<typename TInteger >
DGtal::FreemanChain< TInteger >::FreemanChain ( std::istream & in)

Constructor.

Parameters
inany input stream,

◆ FreemanChain() [4/4]

template<typename TInteger >
DGtal::FreemanChain< TInteger >::FreemanChain ( const FreemanChain< TInteger > & other)

Copy constructor.

Parameters
otherthe object to clone.

Member Function Documentation

◆ addToCode()

template<typename TInteger >
static char DGtal::FreemanChain< TInteger >::addToCode ( char code,
int n )
static

Increment (or decrement if negative) the code by 'n'. '0' + 1 = '1', '1' + 1 = '2', ... , '3' + 1 = '0'

Parameters
codethe initial code.
nthe number to add/remove to the code
Returns
'code' increment 'n' times.

Referenced by testStaticServices().

◆ begin()

◆ BOOST_CONCEPT_ASSERT()

template<typename TInteger >
DGtal::FreemanChain< TInteger >::BOOST_CONCEPT_ASSERT ( (concepts::CInteger< TInteger >) )

◆ ccwLoops()

template<typename TInteger >
int DGtal::FreemanChain< TInteger >::ccwLoops ( ) const

This method takes O(n) operations. It determines if the FreemanChain corresponds to a closed contour, and if this is the case, determines how many counterclockwise loops the contour has done. Of course, it the contour has done clockwise loops, then the given number is accordingly negative.

Returns
the number of counterclockwise loops, or '0' if the contour is open or invalid.

Referenced by testPublicSercives().

◆ className()

template<typename TInteger >
std::string DGtal::FreemanChain< TInteger >::className ( ) const

Default drawing style object.

Returns
the dyn. alloc. default style for this object.
the style name used for drawing this object.
Examples
tutorial-examples/freemanChainFromImage.cpp.

Referenced by main(), and testComputeInterior().

◆ cleanOuterSpikes()

template<typename TInteger >
static bool DGtal::FreemanChain< TInteger >::cleanOuterSpikes ( FreemanChain< TInteger > & aCleanC,
std::vector< unsigned int > & aC2clean,
std::vector< unsigned int > & aClean2c,
const FreemanChain< TInteger > & c,
bool ccw = true )
static

Removes outer spikes along a 4-connected contour, meaning steps "02", "13", "20" or "31", which point outside the shape. The inside is given by parameter [ccw]. Note that 4-connected pointel contours should not have any outer spikes, while 4-connected pixel contours should not have any inner spikes.

Parameters
aCleanC(output) the cleaned 4-connected contour.
aC2clean(output) the mapping associating an element to its clean element.
aClean2c(output) the inverse mapping associating a clean element to its non-clean element.
cthe input code of the 4-connected contour (should be a loop !).
ccw'true' if the contour is seen counterclockwise with its inside to the left.
Returns
'true' if the contour add an interior, 'false' otherwise.

Referenced by testStaticServices().

◆ code()

template<typename TInteger >
char DGtal::FreemanChain< TInteger >::code ( Index pos) const
Parameters
posa position in the chain code.
Returns
the code at position [pos].

Note, it is assumed that 0 <= pos < this->size()

Referenced by DGtal::FreemanChain< TInteger >::ConstIterator::getCode(), and testPublicSercives().

◆ computeBoundingBox()

template<typename TInteger >
void DGtal::FreemanChain< TInteger >::computeBoundingBox ( TInteger & min_x,
TInteger & min_y,
TInteger & max_x,
TInteger & max_y ) const

Computes a bounding box for the Freeman chain code.

Parameters
min_x(returns) the minimal x-coordinate.
min_y(returns) the minimal y-coordinate.
max_x(returns) the maximal x-coordinate.
max_y(returns) the maximal y-coordinate.

Referenced by testComputeInterior(), and testPublicSercives().

◆ computeLastPoint()

template<typename TInteger >
void DGtal::FreemanChain< TInteger >::computeLastPoint ( )
private

Default constructor Not valid. Computes the coordinates of the last point. nb: in O(n)

◆ displacement() [1/2]

template<typename TInteger >
static Point DGtal::FreemanChain< TInteger >::displacement ( char aCode)
static
Parameters
aCodea Freeman code (between 0-3). Returns the displacement vector of the Freeman code.

◆ displacement() [2/2]

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::displacement ( int & dx,
int & dy,
char aCode )
static

Returns the displacement vector of a Freeman code.

Parameters
dx(returns) the x-displacement.
dy(returns) the y-displacement.
aCodethe code.

Referenced by testStaticServices().

◆ end()

template<typename TInteger >
ConstIterator DGtal::FreemanChain< TInteger >::end ( ) const

◆ extend()

template<typename TInteger >
FreemanChain & DGtal::FreemanChain< TInteger >::extend ( char code)

Add one symbol at the end of the FreemanChain

Returns
reference to this.

Referenced by testPublicSercives().

◆ findQuadrantChange()

template<typename TInteger >
Self::ConstIterator DGtal::FreemanChain< TInteger >::findQuadrantChange ( OrderedAlphabet & A) const

Finds a quadrant change in 'this' Freeman chain and returns the position as an iterator. A quadrant change is some

abb..bc
|
iterator

The alphabet is possibly re-ordered so that a > b > c.

Parameters
A(possibly updated) a Freeman chain alphabet, possibly re-ordered so that a > b > c.
Returns
an iterator on 'this' that points on the first letter b.

Referenced by testPublicSercives().

◆ findQuadrantChange4()

template<typename TInteger >
Self::ConstIterator DGtal::FreemanChain< TInteger >::findQuadrantChange4 ( OrderedAlphabet & A) const

Finds a quadrant change in 'this' Freeman chain and returns the position as an iterator. A quadrant change is some

(abc)*bc...cd
|
iterator

This quadrant change also guarantees that is not a place where a convexity change occurs in the combinatorial MLP algorithm.

The alphabet is possibly re-ordered so that b > c > d > a.

Parameters
A(possibly updated) a Freeman chain alphabet, possibly re-ordered so that b > c > d > a.
Returns
an iterator on 'this' that points on the first letter c.

Referenced by testPublicSercives().

◆ firstPoint()

template<typename TInteger >
Point DGtal::FreemanChain< TInteger >::firstPoint ( ) const
inline

◆ freemanCode4C()

template<typename TInteger >
static short DGtal::FreemanChain< TInteger >::freemanCode4C ( int dx,
int dy )
static
Returns
the Freeman code associated to given points (0,1,2, or 3). If the direction between the two points differs from these directions it returns 8.
Parameters
[in]dxthe x-displacement.
[in]dythe y-displacement.

◆ getCodesRange()

template<typename TInteger >
CodesRange DGtal::FreemanChain< TInteger >::getCodesRange ( )
inline
Returns
an instance of CodesRange.

Definition at line 546 of file FreemanChain.h.

547 {
548 return CodesRange(chain);
549 }

Referenced by testCodesIterators().

◆ getContourPoints()

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::getContourPoints ( const FreemanChain< TInteger > & fc,
std::vector< Point > & aVContour )
static

Return a vector containing all the integer points of the freemanchain.

Parameters
fcthe FreemanChain
aVContour(returns) the vector containing all the integer contour points.

Referenced by testStaticServices().

◆ getInterPixelLinels()

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::getInterPixelLinels ( const KhalimskySpaceND< 2, TInteger > & aKSpace,
const FreemanChain< TInteger > & fc,
typename KhalimskySpaceND< 2, TInteger >::SCellSet & aSCellContour,
bool aFlagForAppend = false )
static

Return a set containing all the linels (given as Signed SCell in a KhalimskySpaceND) of a FreemanChain (given Z2). Since by definition the interpixel elements cannot be represented in Z2, we use a proper KhalimskySpaceND with a shift defined by convention to (-0.5, 0.5). Notes that this shift is the same that the one used to display FreemanChain object in interpixel mode.

Parameters
aKSpacethe KSpace
fcthe FreemanChain
aSCellContour(returns) the set containing all the linels of the inter-pixels contour.
aFlagForAppendif set to true the resulting set is appended to initial set.

Referenced by main(), and testComputeInterior().

◆ getPoint()

template<typename TInteger >
Point DGtal::FreemanChain< TInteger >::getPoint ( Index pos) const

Computes the point where starts the step at position 'pos' of the FreemanChain. If 'pos' is equal to the length of the FreemanChain then the last point is returned.

Note: for a chain of length 'n' the computation time in O( min( pos, n-pos ) ).

Parameters
posthe position of the point in the FreemanChain
Returns
the point at position 'pos'.

Referenced by testPublicSercives().

◆ innerContour()

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::innerContour ( FreemanChain< TInteger > & aInnerChain,
std::vector< unsigned int > & aOuter2inner,
std::vector< unsigned int > & aInner2outer,
const FreemanChain< TInteger > & aOuterChain,
bool ccw = true )
static

From the Freeman chain [outer_chain] representing a 4-connected contour, constructs the Freeman chain [inner_chain] that represents its inner 4-connected contour (which lies in its interpixel space). The boolean [ccw] specifies if the inside is to the left (ccw) or to the right (cw).

Note that chain codes going back and forth are never considered useless: it means that the chain is always supposed to have its interior to the left (ccw) or right (cw) even at configurations "02", "13", "20", "31".

Parameters
aInnerChain(output) the code of the 4-connected inner border, with starting coordinates that are floored to the closest integer.
aOuter2inner(output) the mapping associating outer to inner elements as indices in their respective Freeman chain.
aInner2outer(output) the mapping associating inner to outer elements as indices in their respective Freeman chain.
aOuterChainthe input code of the 4-connected contour.
ccw'true' if the contour is seen counterclockwise with its inside to the left.

Referenced by DGtal::FreemanChain< TInteger >::pointel2pixel(), and testStaticServices().

◆ isClosed()

template<typename TInteger >
int DGtal::FreemanChain< TInteger >::isClosed ( ) const

Test if the FreemanChain ends at the same point it starts. Take (1) operation since the last point has been stored at initialization.

Returns
'true' if the path is closed, 'false' otherwise.

Referenced by testPublicSercives().

◆ isValid()

template<typename TInteger >
bool DGtal::FreemanChain< TInteger >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ lastPoint()

template<typename TInteger >
Point DGtal::FreemanChain< TInteger >::lastPoint ( ) const
inline
Returns
the starting point of the FreemanChain.

Definition at line 776 of file FreemanChain.h.

777 {
778 return Point(xn,yn);
779 }

References DGtal::FreemanChain< TInteger >::xn, and DGtal::FreemanChain< TInteger >::yn.

Referenced by testPublicSercives(), and DGtal::FreemanChain< TInteger >::totalDisplacement().

◆ movement()

template<typename TInteger >
static char DGtal::FreemanChain< TInteger >::movement ( char aCode1,
char aCode2,
bool ccw = true )
static

Given two consecutive moves on a Freeman chain code, this method returns the type of movement: 0: return move, 1: turning toward the interior, 2: going straight, 3: turning toward exterior. Interior/exterior is specified by [ccw].

Parameters
aCode1the code of the first step as an integer in 0..3.
aCode2the code of the second step as an integer in 0..3.
ccw'true' if the contour is seen counterclockwise with its inside to the left.
Returns
the type of movement given by aCode1 and aCode2.

Referenced by testStaticServices().

◆ movePointFromFC()

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::movePointFromFC ( Point & aPoint,
char aCode )
static

Translate a point by the displacement given a code from a FreemanChain

Parameters
aPointthe point to translate
aCodea FreemanChain code

Referenced by testStaticServices().

◆ next()

template<typename TInteger >
Index DGtal::FreemanChain< TInteger >::next ( Index pos) const

Returns the next position in the chain code. The path coded by the chain code is assumed to be closed so that the position after the last letter is the first one.

Parameters
posa position in the chain code.
Returns
the next position.

◆ operator!=()

template<typename TInteger >
bool DGtal::FreemanChain< TInteger >::operator!= ( const FreemanChain< TInteger > & other) const
inline

Comparaison operator

Parameters
otherthe object to compare to.
Returns
'true' both FreemanChain are different, 'false' otherwise.

Definition at line 617 of file FreemanChain.h.

618 {
619 return !( (*this) == other );
620 }

◆ operator+()

template<typename TInteger >
FreemanChain DGtal::FreemanChain< TInteger >::operator+ ( const FreemanChain< TInteger > & other) const

Concatenation services.

Note: the starting point of 'other' is not considered.

Parameters
otherthe chain to concatenate at the end of this.
Returns
the concatenation of this and other.

◆ operator+=()

template<typename TInteger >
FreemanChain & DGtal::FreemanChain< TInteger >::operator+= ( const FreemanChain< TInteger > & other)

Concatenation services.

Note: the starting point of 'other' is not considered.

Parameters
otherthe chain to concatenate at the end of this.
Returns
a reference to this.

◆ operator=()

template<typename TInteger >
FreemanChain & DGtal::FreemanChain< TInteger >::operator= ( const FreemanChain< TInteger > & other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ operator==()

template<typename TInteger >
bool DGtal::FreemanChain< TInteger >::operator== ( const FreemanChain< TInteger > & other) const
inline

Comparaison operator

Parameters
otherthe object to compare to.
Returns
'true' both FreemanChain are equals, 'false' otherwise.

Definition at line 606 of file FreemanChain.h.

607 {
608 return (chain == other.chain) && ( x0 == other.x0 ) && ( y0 == other.y0 )
609 && ( xn == other.xn ) && ( yn == other.yn );
610 }

References DGtal::FreemanChain< TInteger >::chain, DGtal::FreemanChain< TInteger >::x0, DGtal::FreemanChain< TInteger >::xn, DGtal::FreemanChain< TInteger >::y0, and DGtal::FreemanChain< TInteger >::yn.

◆ pointel2pixel()

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::pointel2pixel ( FreemanChain< TInteger > & aPixChain,
std::vector< unsigned int > & aPl2pix,
std::vector< unsigned int > & aPix2pl,
const FreemanChain< TInteger > & aPlChain )
inlinestatic

From the Freeman chain [pl_chain] representing a pointel 4-connected contour, constructs the Freeman chain [pix_chain] that represents its inner 4-connected border of pixels. The Freeman chain [pl_chain] has its inside to the left (ie. ccw).

Note that chain codes going back and forth are never considered useless: it means that the chain is always supposed to have its interior to the left (ccw) or right (cw) even at configurations "02", "13", "20", "31".

Parameters
aPixChain(output) the code of the 4-connected inner border.
aPl2pix(output) the mapping associating pointels to pixels as indices in their respective Freeman chain.
aPix2pl(output) the inverse mapping associating pixels to pointels as indices in their respective Freeman chain.
aPlChainthe input code of the 4-connected pointel contour.

Definition at line 1034 of file FreemanChain.h.

1038 {
1039 innerContour( aPixChain, aPl2pix, aPix2pl, aPlChain, true );
1040 };
static void innerContour(FreemanChain &aInnerChain, std::vector< unsigned int > &aOuter2inner, std::vector< unsigned int > &aInner2outer, const FreemanChain &aOuterChain, bool ccw=true)

References DGtal::FreemanChain< TInteger >::innerContour().

Referenced by testStaticServices().

◆ previous()

template<typename TInteger >
Index DGtal::FreemanChain< TInteger >::previous ( Index pos) const

Returns the previous position in the chain code. The path coded by the chain code is assumed to be closed so that the position before the first letter is the first last one.

Parameters
posa position in the chain code.
Returns
the previous position.

◆ read()

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::read ( std::istream & in,
FreemanChain< TInteger > & c )
static

Reads a chain from the stream [in] and updates [c].

Parameters
inany input stream,
c(returns) the Freeman chain.

Referenced by testStaticServices().

◆ readFromPointsRange() [1/2]

template<typename TInteger >
template<typename TConstIterator >
static void DGtal::FreemanChain< TInteger >::readFromPointsRange ( const TConstIterator & itBegin,
const TConstIterator & itEnd,
FreemanChain< TInteger > & c )
static

Reads a chain from the points range [ itBegin , itEnd ) and updates c.

Parameters
itBeginbegin iterator,
itEndend iterator,
cthe returned Freeman chain.
Template Parameters
TConstIteratortype of iterator

Referenced by main().

◆ readFromPointsRange() [2/2]

template<typename TInteger >
template<typename TRange >
static void DGtal::FreemanChain< TInteger >::readFromPointsRange ( const TRange & aRange,
FreemanChain< TInteger > & c )
static

Reads a chain from the points range aRange and updates c.

Parameters
aRangeany points range
cthe returned Freeman chain
Template Parameters
TRangetype of points range

◆ retract()

template<typename TInteger >
FreemanChain & DGtal::FreemanChain< TInteger >::retract ( Size n = 1)

Removes 'n' symbols at the end of the FreemanChain.

Returns
reference to this.

Referenced by testPublicSercives().

◆ selfDisplay()

template<typename TInteger >
void DGtal::FreemanChain< TInteger >::selfDisplay ( std::ostream & out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ size()

template<typename TInteger >
Size DGtal::FreemanChain< TInteger >::size ( ) const
Returns
the length of the Freeman chain code.

Referenced by testCodesIterators(), testPointsIterators(), and testPublicSercives().

◆ subChain()

template<typename TInteger >
FreemanChain DGtal::FreemanChain< TInteger >::subChain ( Index pos,
Size n ) const

Returns the subchain of the chain starting at position 'pos' and has 'n' letters long.

Parameters
posposition of a character in the current FreemanChain object to be used as starting character for the subchain.
nlength of the subchain.
Returns
the subchain starting at 'pos' having 'n' letters long.

Referenced by testPublicSercives().

◆ totalDisplacement()

template<typename TInteger >
Vector DGtal::FreemanChain< TInteger >::totalDisplacement ( ) const
inline
Returns
the vector given by displacement from the first point to the last point.

Definition at line 786 of file FreemanChain.h.

787 {
788 return lastPoint() - firstPoint();
789 }
Point lastPoint() const
Point firstPoint() const

References DGtal::FreemanChain< TInteger >::firstPoint(), and DGtal::FreemanChain< TInteger >::lastPoint().

Referenced by testPublicSercives().

◆ turnedCode()

template<typename TInteger >
static char DGtal::FreemanChain< TInteger >::turnedCode ( char aCode,
bool ccw = true )
static

Computes the code obtain from another one after a rotation by pi/2.

Parameters
aCodeany Freeman code.
ccwwhen 'true' turns counterclockwise (or left), otherwise turns clockwise (right).
Returns
the turned code.

◆ write()

template<typename TInteger >
static void DGtal::FreemanChain< TInteger >::write ( std::ostream & out,
const FreemanChain< TInteger > & c )
inlinestatic

Outputs the chain [c] to the stream [out].

Parameters
outany output stream,
ca Freeman chain.

Definition at line 855 of file FreemanChain.h.

856 {
857 out << c.x0 << " " << c.y0 << " " << c.chain << std::endl;
858 }

Referenced by testStaticServices().

Field Documentation

◆ chain

template<typename TInteger >
std::string DGtal::FreemanChain< TInteger >::chain

◆ x0

template<typename TInteger >
Integer DGtal::FreemanChain< TInteger >::x0

the x-coordinate of the first point.

Definition at line 1153 of file FreemanChain.h.

Referenced by DGtal::FreemanChain< TInteger >::firstPoint(), DGtal::FreemanChain< TInteger >::operator==(), and testPointListReader().

◆ xn

template<typename TInteger >
Integer DGtal::FreemanChain< TInteger >::xn

the x-coordinate of the last point.

Definition at line 1163 of file FreemanChain.h.

Referenced by DGtal::FreemanChain< TInteger >::lastPoint(), and DGtal::FreemanChain< TInteger >::operator==().

◆ y0

template<typename TInteger >
Integer DGtal::FreemanChain< TInteger >::y0

the y-coordinate of the first point.

Definition at line 1158 of file FreemanChain.h.

Referenced by DGtal::FreemanChain< TInteger >::firstPoint(), DGtal::FreemanChain< TInteger >::operator==(), and testPointListReader().

◆ yn

template<typename TInteger >
Integer DGtal::FreemanChain< TInteger >::yn

the y-coordinate of the last point.

Definition at line 1168 of file FreemanChain.h.

Referenced by DGtal::FreemanChain< TInteger >::lastPoint(), and DGtal::FreemanChain< TInteger >::operator==().


The documentation for this class was generated from the following file: