DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
io/digitalSetFromPointList.cpp
#include <QtGui/qapplication.h>
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/Color.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
using namespace std;
using namespace DGtal;
int main( int argc, char** argv )
{
std::string inputFilename = examplesPath + "samples/pointList3d.pl";
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
// Importing the 3d set of points contained with the default index (0, 1, 2);
vector<Z3i::Point> vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename);
for(unsigned int i=0; i<vectPoints.size();i++){
viewer << vectPoints.at(i);
}
// Importing the 3d set of points with another index definition (0, 2, 1);
vector<unsigned int> vPos;
vPos.push_back(0);
vPos.push_back(2);
vPos.push_back(1);
vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename, vPos);
viewer<< CustomColors3D(Color(255,0,0), Color(255,0,0));
for(unsigned int i=0; i<vectPoints.size();i++){
viewer << vectPoints.at(i);
}
viewer << Viewer3D::updateDisplay;
return application.exec();
}