DGtal
0.6.devel
|
#include <CombinatorialDSS.h>
Data Structures | |
class | CodeHandler |
class | CodeHandler< TIterator, bidirectional_iterator_tag > |
class | CodeHandler< TIterator, random_access_iterator_tag > |
struct | ConstPointIterator |
Public Types | |
typedef TConstIterator | ConstIterator |
typedef TInteger | Integer |
typedef FreemanChain< TInteger > | FreemanChainCode |
typedef CombinatorialDSS < ConstIterator, Integer > | Self |
typedef CombinatorialDSS < ConstIterator, Integer > | Reverse |
typedef DGtal::PointVector < 2, Integer > | Point |
typedef DGtal::PointVector < 2, Integer > | Vector |
typedef iterator_traits < ConstIterator >::value_type | Code |
typedef int | Size |
typedef int | Index |
typedef Vector(* | DisplacementFct )(Code) |
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 'CombinatorialDSS'
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 87 of file CombinatorialDSS.h.
typedef iterator_traits<ConstIterator>::value_type DGtal::CombinatorialDSS< TConstIterator, TInteger >::Code |
Definition at line 107 of file CombinatorialDSS.h.
typedef TConstIterator DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstIterator |
Definition at line 94 of file CombinatorialDSS.h.
typedef Vector(* DGtal::CombinatorialDSS< TConstIterator, TInteger >::DisplacementFct)(Code) |
Definition at line 112 of file CombinatorialDSS.h.
typedef FreemanChain<TInteger> DGtal::CombinatorialDSS< TConstIterator, TInteger >::FreemanChainCode |
Definition at line 98 of file CombinatorialDSS.h.
typedef int DGtal::CombinatorialDSS< TConstIterator, TInteger >::Index |
Definition at line 109 of file CombinatorialDSS.h.
typedef TInteger DGtal::CombinatorialDSS< TConstIterator, TInteger >::Integer |
Definition at line 95 of file CombinatorialDSS.h.
typedef DGtal::PointVector<2,Integer> DGtal::CombinatorialDSS< TConstIterator, TInteger >::Point |
Definition at line 103 of file CombinatorialDSS.h.
typedef CombinatorialDSS<ConstIterator, Integer> DGtal::CombinatorialDSS< TConstIterator, TInteger >::Reverse |
Definition at line 100 of file CombinatorialDSS.h.
typedef CombinatorialDSS<ConstIterator, Integer> DGtal::CombinatorialDSS< TConstIterator, TInteger >::Self |
Definition at line 99 of file CombinatorialDSS.h.
typedef int DGtal::CombinatorialDSS< TConstIterator, TInteger >::Size |
Definition at line 108 of file CombinatorialDSS.h.
typedef DGtal::PointVector<2,Integer> DGtal::CombinatorialDSS< TConstIterator, TInteger >::Vector |
Definition at line 104 of file CombinatorialDSS.h.
|
inline |
|
inline |
|
inline |
Initialize from an array of codes.
a | pointer to an array of codes. |
the | length of the code array. |
the | start position in 'theCode'. |
the | position of the starting point of the first code. |
a | function that returns the displacement vector of the codes. Copy constructor. |
other | the object to clone. |
other | the object to clone. |
Definition at line 122 of file CombinatorialDSS.ih.
|
inline |
Definition at line 870 of file CombinatorialDSS.ih.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator==().
DGtal::CombinatorialDSS< TConstIterator, TInteger >::BOOST_CONCEPT_ASSERT | ( | (CInteger< TInteger >) | ) |
|
inline |
Computes the leaning points of the DSS
(returns) | the first upper leaning point. |
(returns) | the last upper leaning point. |
(returns) | the first lower leaning point. |
(returns) | the last lower leaning point. |
Definition at line 1004 of file CombinatorialDSS.ih.
References DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::getIndex().
|
inlinestatic |
Default displacement vectors associated to codes.
(1) ^ | |
(2) <——-> (0) | | v (3)
Definition at line 940 of file CombinatorialDSS.h.
|
inline |
Convert a code into vector.
a | code. |
a | code. |
Definition at line 1097 of file CombinatorialDSS.ih.
|
inline |
Definition at line 878 of file CombinatorialDSS.ih.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator==().
|
inline |
Tests whether the current DSS can be extended at the back. Computes the parameters of the extended DSS if yes.
Definition at line 283 of file CombinatorialDSS.ih.
|
inline |
Tests whether the current DSS can be extended at the front. Computes the parameters of the extended DSS if yes.
Definition at line 214 of file CombinatorialDSS.ih.
|
inline |
Computes the arithmetic description of the DSS : 0 <= ax+by+mu < omega Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
Definition at line 917 of file CombinatorialDSS.ih.
|
inline |
Computes the arithmetic description of the DSS : 0 <= ax+by+mu < omega
(returns) | 'a' from the equation mu <= ax-by < mu + omega |
(returns) | 'b' from the equation mu <= ax-by < mu + omega |
(returns) | 'mu' from the equation mu <= ax-by < mu + omega |
(returns) | 'omega' from the equation mu <= ax-by < mu + omega TODO test this ! |
(returns) | 'a' from the equation mu <= ax-by < mu + omega |
(returns) | 'b' from the equation mu <= ax-by < mu + omega |
(returns) | 'mu' from the equation mu <= ax-by < mu + omega |
(returns) | 'omega' from the equation mu <= ax-by < mu + omega |
Definition at line 975 of file CombinatorialDSS.ih.
References DGtal::PointVector< dim, TEuclideanRing >::at(), and DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::getIndex().
|
inline |
Computes the arithmetic description of the DSS : 0 <= ax+by+mu < omega Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
Definition at line 930 of file CombinatorialDSS.ih.
|
inline |
Returns the last letter of the main pattern.
Definition at line 714 of file CombinatorialDSS.ih.
|
inline |
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.
a | position in the FreemanChain |
Definition at line 742 of file CombinatorialDSS.ih.
References DGtal::CombinatorialDSS< TConstIterator, TInteger >::getCode().
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::getCode(), DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::next(), and DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::prev().
|
inline |
Get the code at a given index.
a | position in the FreemanChain |
Definition at line 750 of file CombinatorialDSS.ih.
References DGtal::CombinatorialDSS< TConstIterator, TInteger >::getCode().
|
inline |
Accessor to the first added point to the DSS
Definition at line 1130 of file CombinatorialDSS.ih.
|
inline |
Accessor to the last added point to the DSS
Definition at line 1143 of file CombinatorialDSS.ih.
|
inline |
Accessor to the first lower leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
Definition at line 1068 of file CombinatorialDSS.ih.
|
inline |
Accessor to the last lower leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
Definition at line 1082 of file CombinatorialDSS.ih.
|
inline |
Computes the arithmetic description of the DSS : 0 <= ax+by+mu < omega Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
Definition at line 945 of file CombinatorialDSS.ih.
|
inline |
Computes the arithmetic description of the DSS : 0 <= ax+by+mu < omega Uses 'getArithmeticalDescription' so prefer this latter one if more then one parameter is computed.
Definition at line 959 of file CombinatorialDSS.ih.
|
inline |
Computes the remained of a point relatively to the arithmetical description of the current DSS.
aPoint | a point whose remainder is returned |
Definition at line 1106 of file CombinatorialDSS.ih.
|
inline |
Definition at line 202 of file CombinatorialDSS.ih.
|
inline |
Definition at line 170 of file CombinatorialDSS.ih.
|
inline |
Returns the first letter of the main pattern.
Definition at line 702 of file CombinatorialDSS.ih.
|
inline |
Accessor to the first upper leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
Definition at line 1040 of file CombinatorialDSS.ih.
|
inline |
Accessor to the last upper leaning point Uses 'computeLeaningPoints' so prefer this latter one if more then one leaning point is computed.
Definition at line 1054 of file CombinatorialDSS.ih.
|
inline |
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)
itFirst | the first code to include in the DSS. start the position where the DSS starts. |
displacement,the | function that defines displacement vectors from codes. |
Definition at line 60 of file CombinatorialDSS.ih.
|
inline |
Initialize from a ConstPointIterator on a CombinatorialDSS.
ConstPointIterator |
Definition at line 91 of file CombinatorialDSS.ih.
References DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::getDSS().
|
inline |
Initialize from a Freman Chain code.
Note : to be used, this initialization method requires that the class is templated by string::const_iterator.
FreemanChain | on which is defined the DSS. |
Definition at line 100 of file CombinatorialDSS.ih.
References DGtal::FreemanChain< TInteger >::chain, and DGtal::FreemanChain< TInteger >::firstPoint().
|
inline |
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.
ConstIterator | giving the letter to initialize the DSS with. |
Definition at line 109 of file CombinatorialDSS.ih.
References DGtal::FreemanChain< TInteger >::chain, DGtal::FreemanChain< TInteger >::ConstIterator::getChain(), and DGtal::FreemanChain< TInteger >::ConstIterator::getPosition().
|
inline |
Tests whether the current DSS can be extended at the back.
Definition at line 576 of file CombinatorialDSS.ih.
|
inline |
Tests whether the current DSS can be extended at the front.
Definition at line 546 of file CombinatorialDSS.ih.
|
inline |
Test if the DSS is a trivial one, that is a DSS with slope 0 or infinite
Definition at line 860 of file CombinatorialDSS.ih.
|
inline |
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'
the | position of a letter in the main pattern of the DSS |
the | position of a letter in the DSS |
Definition at line 823 of file CombinatorialDSS.ih.
|
inline |
Performs some basic tests to check the validity of the DSS. For debugging purpose only.
Definition at line 625 of file CombinatorialDSS.ih.
bool DGtal::CombinatorialDSS< 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.
aFC | a FreemanChain. |
aOA | the ordered alphabet. |
len | (returns) the number of points inserted in the DSS which is exacly the length of the Christoffel word read (with repetitions). |
s | the position from where the FreemanCode is read (default value = 0). |
|
inline |
Computes the length of the main pattern.
Definition at line 764 of file CombinatorialDSS.ih.
|
inline |
Computes the vector defined by the main pattern.
Definition at line 776 of file CombinatorialDSS.ih.
References DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::getIndex().
|
inline |
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'
the | position of a letter in the main pattern of the DSS |
the | position of a letter in the DSS |
Definition at line 837 of file CombinatorialDSS.ih.
|
inline |
Difference operator.
other | the object to compare with. |
other | the object to compare with. |
Definition at line 193 of file CombinatorialDSS.ih.
|
inline |
Assignment.
other | the object to copy. |
other | the object to copy. |
Definition at line 147 of file CombinatorialDSS.ih.
References DGtal::CombinatorialDSS< TConstIterator, TInteger >::myBegin, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myCodeHandler, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myDisplacements, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myEnd, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myFirstLetter, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myFirstPoint, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myLastLetter, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myLastPoint, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myLeftPatternLength, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myNbRepeat, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myNextAfter, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myNextBefore, DGtal::CombinatorialDSS< TConstIterator, TInteger >::myPatternBegin, and DGtal::CombinatorialDSS< TConstIterator, TInteger >::myPatternEnd.
|
inline |
Equality operator.
other | the object to compare with. |
other | the object to compare with. |
Definition at line 180 of file CombinatorialDSS.ih.
References DGtal::CombinatorialDSS< TConstIterator, TInteger >::begin(), and DGtal::CombinatorialDSS< TConstIterator, TInteger >::end().
|
inline |
Accessor to the first added point to the DSS
Definition at line 890 of file CombinatorialDSS.ih.
|
inline |
Accessor to the last added point to the DSS
Definition at line 902 of file CombinatorialDSS.ih.
|
inline |
Computes the length of the prefix of the main pattern read after it.
Definition at line 811 of file CombinatorialDSS.ih.
|
inline |
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'
the | position of a letter in the main pattern of the DSS |
the | position of a letter in the DSS |
Definition at line 849 of file CombinatorialDSS.ih.
|
inline |
Removes the last point of the DSS (at front). NB : Unlike the ArithmeticalDSS, a CombinatorialDSS must containt at least two points since it is defined by a letter in a Freeman Chain code.
Definition at line 464 of file CombinatorialDSS.ih.
|
inline |
Removes the first point of the DSS (at back). NB : Unlike the ArithmeticalDSS, a CombinatorialDSS must containt at least two points since it is defined by a letter in a Freeman Chain code.
Definition at line 377 of file CombinatorialDSS.ih.
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 650 of file CombinatorialDSS.ih.
|
inline |
Set the position of the first point of the DSS.
p | the point where the DSS starts; |
Definition at line 601 of file CombinatorialDSS.ih.
|
inline |
Computes the length of the suffix of the main pattern read before it.
Definition at line 799 of file CombinatorialDSS.ih.
|
inline |
Translates the DSS's position by a given vector.
v | the translation vector. |
Definition at line 612 of file CombinatorialDSS.ih.
|
protected |
Iterators on the input codes.
Definition at line 756 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
longer used Freeman chain on which is defined the CombinatarialDSS The array of char on which is defined the CombinatorialDSS
Definition at line 751 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Function that converts the codes of a FreemanChain into a elementary translations.
Definition at line 805 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::next(), DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=(), and DGtal::CombinatorialDSS< TConstIterator, TInteger >::ConstPointIterator::prev().
|
protected |
Definition at line 757 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Index of the first letter of DSS in the FreemanChain
Definition at line 769 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
In order to keep track of the DSS position, first and last points are memorized.
Definition at line 763 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Definition at line 770 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Definition at line 764 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
The main pattern factorizes as two subpatterns: a left one and a right one.
Definition at line 791 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Number of repetitions of the central Christoffel word, otherwise said, the number of upper leaning points minus 1.
Definition at line 778 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Definition at line 799 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
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 798 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Indexes indicates where, in the FreemanChain, is located the main pattern of this DSS.
Definition at line 784 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().
|
protected |
Definition at line 785 of file CombinatorialDSS.h.
Referenced by DGtal::CombinatorialDSS< TConstIterator, TInteger >::operator=().