DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
display3DToOFF.cpp
1 #include <iostream>
2 #include "DGtal/base/Common.h"
3 #include "DGtal/io/readers/VolReader.h"
4 #include "DGtal/io/Display3D.h"
5 
6 #include "DGtal/io/DrawWithDisplay3DModifier.h"
7 #include "DGtal/images/ImageSelector.h"
8 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
9 #include "DGtal/helpers/StdDefs.h"
10 #include "ConfigExamples.h"
11 
12 
13 using namespace std;
14 using namespace DGtal;
15 
16 
17 int main( int /*argc*/, char** /*argv*/ )
18 {
19  std::string inputFilename = examplesPath + "samples/Al.100.vol";
21  Display3D viewer;
23  Image image = VolReader<Image>::importVol(inputFilename);
24  Z3i::DigitalSet set3d (image.domain());
25  SetFromImage<Z3i::DigitalSet>::append<Image>(set3d, image, 0,255);
26 
27  viewer << set3d ;
28  viewer >> "exportMeshToOFF.off";
29  // Alternatively the viewer can be exported also towards an output stream but exclusively in OFF format:
30  // ofstream out;
31  // out.open( "exportMeshToOFF.off");
32  // viewer>> out;
33  // out.close();
35 
36  return 0;
37 }