DGtal  0.9.3beta
Static Public Member Functions
DGtal::PointListReader< TPoint > Struct Template Reference

#include <DGtal/io/readers/PointListReader.h>

Static Public Member Functions

static std::vector< TPoint > getPointsFromInputStream (std::istream &in, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())
 
static std::vector< TPoint > getPointsFromFile (const std::string &filename, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())
 
static std::vector< std::vector< TPoint > > getPolygonsFromFile (const std::string &filename)
 
static std::vector< std::vector< TPoint > > getPolygonsFromInputStream (std::istream &in)
 
template<typename TInteger >
static std::vector< FreemanChain< TInteger > > getFreemanChainsFromFile (const std::string &filename)
 

Detailed Description

template<typename TPoint>
struct DGtal::PointListReader< TPoint >

Aim: Implements method to read a set of points represented in each line of a file.

Description of class 'PointListReader'

The main method to read a set of points as a simple format where each elements is represented in a single line. Blank line or line beginning with "#" are skipped.

Simple example:

#include "DGtal/helpers/StdDefs.h"
....
string filename= "testFile.dat";
vector<Z2i::Point> vectPoints = PointListReader<Z2i::Point>::getPointsFromFile(filename);

and you can specifying the point position:

vector<unsigned int> vIndice;
vIndice.push_back(1); // select for X coordinate the second position number of the line.
vIndice.push_back(2); // select for Y coordinate the third position number of the line.
vector<Z2i::Point> vectPoints = PointListReader<Z2i::Point>::getPointsFromFile(filename,vectPos);
See also
testPointListReader.cpp
Examples:
geometry/curves/exampleAlphaThickSegmentNoisy.cpp, geometry/curves/exampleAlphaThickSegmentTgtCover.cpp, geometry/curves/exampleArithDSS3d.cpp, geometry/curves/greedyAlphaThickDecomposition.cpp, geometry/volumes/dvcm-2d.cpp, and io/digitalSetFromPointList.cpp.

Definition at line 84 of file PointListReader.h.

Member Function Documentation

template<typename TPoint >
template<typename TInteger >
static std::vector< FreemanChain< TInteger > > DGtal::PointListReader< TPoint >::getFreemanChainsFromFile ( const std::string &  filename)
static

Main method to FreemanChain contours. Each line of the file should represent a FreemanChain

Parameters
[in]filenamethe input filename
Returns
the vector containing the set of FreemanChain.
template<typename TPoint >
static std::vector< TPoint> DGtal::PointListReader< TPoint >::getPointsFromFile ( const std::string &  filename,
std::vector< unsigned int >  aVectPosition = std::vector< unsigned int >() 
)
static

Main method to import a vector containing a list of points defined in a file where each line defines a point. Blank line or line beginning with "#" are skipped.

Parameters
filenamea filename
aVectPositionused to specify the position of indices of value points (optional: default set to 0,..,dimension)
Returns
a vector containing the set of points.
template<typename TPoint >
static std::vector< TPoint> DGtal::PointListReader< TPoint >::getPointsFromInputStream ( std::istream &  in,
std::vector< unsigned int >  aVectPosition = std::vector< unsigned int >() 
)
static

Main method to import a vector containing a list of points defined in a file where each line defines a point. Blank line or line beginning with "#" are skipped.

Parameters
inthe input stream.
aVectPositionused to specify the position of indices of value points (default set to 0,..,dimension).
Returns
a vector containing the set of points.
template<typename TPoint >
static std::vector<std::vector< TPoint> > DGtal::PointListReader< TPoint >::getPolygonsFromFile ( const std::string &  filename)
static

Import a vector containing all polygons defined on each line of a given file.

Parameters
[in]filenameinput filename
Returns
a vector containing the vector of polygons.
template<typename TPoint >
static std::vector<std::vector< TPoint> > DGtal::PointListReader< TPoint >::getPolygonsFromInputStream ( std::istream &  in)
static

Import a vector containing all polygons defined on each line of a given istream.

Parameters
inthe input stream.
Returns
a vector containing the vector of polygons.

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