DGtal 1.3.0
Loading...
Searching...
No Matches
digitalSetFromPointList.cpp
Go to the documentation of this file.
1
42#include "DGtal/base/Common.h"
43#include "DGtal/io/readers/PointListReader.h"
44#include "DGtal/io/DrawWithDisplay3DModifier.h"
45#include "DGtal/io/viewers/Viewer3D.h"
46#include "DGtal/io/Color.h"
47
48#include "DGtal/helpers/StdDefs.h"
49#include "ConfigExamples.h"
50
52
53using namespace std;
54using namespace DGtal;
55using namespace Z3i;
56
58
59int main( int argc, char** argv )
60{
61 std::string inputFilename = examplesPath + "samples/pointList3d.pl";
62 QApplication application(argc,argv);
63 Viewer3D<> viewer;
64 viewer.show();
65 // Importing the 3d set of points contained with the default index (0, 1, 2);
66 vector<Z3i::Point> vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename);
67 for(unsigned int i=0; i<vectPoints.size();i++){
68 viewer << vectPoints.at(i);
69 }
70
71 // Importing the 3d set of points with another index definition (0, 2, 1);
72 vector<unsigned int> vPos;
73 vPos.push_back(0);
74 vPos.push_back(2);
75 vPos.push_back(1);
76 vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename, vPos);
77 viewer<< CustomColors3D(Color(255,0,0), Color(255,0,0));
78 for(unsigned int i=0; i<vectPoints.size();i++){
79 viewer << vectPoints.at(i);
80 }
81
82 viewer << Viewer3D<>::updateDisplay;
83 return application.exec();
84}
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
static std::vector< TPoint > getPointsFromFile(const std::string &filename, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())
int main()
Definition: testBits.cpp:56