DGtal
1.5.beta
|
Aim: More...
#include <DGtal/geometry/curves/OneBalancedWordComputer.h>
Data Structures | |
class | CodeHandler |
class | CodeHandler< TIterator, BidirectionalCategory > |
class | CodeHandler< TIterator, RandomAccessCategory > |
struct | ConstPointIterator |
Public Types | |
typedef TConstIterator | ConstIterator |
typedef TInteger | Integer |
typedef FreemanChain< TInteger > | FreemanChainCode |
typedef OneBalancedWordComputer< ConstIterator, Integer > | Self |
typedef OneBalancedWordComputer< ConstIterator, Integer > | Reverse |
typedef DGtal::PointVector< 2, Integer > | Point |
typedef DGtal::PointVector< 2, Integer > | Vector |
typedef IteratorCirculatorTraits< ConstIterator >::Value | Code |
typedef int | Size |
typedef int | Index |
typedef Vector(* | DisplacementFct) (Code) |
typedef ArithmeticalDSL< TInteger, TInteger, 4 > | DSL |
Static Public Member Functions | |
static Vector | defaultMoves (Code c) |
Protected Attributes | |
CodeHandler< ConstIterator > | myCodeHandler |
ConstIterator | myBegin |
ConstIterator | myEnd |
Point | myFirstPoint |
Point | myLastPoint |
Index | myFirstLetter |
Index | myLastLetter |
unsigned int | myNbRepeat |
Index | myPatternBegin |
Index | myPatternEnd |
Size | myLeftPatternLength |
Index | myNextBefore |
Index | myNextAfter |
Vector(* | myDisplacements )(Code) |
Aim:
Description of template class 'OneBalancedWordComputer'
A combinatorial DSS is a specialized type of 4-connected DSS that reads codes of a Freeman chain as input.
In general, the Freeman coding of a 4-connected DSS has the following form : 's.c^k.p' where 'k>0', 'c' is a Christoffel word, 's' is a suffix of 'c' and 'p' a prefix of 'c'.
More precisely 'c' codes the path between two consecutive upper leaning points so the only exceptions are where the DSS is parallel to one of the axes , in this case the DSS is called 'trivial', and when the DSS has only one upper leaning point.
This class is a model of the concept CBidirectionalSegmentComputer.
TConstIterator | the type of iterator used to read the input codes (preferably of category 'random_access_iterator_tag'). |
TInteger | the type of scalars used for the coordinates of the points (satisfying CInteger) |
Definition at line 91 of file OneBalancedWordComputer.h.
typedef IteratorCirculatorTraits<ConstIterator>::Value DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Code |
Definition at line 110 of file OneBalancedWordComputer.h.
typedef TConstIterator DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::ConstIterator |
Definition at line 98 of file OneBalancedWordComputer.h.
typedef Vector(* DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::DisplacementFct) (Code) |
Definition at line 115 of file OneBalancedWordComputer.h.
typedef ArithmeticalDSL<TInteger, TInteger, 4> DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::DSL |
Definition at line 118 of file OneBalancedWordComputer.h.
typedef FreemanChain<TInteger> DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::FreemanChainCode |
Definition at line 102 of file OneBalancedWordComputer.h.
typedef int DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Index |
Definition at line 112 of file OneBalancedWordComputer.h.
typedef TInteger DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Integer |
Definition at line 99 of file OneBalancedWordComputer.h.
typedef DGtal::PointVector<2,Integer> DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Point |
Definition at line 107 of file OneBalancedWordComputer.h.
typedef OneBalancedWordComputer<ConstIterator, Integer> DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Reverse |
Definition at line 104 of file OneBalancedWordComputer.h.
typedef OneBalancedWordComputer<ConstIterator, Integer> DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Self |
Definition at line 103 of file OneBalancedWordComputer.h.
typedef int DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Size |
Definition at line 111 of file OneBalancedWordComputer.h.
typedef DGtal::PointVector<2,Integer> DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Vector |
Definition at line 108 of file OneBalancedWordComputer.h.
DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::OneBalancedWordComputer | ( | ) |
Default constructor
DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::~OneBalancedWordComputer | ( | ) |
Destructor.
DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::OneBalancedWordComputer | ( | const Self & | other | ) |
Copy constructor.
other | the object to clone. |
Point DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::back | ( | ) | const |
Accessor to the first added point to the DSS
ConstIterator DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::begin | ( | ) | const |
DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::BOOST_CONCEPT_ASSERT | ( | (concepts::CInteger< TInteger >) | ) |
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::computeLeaningPoints | ( | Point & | uf, |
Point & | ul, | ||
Point & | lf, | ||
Point & | ll | ||
) | const |
Computes the leaning points of the DSS
uf | the (returned) first upper leaning point. |
ul | the (returned) last upper leaning point. |
lf | the (returned) first lower leaning point. |
ll | the (returned) last lower leaning point. |
|
inlinestatic |
Default displacement vectors associated to codes.
c | either 0, 1, 2, or 3 (1) ^ | |(2) <----—> (0) | | v (3) |
Definition at line 925 of file OneBalancedWordComputer.h.
Vector DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::displacement | ( | Code | c | ) | const |
Convert a code into vector.
c | a code. |
ConstIterator DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::end | ( | ) | const |
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::extendBack | ( | ) |
Tests whether the current DSS can be extended at the back. Computes the parameters of the extended DSS if yes.
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::extendFront | ( | ) |
Tests whether the current DSS can be extended at the front. Computes the parameters of the extended DSS if yes.
Point DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::front | ( | ) | const |
Accessor to the last added point to the DSS
Integer DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getA | ( | ) | const |
Computes the a-parameter of the bounding DSL. Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
DSL DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getArithmeticalDescription | ( | ) | const |
Computes the DSL of minimal parameters bounding the corresponding DSS,
ie. \( 0 \leq ax - by + \mu < \omega \)
Integer DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getB | ( | ) | const |
Computes the b-parameter of the bounding DSL. Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
Code DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getBigLetter | ( | ) | const |
Returns the last letter of the main pattern.
Code DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getCode | ( | Index | pos | ) |
Get the code at a given index, if code at index 'pos' has not been read yet, the input iterator will be used to access it.
pos | a position in the FreemanChain |
Referenced by DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::ConstPointIterator::next(), and DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::ConstPointIterator::prev().
Code DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getCode | ( | Index | pos | ) | const |
Get the code at a given index.
pos | a position in the FreemanChain |
Integer DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getMu | ( | ) | const |
Computes the intercept of the bounding DSL. Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
Integer DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getOmega | ( | ) | const |
Computes the thickness of the bounding DSL. Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
Reverse DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getReverse | ( | ) | const |
Self DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getSelf | ( | ) | const |
Code DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::getSmallLetter | ( | ) | const |
Returns the first letter of the main pattern.
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::init | ( | const ConstIterator & | it, |
const Point & | start = Point(0, 0) , |
||
Vector(*)(Code) | displacements = defaultMoves |
||
) |
Initialize from input iterator. A DSS of length 1 is initialize from the iterator.
By default, displacements are defined as : '0' -> (1,0), '1' -> (0,1), '2' -> (-1,0), '3' -> (0,-1)
it | the first code to include in the DSS. |
start | the position where the DSS starts. |
displacements | the function that defines displacement vectors from codes. |
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::init | ( | const ConstPointIterator & | i | ) |
Initialize from a ConstPointIterator on a OneBalancedWordComputer.
i | any iterator |
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::init | ( | const FreemanChainCode & | fc | ) |
Initialize from a Freman Chain code.
Note : to be used, this initialization method requires that the class is templated by string::const_iterator.
fc | FreemanChain on which is defined the DSS. |
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::init | ( | const typename FreemanChainCode::ConstIterator & | it | ) |
Initialize from a ConstIterator over a Freman Chain code.
Note : to be used, this initialization method requires that the class is templated by string::const_iterator.
it | ConstIterator giving the letter to initialize the DSS with. |
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::isExtendableBack | ( | ) |
Tests whether the current DSS can be extended at the back.
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::isExtendableFront | ( | ) |
Tests whether the current DSS can be extended at the front.
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::isTrivial | ( | ) | const |
Test if the DSS is a trivial one, that is a DSS with slope 0 or infinite
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::isUL | ( | Index | pos | ) | const |
Determines if a given position is a "upper leaning point". Note that it is assume that the orientation is such that the main pattern begins and ends on upper leaning points. NB: 'pos' must be between 'myPatternBegin' and 'myPatternEnd'
pos | the position of a letter in the main pattern of the DSS |
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::isValid | ( | ) | const |
Performs some basic tests to check the validity of the DSS. For debugging purpose only.
Point DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Lf | ( | ) | const |
Accessor to the first lower leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
Point DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Ll | ( | ) | const |
Accessor to the last lower leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::longestChristoffelPrefix | ( | ConstIterator | it, |
const OrderedAlphabet & | aOA | ||
) |
Initializes the DSS with the longest Christoffel word that is read starting from a given position on a FreemanCode. Only Christoffel words written on a given pair of letters are considered. More precisely, if the ordered alphabet is [a0, a1, a2, a3] then the Christoffel word must be written on the letter a1 < a2.
Note that by usually Christoffel words are defined as primitive words while here repetitions of a Christoffel word will be included in the DSS.
Computation time is O(k) where k is the number of points included in the DSS.
it | a const iterator. |
aOA | the ordered alphabet. |
Size DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::mainPatternLength | ( | ) | const |
Computes the length of the main pattern.
Vector DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::mainPatternVector | ( | ) | const |
Computes the vector defined by the main pattern.
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::nextIsLL | ( | Index | pos | ) | const |
Determines if the letter at a given position leads a "lower leaning point". Note that it is assume that the orientation is such that the main pattern begins and ends on upper leaning points. NB: 'pos' must be between 'myPatternBegin' and 'myPatternEnd'
pos | the position of a letter in the main pattern of the DSS |
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::operator!= | ( | const Self & | other | ) | const |
Difference operator.
other | the object to compare with. |
OneBalancedWordComputer& DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::operator= | ( | const Self & | other | ) |
Assignment.
other | the object to copy. |
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::operator== | ( | const Self & | other | ) | const |
Equality operator.
other | the object to compare with. |
ConstPointIterator DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::pointBegin | ( | ) | const |
Accessor to the first added point to the DSS
ConstPointIterator DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::pointEnd | ( | ) | const |
Accessor to the last added point to the DSS
Size DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::prefixLength | ( | ) | const |
Computes the length of the prefix of the main pattern read after it.
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::previousIsLL | ( | Index | pos | ) | const |
Determines if the letter at a given position comes from a "lower leaning point". Note that it is assume that the orientation is such that the main pattern begins and ends on upper leaning points. NB: 'pos' must be between 'myPatternBegin' and 'myPatternEnd'
pos | the position of a letter in the main pattern of the DSS |
Integer DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::remainder | ( | const Point & | aPoint | ) | const |
Computes the remained of a point relatively to the arithmetical description of the current DSS.
aPoint | a point whose remainder is returned |
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::retractBack | ( | ) |
Removes the first point of the DSS (at back). NB : Unlike the ArithmeticalDSSComputer, a OneBalancedWordComputer must containt at least two points since it is defined by a letter in a Freeman Chain code.
bool DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::retractFront | ( | ) |
Removes the last point of the DSS (at front). NB : Unlike the ArithmeticalDSSComputer, a OneBalancedWordComputer must containt at least two points since it is defined by a letter in a Freeman Chain code.
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::setPosition | ( | const Point & | p | ) |
Set the position of the first point of the DSS.
p | the point where the DSS starts; |
Size DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::suffixLength | ( | ) | const |
Computes the length of the suffix of the main pattern read before it.
void DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::translate | ( | const Vector & | v | ) |
Translates the DSS's position by a given vector.
v | the translation vector. |
Point DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Uf | ( | ) | const |
Accessor to the first upper leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
Point DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::Ul | ( | ) | const |
Accessor to the last upper leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
|
protected |
Iterators on the input codes.
Definition at line 740 of file OneBalancedWordComputer.h.
|
protected |
The array of char on which is defined the OneBalancedWordComputer
Definition at line 735 of file OneBalancedWordComputer.h.
|
protected |
Function that converts the codes of a FreemanChain into a elementary translations.
Definition at line 789 of file OneBalancedWordComputer.h.
Referenced by DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::ConstPointIterator::next(), and DGtal::OneBalancedWordComputer< TConstIterator, TInteger >::ConstPointIterator::prev().
|
protected |
Definition at line 741 of file OneBalancedWordComputer.h.
|
protected |
Index of the first letter of DSS in the FreemanChain
Definition at line 753 of file OneBalancedWordComputer.h.
|
protected |
In order to keep track of the DSS position, first and last points are memorized.
Definition at line 747 of file OneBalancedWordComputer.h.
|
protected |
Definition at line 754 of file OneBalancedWordComputer.h.
|
protected |
Definition at line 748 of file OneBalancedWordComputer.h.
|
protected |
The main pattern factorizes as two subpatterns: a left one and a right one.
Definition at line 775 of file OneBalancedWordComputer.h.
|
protected |
Number of repetitions of the central Christoffel word, otherwise said, the number of upper leaning points minus 1.
Definition at line 762 of file OneBalancedWordComputer.h.
|
protected |
Definition at line 783 of file OneBalancedWordComputer.h.
|
protected |
In order to add/remove letters efficiently from the prefix and the suffix of the main pattern being read, the position of the next letter to read is memorized.
Definition at line 782 of file OneBalancedWordComputer.h.
|
protected |
Indexes indicates where, in the FreemanChain, is located the main pattern of this DSS.
Definition at line 768 of file OneBalancedWordComputer.h.
|
protected |
Definition at line 769 of file OneBalancedWordComputer.h.