DGtal  0.9.2
digitalSetFromPointList.cpp
1 
30 #include "DGtal/base/Common.h"
32 #include "DGtal/io/readers/PointListReader.h"
33 #include "DGtal/io/DrawWithDisplay3DModifier.h"
34 #include "DGtal/io/viewers/Viewer3D.h"
35 #include "DGtal/io/Color.h"
36 
37 #include "DGtal/helpers/StdDefs.h"
38 #include "ConfigExamples.h"
39 
41 
42 using namespace std;
43 using namespace DGtal;
44 using namespace Z3i;
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 }
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
STL namespace.
Aim: Implements method to read a set of points represented in each line of a file.
DGtal is the top-level namespace which contains all DGtal functions and types.
Structure representing an RGB triple with alpha component.
Definition: Color.h:66