43#include "DGtal/base/Common.h"
44#include "DGtal/helpers/StdDefs.h"
45#include "ConfigExamples.h"
47#include "DGtal/geometry/curves/FreemanChain.h"
48#include "DGtal/geometry/curves/GridCurve.h"
50#include "DGtal/topology/helpers/Surfaces.h"
51#include "DGtal/io/boards/Board2D.h"
78int main(
int argc,
char** argv )
82 for (
int i = 0; i < argc; ++i )
86 string square = examplesPath +
"samples/smallSquare.dat";
87 string S = examplesPath +
"samples/contourS.fc";
90 Point lowerBound( -50, -50 );
91 Point upperBound( 50, 50 );
98 K2 ks; ks.
init( lowerBound, upperBound,
true );
103 trace.
info() <<
"\t from a data file " << endl;
107 inputStream.open (square.c_str(), ios::in);
112 trace.
info() <<
"\t from a digital set " << endl;
121 if ( (*it - o ).norm1() <= 30 ) set.insertNew( *it );
125 vector<SCell> contour;
135 trace.
info() <<
"\t from a FreemanChain (from a file) " << endl;
138 inputStream.open (S.c_str(), ios::in);
150 trace.
info() <<
"\t standard output " << endl;
156 trace.
info() <<
"\t into a data file " << endl;
159 ofstream outputStream(
"myGridCurve.dat");
160 if (outputStream.is_open())
162 outputStream.close();
165 trace.
info() <<
"\t into a vector graphics file " << endl;
169 aBoard.
setUnit(Board2D::UCentimeter);
171 aBoard.
saveEPS(
"myGridCurve.eps", Board2D::BoundingBox, 5000 );
175 trace.
info() <<
"\t into a FreemanChain " << endl;
188 aBoard.
setUnit(Board2D::UCentimeter);
201 aBoard.
saveEPS(
"My1CellsRange.eps", Board2D::BoundingBox, 5000 );
212 aBoard.
saveEPS(
"MyIncidentPointsRange.eps", Board2D::BoundingBox, 5000 );
229 trace.
info() <<
"\t iterate over the range" << endl;
232 for ( ; it != itEnd; ++it)
238 trace.
info() <<
"\t iterate over the range in the reverse way" << endl;
241 for ( ; rit != ritEnd; ++rit)
247 trace.
info() <<
"\t iterate over the range in a circular way" << endl;
250 for (
unsigned i = 0; i < 20; ++i) ++c;
261 trace.
info() <<
"\t Generic function working with any (circular)iterator" << endl;
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
ConstIterator end() const
ConstIterator begin() const
static void readFromPointsRange(const TConstIterator &itBegin, const TConstIterator &itEnd, FreemanChain &c)
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
SCellsRange getSCellsRange() const
bool initFromVectorStream(std::istream &in)
PointsRange getPointsRange() const
IncidentPointsRange getIncidentPointsRange() const
bool initFromSCellsVector(const std::vector< SCell > &aVectorOfSCells)
void writeVectorToStream(std::ostream &out)
bool initFromPointsRange(const TIterator &itb, const TIterator &ite)
GridCurve::CodesRange getCodesRange() const
Iterator for HyperRectDomain.
const ConstIterator & begin() const
std::string className() const
const ConstIterator & end() const
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
TConstIterator ConstIterator
std::reverse_iterator< ConstIterator > ConstReverseIterator
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
static void track2DBoundary(std::vector< SCell > &aSCellContour2D, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
void clear(const DGtal::Color &color=DGtal::Color::None)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void displayAll(const CI &ciBegin, const CI &ciEnd)
[GridCurveGenericFunctionDisplayAll]
DGtal is the top-level namespace which contains all DGtal functions and types.
bool isNotEmpty(const IC &itb, const IC &ite)
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.