DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
digitalSetFromPointList.cpp
1 
30 
31 #include <QtGui/qapplication.h>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/io/readers/PointListReader.h"
34 #include "DGtal/io/viewers/Viewer3D.h"
35 #include "DGtal/io/DrawWithDisplay3DModifier.h"
36 #include "DGtal/io/Color.h"
37 
38 #include "DGtal/helpers/StdDefs.h"
39 #include "ConfigExamples.h"
40 
42 
43 using namespace std;
44 using namespace DGtal;
45 
47 
48 int main( int argc, char** argv )
49 {
50  std::string inputFilename = examplesPath + "samples/pointList3d.pl";
51  QApplication application(argc,argv);
52  Viewer3D viewer;
53  viewer.show();
54  // Importing the 3d set of points contained with the default index (0, 1, 2);
55  vector<Z3i::Point> vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename);
56  for(unsigned int i=0; i<vectPoints.size();i++){
57  viewer << vectPoints.at(i);
58  }
59 
60  // Importing the 3d set of points with another index definition (0, 2, 1);
61  vector<unsigned int> vPos;
62  vPos.push_back(0);
63  vPos.push_back(2);
64  vPos.push_back(1);
65  vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename, vPos);
66  viewer<< CustomColors3D(Color(255,0,0), Color(255,0,0));
67  for(unsigned int i=0; i<vectPoints.size();i++){
68  viewer << vectPoints.at(i);
69  }
70 
71  viewer << Viewer3D::updateDisplay;
72  return application.exec();
73 }