DGtal 1.4.0
|
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d-scells), d being either equal to 1 or (n-1). More...
#include <DGtal/geometry/curves/GridCurve.h>
Public Types | |
typedef TKSpace | KSpace |
typedef KSpace::Point | Point |
typedef KSpace::Point | Vector |
typedef KSpace::SCell | SCell |
typedef std::vector< SCell > | Storage |
typedef Storage::const_iterator | const_iterator |
typedef Storage::const_iterator | ConstIterator |
typedef Storage::const_reverse_iterator | const_reverse_iterator |
typedef Storage::const_reverse_iterator | ConstReverseIterator |
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::Identity, SCell > | SCellsRange |
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToPoint< KSpace >, Point > | PointsRange |
typedef ConstRangeAdapter< typename Storage::const_iterator, CanonicSCellEmbedder< KSpace >, typename KSpace::Space::RealPoint > | MidPointsRange |
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToArrow< KSpace >, std::pair< Point, Vector > > | ArrowsRange |
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToInnerPoint< KSpace >, Point > | InnerPointsRange |
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToOuterPoint< KSpace >, Point > | OuterPointsRange |
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToIncidentPoints< KSpace >, std::pair< Point, Point > > | IncidentPointsRange |
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToCode< KSpace >, char > | CodesRange |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CCellularGridSpaceND< KSpace >)) | |
~GridCurve () | |
GridCurve (ConstAlias< KSpace > aKSpace) | |
GridCurve () | |
GridCurve (const GridCurve &other) | |
GridCurve & | operator= (const GridCurve &other) |
std::string | className () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
bool | initFromVectorStream (std::istream &in) |
void | writeVectorToStream (std::ostream &out) |
bool | initFromVector (const std::vector< Point > &aVectorOfPoints) |
bool | initFromPointsVector (const std::vector< Point > &aVectorOfPoints) |
template<typename TIterator > | |
bool | initFromPointsRange (const TIterator &itb, const TIterator &ite) |
bool | initFromSCellsVector (const std::vector< SCell > &aVectorOfSCells) |
template<typename TIterator > | |
bool | initFromSCellsRange (const TIterator &itb, const TIterator &ite) |
bool | isClosed () const |
bool | isOpen () const |
ConstIterator | begin () const |
ConstIterator | end () const |
ConstReverseIterator | rbegin () const |
ConstReverseIterator | rend () const |
SCell | back () const |
void | push_back (const SCell &aSCell) |
void | pushBack (const SCell &aSCell) |
Storage::size_type | size () const |
SCellsRange | getSCellsRange () const |
PointsRange | getPointsRange () const |
MidPointsRange | getMidPointsRange () const |
ArrowsRange | getArrowsRange () const |
InnerPointsRange | getInnerPointsRange () const |
OuterPointsRange | getOuterPointsRange () const |
IncidentPointsRange | getIncidentPointsRange () const |
GridCurve::CodesRange | getCodesRange () const |
Private Member Functions | |
SCell | PointVectorTo1SCell (const Point &aPoint, const Vector &aVector) |
bool | isInside (const SCell &aSCell) const |
Private Attributes | |
const KSpace * | myKPtr |
bool | myFlagIsOwned |
Storage | mySCells |
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d-scells), d being either equal to 1 or (n-1).
For instance, the topological boundary of a simply connected digital set is a closed sequence of 1-scells in 2d.
TKSpace | Khalimsky space, a model of CCellularGridSpaceND |
Using the namespace Z2i, defined in StdDefs.h, you can instanciate a grid curve as follows:
This object provides several IO services. For instance, you can read a grid curve from a data file, which contains the (digital) coordinates of the 0-cells (pointels) in nd:
Note that if the first and last 0-scells of the file have the same coordinates (i) or if only one of their coordinates differ by 1 (ii), then the grid curve is considered as closed, ie. scells directly incident to the last signed cell and indirectly incident to the first signed cell are the same.
You can also build a grid curve from the contour of a digital set as follows:
To save a grid curve in a data file, GridCurve provides the special method writeVectorToStream():
The stream mechanism is used to display the true content of the grid curve:
In 2d, the grid curve can be drawn in a vector graphics file as follows:
See Board2D: a stream mechanism for displaying 2D digital objects to learn more about the 2d drawing mechanism used in DGtal.
Moreover, this object provides several ranges as nested types:
You can get an access to these eight ranges through the following methods:
Each range can be displayed in the standard output or can be drawn (except CodesRange) in a vector graphics file as shown in the following snippet:
Moreover, each range has the following inner types:
And each range provides these (circular)iterator services:
You can use these services to iterate over the elements of a given range as follows:
Definition at line 172 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToArrow<KSpace>, std::pair<Point,Vector> > DGtal::GridCurve< TKSpace >::ArrowsRange |
Definition at line 445 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToCode<KSpace>, char > DGtal::GridCurve< TKSpace >::CodesRange |
Definition at line 491 of file GridCurve.h.
typedef Storage::const_iterator DGtal::GridCurve< TKSpace >::const_iterator |
Definition at line 313 of file GridCurve.h.
typedef Storage::const_reverse_iterator DGtal::GridCurve< TKSpace >::const_reverse_iterator |
Definition at line 315 of file GridCurve.h.
typedef Storage::const_iterator DGtal::GridCurve< TKSpace >::ConstIterator |
Definition at line 314 of file GridCurve.h.
typedef Storage::const_reverse_iterator DGtal::GridCurve< TKSpace >::ConstReverseIterator |
Definition at line 316 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToIncidentPoints<KSpace>, std::pair<Point, Point> > DGtal::GridCurve< TKSpace >::IncidentPointsRange |
Definition at line 481 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToInnerPoint<KSpace>, Point > DGtal::GridCurve< TKSpace >::InnerPointsRange |
Definition at line 457 of file GridCurve.h.
typedef TKSpace DGtal::GridCurve< TKSpace >::KSpace |
Definition at line 176 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, CanonicSCellEmbedder<KSpace>, typename KSpace::Space::RealPoint > DGtal::GridCurve< TKSpace >::MidPointsRange |
Definition at line 433 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToOuterPoint<KSpace>, Point > DGtal::GridCurve< TKSpace >::OuterPointsRange |
Definition at line 469 of file GridCurve.h.
typedef KSpace::Point DGtal::GridCurve< TKSpace >::Point |
Definition at line 179 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToPoint<KSpace>, Point > DGtal::GridCurve< TKSpace >::PointsRange |
Definition at line 421 of file GridCurve.h.
typedef KSpace::SCell DGtal::GridCurve< TKSpace >::SCell |
Definition at line 182 of file GridCurve.h.
typedef ConstRangeAdapter< typename Storage::const_iterator, functors::Identity, SCell > DGtal::GridCurve< TKSpace >::SCellsRange |
Definition at line 410 of file GridCurve.h.
typedef std::vector<SCell> DGtal::GridCurve< TKSpace >::Storage |
Definition at line 183 of file GridCurve.h.
typedef KSpace::Point DGtal::GridCurve< TKSpace >::Vector |
Definition at line 180 of file GridCurve.h.
DGtal::GridCurve< TKSpace >::~GridCurve | ( | ) |
Destructor.
DGtal::GridCurve< TKSpace >::GridCurve | ( | ConstAlias< KSpace > | aKSpace | ) |
Constructor.
aKSpace | the Khalimsky space where the grid curve lies. |
DGtal::GridCurve< TKSpace >::GridCurve | ( | ) |
Default Constructor. (the underlying Khalimsky space is default constructed).
DGtal::GridCurve< TKSpace >::GridCurve | ( | const GridCurve< TKSpace > & | other | ) |
Copy constructor.
other | the object to clone. |
SCell DGtal::GridCurve< TKSpace >::back | ( | ) | const |
ConstIterator DGtal::GridCurve< TKSpace >::begin | ( | ) | const |
Referenced by testL1LengthEstimator().
DGtal::GridCurve< TKSpace >::BOOST_CONCEPT_ASSERT | ( | (concepts::CCellularGridSpaceND< KSpace >) | ) |
std::string DGtal::GridCurve< TKSpace >::className | ( | ) | const |
Referenced by testDigitization().
ConstIterator DGtal::GridCurve< TKSpace >::end | ( | ) | const |
Referenced by testL1LengthEstimator().
|
inline |
Definition at line 450 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::myKPtr, and DGtal::GridCurve< TKSpace >::mySCells.
Referenced by main(), testL1LengthEstimator(), testSegmentation(), and testSegmentationLarger().
|
inline |
Definition at line 496 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::myKPtr, and DGtal::GridCurve< TKSpace >::mySCells.
Referenced by main().
|
inline |
Definition at line 486 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::myKPtr, and DGtal::GridCurve< TKSpace >::mySCells.
Referenced by estimatorOnShapeDigitization(), main(), and testDisplayDTFromCircle().
|
inline |
Definition at line 462 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::myKPtr, and DGtal::GridCurve< TKSpace >::mySCells.
Referenced by alphaShape(), main(), and testDisplayDTFromCircle().
|
inline |
Definition at line 438 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::myKPtr, and DGtal::GridCurve< TKSpace >::mySCells.
Referenced by main().
|
inline |
Definition at line 474 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::myKPtr, and DGtal::GridCurve< TKSpace >::mySCells.
Referenced by main(), and testDisplayDTFromCircle().
|
inline |
Definition at line 426 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::myKPtr, and DGtal::GridCurve< TKSpace >::mySCells.
Referenced by compare(), main(), testCompareEstimator(), testL1LengthEstimator(), testSegmentation(), testSegmentationLarger(), and testTrueLocalEstimatorOnShapeDigitization().
|
inline |
Definition at line 415 of file GridCurve.h.
References DGtal::GridCurve< TKSpace >::mySCells.
Referenced by main().
bool DGtal::GridCurve< TKSpace >::initFromPointsRange | ( | const TIterator & | itb, |
const TIterator & | ite ) |
bool DGtal::GridCurve< TKSpace >::initFromPointsVector | ( | const std::vector< Point > & | aVectorOfPoints | ) |
Init from a STL vector of points.
aVectorOfPoints | the vector containing a sequence of grid points (digital coordinates). |
Referenced by testContourHelper().
bool DGtal::GridCurve< TKSpace >::initFromSCellsRange | ( | const TIterator & | itb, |
const TIterator & | ite ) |
Init from a range of signed cells.
itb | begin iterator |
ite | end iterator |
Referenced by main().
bool DGtal::GridCurve< TKSpace >::initFromSCellsVector | ( | const std::vector< SCell > & | aVectorOfSCells | ) |
Init from a STL vector of signed cells.
aVectorOfSCells | the vector containing the sequence of signed cells. |
Referenced by main().
bool DGtal::GridCurve< TKSpace >::initFromVector | ( | const std::vector< Point > & | aVectorOfPoints | ) |
Deprecated name, use initFromPointsVector instead Init.
aVectorOfPoints | the vector containing a sequence of grid points (digital coordinates). |
Referenced by ballGenerator(), ballGenerator(), estimatorOnShapeDigitization(), testCompareEstimator(), testDigitization(), testSegmentation(), and testTrueLocalEstimatorOnShapeDigitization().
bool DGtal::GridCurve< TKSpace >::initFromVectorStream | ( | std::istream & | in | ) |
Init.
in | any input stream, |
Referenced by main(), main(), testEval(), testFP(), testL1LengthEstimator(), testSegmentationLarger(), and testTrueLocalEstimator().
bool DGtal::GridCurve< TKSpace >::isClosed | ( | ) | const |
Checks whether the grid curve is open or closed. Signed cells directly incident to the last scell and indirectly incident to the first scell should be the same in case of a closed grid curve.
|
private |
aSCell | any signed cell |
bool DGtal::GridCurve< TKSpace >::isOpen | ( | ) | const |
Referenced by estimatorOnShapeDigitization().
bool DGtal::GridCurve< TKSpace >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
GridCurve & DGtal::GridCurve< TKSpace >::operator= | ( | const GridCurve< TKSpace > & | other | ) |
Assignment.
other | the object to copy. |
|
private |
aPoint | any point |
aVector | any vector of L1 norm equal to 1 |
void DGtal::GridCurve< TKSpace >::push_back | ( | const SCell & | aSCell | ) |
void DGtal::GridCurve< TKSpace >::pushBack | ( | const SCell & | aSCell | ) |
Back insertion of aSCell
aSCell | any signed cell |
Referenced by alphaShape().
ConstReverseIterator DGtal::GridCurve< TKSpace >::rbegin | ( | ) | const |
ConstReverseIterator DGtal::GridCurve< TKSpace >::rend | ( | ) | const |
void DGtal::GridCurve< TKSpace >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Storage::size_type DGtal::GridCurve< TKSpace >::size | ( | ) | const |
Referenced by testSegmentationLarger().
void DGtal::GridCurve< TKSpace >::writeVectorToStream | ( | std::ostream & | out | ) |
|
private |
bool equal to 'true' if this owns the Khalimsky space but 'false' otherwise
Definition at line 372 of file GridCurve.h.
|
private |
Pointer on a Khalimsky space
Definition at line 367 of file GridCurve.h.
Referenced by DGtal::GridCurve< TKSpace >::getArrowsRange(), DGtal::GridCurve< TKSpace >::getCodesRange(), DGtal::GridCurve< TKSpace >::getIncidentPointsRange(), DGtal::GridCurve< TKSpace >::getInnerPointsRange(), DGtal::GridCurve< TKSpace >::getMidPointsRange(), DGtal::GridCurve< TKSpace >::getOuterPointsRange(), and DGtal::GridCurve< TKSpace >::getPointsRange().
|
private |
list of signed cells
Definition at line 377 of file GridCurve.h.
Referenced by DGtal::GridCurve< TKSpace >::getArrowsRange(), DGtal::GridCurve< TKSpace >::getCodesRange(), DGtal::GridCurve< TKSpace >::getIncidentPointsRange(), DGtal::GridCurve< TKSpace >::getInnerPointsRange(), DGtal::GridCurve< TKSpace >::getMidPointsRange(), DGtal::GridCurve< TKSpace >::getOuterPointsRange(), DGtal::GridCurve< TKSpace >::getPointsRange(), and DGtal::GridCurve< TKSpace >::getSCellsRange().