int main( int argc, char** argv )
{

  //! [MeshUseInitDisplay]
  QApplication application(argc,argv);
  Viewer3D<> viewer;
  viewer.show();
  //! [MeshUseInitDisplay]


  //! [MeshUseMeshCreation]
  // A mesh is constructed and faces are added from the vertex set.
  //! [MeshUseMeshConstructor]
  Mesh<Point> aMesh(true);
  //! [MeshUseMeshConstructor]

  //! [MeshUseMeshAddingPoints]
  aMesh.addVertex(Point(0,0,0));
  aMesh.addVertex(Point(1,0,0));
  aMesh.addVertex(Point(1,1,0));
  //! [MeshUseMeshAddingPoints]

  aMesh.addVertex(Point(0,0,1));
  aMesh.addVertex(Point(1,0,1));
  aMesh.addVertex(Point(1,1,1));
  aMesh.addVertex(Point(0,1,1));

  aMesh.addVertex(Point(0,1,0));
  aMesh.addVertex(Point(0,2,0));
  aMesh.addVertex(Point(0,3,1));
  aMesh.addVertex(Point(0,2,2));
  aMesh.addVertex(Point(0,1,2));
  aMesh.addVertex(Point(0,0,1));
  //! [MeshUseMeshAddingBasicFaces]
  aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
  aMesh.addQuadFace(6,5,4,3, Color::Blue);
  //! [MeshUseMeshAddingBasicFaces]

  //! [MeshUseMeshAddingPolygonalFaces]
  vector<unsigned int> listIndex;
  listIndex.push_back(7);
  listIndex.push_back(8);
  listIndex.push_back(9);
  listIndex.push_back(10);
  listIndex.push_back(11);
  listIndex.push_back(12);
  aMesh.addFace(listIndex, Color(150,150,0,54));
  //! [MeshUseMeshAddingPolygonalFaces]
  //! [MeshUseMeshCreation]

  //! [MeshUseDisplay]
  viewer.setLineColor(Color(150,0,0,254));
  viewer << aMesh;
  viewer << Viewer3D<>::updateDisplay;
  //! [MeshUseDisplay]
  bool res = application.exec();
  FATAL_ERROR(res);
  return true;
}
示例#2
0
void displayAxes( Viewer3D<space, kspace> & viewer,
                  const Point & lowerBound, const Point & upperBound,
		  const std::string & mode )
{
  RealPoint p0( (double)lowerBound[ 0 ]-0.5,
                (double)lowerBound[ 1 ]-0.5,
                (double)lowerBound[ 2 ]-0.5 );
  RealPoint p1( (double)upperBound[ 0 ]-0.5,
                (double)upperBound[ 1 ]-0.5,
                (double)upperBound[ 2 ]-0.5 );
  if ( ( mode == "WIRED" ) || ( mode == "COLORED" ) )
    {
      viewer.setLineColor(AXIS_COLOR);
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
    }
  if ( mode == "COLORED" )
    {
      viewer.setFillColor(XY_COLOR);
      viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]) );
      viewer.setFillColor(XZ_COLOR);
      viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]));
      viewer.setFillColor(YZ_COLOR);
      viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]));
    }
}
int main( int argc, char** argv )
{
  trace.beginBlock ( "Testing class MeshFromPointsDisplay" );
  trace.info() << "Args:";
  for ( int i = 0; i < argc; ++i )
    trace.info() << " " << argv[ i ];
  trace.info() << endl;
  //! [MeshFromPointsUseInitDisplay]
  QApplication application(argc,argv);
  Viewer3D viewer;
  viewer.show();     
  //! [MeshFromPointsUseInitDisplay]

  //! [MeshFromPointsUseMeshCreation]
  MeshFromPoints<Point> aMesh(true);
  aMesh.addVertex(Point(0,0,0));
  aMesh.addVertex(Point(1,0,0));
  aMesh.addVertex(Point(1,1,0));

  aMesh.addVertex(Point(0,0,1));
  aMesh.addVertex(Point(1,0,1));
  aMesh.addVertex(Point(1,1,1));
  aMesh.addVertex(Point(0,1,1));

  aMesh.addVertex(Point(0,1,0));
  aMesh.addVertex(Point(0,2,0));
  aMesh.addVertex(Point(0,3,1));
  aMesh.addVertex(Point(0,2,2));
  aMesh.addVertex(Point(0,1,2));
  aMesh.addVertex(Point(0,0,1));
  
  aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
  aMesh.addQuadFace(6,5,4,3, Color::Blue);
  
  vector<unsigned int> listIndex;
  listIndex.push_back(7);
  listIndex.push_back(8);
  listIndex.push_back(9);
  listIndex.push_back(10);
  listIndex.push_back(11);  
  listIndex.push_back(12);  

  aMesh.addFace(listIndex, Color(150,150,0,54));
  //! [MeshFromPointsUseMeshCreation]
  //! [MeshFromPointsUseDisplay]
  viewer.setLineColor(Color(150,0,0,254));
  viewer << aMesh;
  viewer << Viewer3D::updateDisplay;
  bool res = application.exec();
  //! [MeshFromPointsUseDisplay]
  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
  trace.endBlock();
  return res ? 0 : 1;
}
示例#4
0
int main( int argc, char** argv )
{
  QApplication application(argc,argv);
  Viewer3D<> viewer;
  viewer.show();
  //! [ImportOFFfile]
  std::string inputFilename = examplesPath + "samples/tref.off";
  // Since the input points are not necessary integers we use the PointD3D from Display3D.
  Mesh<Viewer3D<>::RealPoint> anImportedMesh;
  anImportedMesh << inputFilename;
  //! [ImportOFFfile]
  trace.info()<< "importating done..."<< endl;
  //! [displayOFFfile]
  viewer.setLineColor(DGtal::Color(150,0,0,254));
  viewer << anImportedMesh;
  viewer << Viewer3D<>::updateDisplay;
  //! [displayOFFfile]
  return application.exec();
}
示例#5
0
void displayDSS2d( Viewer3D<space, kspace> & viewer,
		   const KSpace & ks, const StandardDSS6Computer & dss3d,
		   const DGtal::Color & color2d )
{
  typedef typename StandardDSS6Computer::ConstIterator ConstIterator3d;
  typedef typename StandardDSS6Computer::ArithmeticalDSSComputer2d ArithmeticalDSSComputer2d;
  typedef typename ArithmeticalDSSComputer2d::ConstIterator ConstIterator2d;
  typedef typename ArithmeticalDSSComputer2d::Point Point2d;
  typedef typename KSpace::Cell Cell;
  typedef typename KSpace::Point Point3d;
  typedef DGtal::PointVector<2,double> PointD2d;
  typedef typename Display3D<>::BallD3D PointD3D;
  Point3d b = ks.lowerBound();
  for ( DGtal::Dimension i = 0; i < 3; ++i )
    {
      const typename ArithmeticalDSSComputer2d::Primitive & dss2d 
	= dss3d.arithmeticalDSS2d( i ).primitive();
      // draw 2D bounding boxes for each arithmetical dss 2D.
      std::vector<PointD2d> pts2d;
      pts2d.push_back( dss2d.project(dss2d.back(), dss2d.Uf()) );
      pts2d.push_back( dss2d.project(dss2d.back(), dss2d.Lf()) );
      pts2d.push_back( dss2d.project(dss2d.front(), dss2d.Lf()) );
      pts2d.push_back( dss2d.project(dss2d.front(), dss2d.Uf()) );
      std::vector<PointD3D> bb;
      PointD3D p3;
      for ( unsigned int j = 0; j < pts2d.size(); ++j )
	{
	  switch (i) {
	  case 0: p3.center[0] = (double) b[ i ]-0.5; p3.center[1] = pts2d[ j ][ 0 ];  p3.center[2] = pts2d[ j ][ 1 ]; break;
	  case 1: p3.center[0] = pts2d[ j ][ 0 ];  p3.center[1] = (double) b[ i ]-0.5; p3.center[2] = pts2d[ j ][ 1 ];     break;
	  case 2: p3.center[0] = pts2d[ j ][ 0 ];  p3.center[1] = pts2d[ j ][ 1 ];     p3.center[2] = (double) b[ i ]-0.5; break;
	  }
	  bb.push_back( p3 );
	}
      for ( unsigned int j = 0; j < pts2d.size(); ++j ){
	viewer.setLineColor(color2d);
	viewer.addLine( DGtal::Z3i::RealPoint(bb[ j ].center[0], bb[ j ].center[1], bb[ j ].center[2]),
                        DGtal::Z3i::RealPoint(bb[ (j+1)%4 ].center[0], bb[ (j+1)%4 ].center[1], bb[ (j+1)%4 ].center[2]),
			MS3D_LINESIZE );
      }
    } // for ( DGtal::Dimension i = 0; i < 3; ++i )
}
示例#6
0
void displayDSS3dTangent( Viewer3D<space, kspace> & viewer,
			  const KSpace & ks, const StandardDSS6Computer & dss3d,
			  const DGtal::Color & color3d )
{
  typedef typename StandardDSS6Computer::Point3d Point;
  typedef typename StandardDSS6Computer::PointD3d PointD3d;
  typedef typename Display3D<>::BallD3D PointD3D;
  Point directionZ3;
  PointD3d P1, P2, direction, intercept, thickness;
  dss3d.getParameters( directionZ3, intercept, thickness );
  assign( direction, directionZ3 );
  direction /= direction.norm();
  assign( P1, *dss3d.begin() );
  assign( P2, *(dss3d.end()-1) );
  double t1 = (P1 - intercept).dot( direction );
  double t2 = (P2 - intercept).dot( direction );

  PointD3d Q1 = intercept + t1 * direction;
  PointD3d Q2 = intercept + t2 * direction;
  viewer.setLineColor(color3d);
  viewer.addLine( DGtal::Z3i::RealPoint(Q1[ 0 ]-0.5, Q1[ 1 ]-0.5, Q1[ 2 ]-0.5), 
		  DGtal::Z3i::RealPoint(Q2[ 0 ]-0.5, Q2[ 1 ]-0.5, Q2[ 2 ]-0.5), 
		  MS3D_LINESIZE );
}
示例#7
0
int main( int argc, char** argv )
{
  if ( argc < 5 )
    {
      usage( argc, argv );
      return 1;
    }
  std::string inputFilename = argv[ 1 ];
  unsigned int minThreshold = atoi( argv[ 2 ] );
  unsigned int maxThreshold = atoi( argv[ 3 ] );
  bool intAdjacency = atoi( argv[ 4 ] ) == 0;

  typedef ImageSelector < Domain, int>::Type Image;
      
  //! [viewMarchingCubes-readVol]
  trace.beginBlock( "Reading vol file into an image." );
  Image image = VolReader<Image>::importVol(inputFilename);
  DigitalSet set3d (image.domain());
  SetFromImage<DigitalSet>::append<Image>(set3d, image,
                                          minThreshold, maxThreshold);
  trace.endBlock();
  //! [viewMarchingCubes-readVol]


  //! [viewMarchingCubes-KSpace]
  trace.beginBlock( "Construct the Khalimsky space from the image domain." );
  KSpace ks;
  bool space_ok = ks.init( image.domain().lowerBound(),
                           image.domain().upperBound(), true );
  if (!space_ok)
    {
      trace.error() << "Error in the Khamisky space construction."<<std::endl;
      return 2;
    }
  trace.endBlock();
  //! [viewMarchingCubes-KSpace]

  //! [viewMarchingCubes-SurfelAdjacency]
  typedef SurfelAdjacency<KSpace::dimension> MySurfelAdjacency;
  MySurfelAdjacency surfAdj( intAdjacency ); // interior in all directions.
  //! [viewMarchingCubes-SurfelAdjacency]

  //! [viewMarchingCubes-ExtractingSurface]
  trace.beginBlock( "Extracting boundary by scanning the space. " );
  typedef KSpace::SurfelSet SurfelSet;
  typedef SetOfSurfels< KSpace, SurfelSet > MySetOfSurfels;
  typedef DigitalSurface< MySetOfSurfels > MyDigitalSurface;
  MySetOfSurfels theSetOfSurfels( ks, surfAdj );
  Surfaces<KSpace>::sMakeBoundary( theSetOfSurfels.surfelSet(),
                                   ks, set3d,
                                   image.domain().lowerBound(),
                                   image.domain().upperBound() );
  MyDigitalSurface digSurf( theSetOfSurfels );
  trace.info() << "Digital surface has " << digSurf.size() << " surfels."
               << std::endl;
  trace.endBlock();
  //! [viewMarchingCubes-ExtractingSurface]

  //! [viewMarchingCubes-makingMesh]
  trace.beginBlock( "Making triangulated surface. " );
  typedef CanonicEmbedder< Space >                                  TrivialEmbedder;
  typedef ImageLinearCellEmbedder< KSpace, Image, TrivialEmbedder > CellEmbedder;
  typedef CellEmbedder::Value                                       RealPoint;
  typedef TriangulatedSurface< RealPoint >                          TriMesh;
  typedef Mesh< RealPoint >                                         ViewMesh;
  typedef std::map< MyDigitalSurface::Vertex, TriMesh::Index >      VertexMap;
  TriMesh         trimesh;
  ViewMesh        viewmesh;
  TrivialEmbedder trivialEmbedder;
  CellEmbedder    cellEmbedder;
  // The +0.5 is to avoid isosurface going exactly through a voxel
  // center, especially for binary volumes.
  cellEmbedder.init( ks, image, trivialEmbedder, 
                     ( (double) minThreshold ) + 0.5 );
  VertexMap vmap; // stores the map Vertex -> Index
  MeshHelpers::digitalSurface2DualTriangulatedSurface
    ( digSurf, cellEmbedder, trimesh, vmap );
  trace.info() << "Triangulated surface is " << trimesh << std::endl;
  MeshHelpers::triangulatedSurface2Mesh( trimesh, viewmesh );
  trace.info() << "Mesh has " << viewmesh.nbVertex()
               << " vertices and " << viewmesh.nbFaces() << " faces." << std::endl;
  trace.endBlock();
  //! [viewMarchingCubes-makingMesh]

  QApplication application(argc,argv);
  Viewer3D<> viewer;
  viewer.show();
  viewer.setLineColor(Color(150,0,0,254));
  viewer << viewmesh;
  viewer << Viewer3D<>::updateDisplay;
  application.exec();
  
}
示例#8
0
int main( int argc, char** argv )
{

    // parse command line ----------------------------------------------
    po::options_description general_opt("Allowed options are: ");
    general_opt.add_options()
    ("help,h", "display this message")
    ("input,i", po::value<std::vector<string> >()->multitoken(), "off files (.off), or OFS file (.ofs) " )
    ("scaleX,x",  po::value<float>()->default_value(1.0), "set the scale value in the X direction (default 1.0)" )
    ("scaleY,y",  po::value<float>()->default_value(1.0), "set the scale value in the Y direction (default 1.0)" )
    ("scaleZ,z",  po:: value<float>()->default_value(1.0), "set the scale value in the Z direction (default 1.0)")
    ("minLineWidth,w",  po:: value<float>()->default_value(1.5), "set the min line width of the mesh faces (default 1.5)")
    ("customColorMesh",po::value<std::vector<unsigned int> >()->multitoken(), "set the R, G, B, A components of the colors of the mesh faces and eventually the color R, G, B, A of the mesh edge lines (set by default to black). " )
    ("customColorSDP",po::value<std::vector<unsigned int> >()->multitoken(), "set the R, G, B, A components of the colors of  the sdp view" )
    ("displayVectorField,f",po::value<std::string>(),  "display a vector field from a simple sdp file (two points per line)" )
    ("vectorFieldIndex",po::value<std::vector<unsigned int> >()->multitoken(), "specify special indices for the two point coordinates (instead usinf the default indices: 0 1, 2, 3, 4, 5)" )
    ("customLineColor",po::value<std::vector<unsigned int> >()->multitoken(), "set the R, G, B components of the colors of the lines displayed from the --displayVectorField option (red by default). " )
    ("displaySDP,s", po::value<std::string>(), "Add the display of a set of discrete points as ball of radius 0.5.")
    ("SDPradius", po::value<double>()->default_value(0.5), "change the ball radius to display a set of discrete points (used with displaySDP option)")
    ("invertNormal,n", "threshold min to define binary shape" )
    ("drawVertex,v", "draw the vertex of the mesh" );

    bool parseOK=true;
    po::variables_map vm;
    try {
        po::store(po::parse_command_line(argc, argv, general_opt), vm);
    } catch(const std::exception& ex) {
        parseOK=false;
        trace.info()<< "Error checking program options: "<< ex.what()<< endl;
    }
    po::notify(vm);
    if( !parseOK || vm.count("help")||argc<=1)
    {
        std::cout << "Usage: " << argv[0] << " [input]\n"
                  << "Display OFF mesh file by using QGLviewer"
                  << general_opt << "\n";
        return 0;
    }

    if(! vm.count("input"))
    {
        trace.error() << " The file name was defined" << endl;
        return 0;
    }



    std::vector<std::string> inputFilenameVect = vm["input"].as<std::vector<std::string > >();
    float sx = vm["scaleX"].as<float>();
    float sy = vm["scaleY"].as<float>();
    float sz = vm["scaleZ"].as<float>();

    unsigned int  meshColorR = 240;
    unsigned int  meshColorG = 240;
    unsigned int  meshColorB = 240;
    unsigned int  meshColorA = 255;

    unsigned int  meshColorRLine = 0;
    unsigned int  meshColorGLine = 0;
    unsigned int  meshColorBLine = 0;
    unsigned int  meshColorALine = 255;


    unsigned int  sdpColorR = 240;
    unsigned int  sdpColorG = 240;
    unsigned int  sdpColorB = 240;
    unsigned int  sdpColorA = 255;


    bool displayVectorField = vm.count("displayVectorField");
    std::vector<unsigned int> vectFieldIndices = {0,1,2,3,4,5};

    if (displayVectorField) {
        if(vm.count("vectorFieldIndex")) {
            vectFieldIndices = vm["vectorFieldIndex"].as<std::vector<unsigned int> >();
            if (vectFieldIndices.size() != 6) {
                trace.warning() << "you should specify indices for each of the 6 fields of the two coordinates." << std::endl;
                vectFieldIndices = {0,1,2,3,4,5};
            }
        }
    }

    float lineWidth = vm["minLineWidth"].as<float>();

    DGtal::Color vFieldLineColor = DGtal::Color::Red;
    if(vm.count("customLineColor")) {
        std::vector<unsigned int > vectCol = vm["customLineColor"].as<std::vector<unsigned int> >();
        if(vectCol.size()!=3 ) {
            trace.error() << "colors specification should contain R,G,B values (using default red)."<< std::endl;
        }
        vFieldLineColor.setRGBi(vectCol[0], vectCol[1], vectCol[2], 255);
    }

    if(vm.count("customColorMesh")) {
        std::vector<unsigned int > vectCol = vm["customColorMesh"].as<std::vector<unsigned int> >();
        if(vectCol.size()!=4 && vectCol.size()!=8 ) {
            trace.error() << "colors specification should contain R,G,B and Alpha values"<< std::endl;
        }
        meshColorR = vectCol[0];
        meshColorG = vectCol[1];
        meshColorB = vectCol[2];
        meshColorA = vectCol[3];
        if(vectCol.size() == 8) {
            meshColorRLine = vectCol[4];
            meshColorGLine = vectCol[5];
            meshColorBLine = vectCol[6];
            meshColorALine = vectCol[7];

        }

    }
    if(vm.count("customColorSDP")) {
        std::vector<unsigned int > vectCol = vm["customColorSDP"].as<std::vector<unsigned int> >();
        if(vectCol.size()!=4) {
            trace.error() << "colors specification should contain R,G,B and Alpha values"<< std::endl;
        }
        sdpColorR = vectCol[0];
        sdpColorG = vectCol[1];
        sdpColorB = vectCol[2];
        sdpColorA = vectCol[3];
    }



    QApplication application(argc,argv);
    Viewer3D<> viewer;
    std::stringstream title;
    title  << "Simple Mesh Viewer: " << inputFilenameVect[0];
    viewer.setWindowTitle(title.str().c_str());
    viewer.show();
    viewer.myGLLineMinWidth = lineWidth;
    viewer.setGLScale(sx, sy, sz);
    bool invertNormal= vm.count("invertNormal");


    double ballRadius = vm["SDPradius"].as<double>();

    trace.info() << "Importing mesh... ";

    std::vector<Mesh<DGtal::Z3i::RealPoint> >  vectMesh;
    for(unsigned int i = 0; i< inputFilenameVect.size(); i++) {
        Mesh<DGtal::Z3i::RealPoint> aMesh(!vm.count("customColorMesh"));
        aMesh << inputFilenameVect[i];
        vectMesh.push_back(aMesh);
    }


    bool import = vectMesh.size()==inputFilenameVect.size();
    if(!import) {
        trace.info() << "File import failed. " << std::endl;
        return 0;
    }

    trace.info() << "[done]. "<< std::endl;
    if(vm.count("displaySDP")) {
        std::string filenameSDP = vm["displaySDP"].as<std::string>();
        vector<Z3i::RealPoint> vectPoints;
        vectPoints = PointListReader<Z3i::RealPoint>::getPointsFromFile(filenameSDP);
        viewer << CustomColors3D(Color(sdpColorR, sdpColorG, sdpColorB, sdpColorA),
                                 Color(sdpColorR, sdpColorG, sdpColorB, sdpColorA));
        for(unsigned int i=0; i< vectPoints.size(); i++) {
            viewer.addBall(vectPoints.at(i), ballRadius);
        }
    }
    if(invertNormal) {
        for(unsigned int i=0; i<vectMesh.size(); i++) {
            vectMesh[i].invertVertexFaceOrder();
        }
    }

    viewer << CustomColors3D(Color(meshColorRLine, meshColorGLine, meshColorBLine, meshColorALine),
                             Color(meshColorR, meshColorG, meshColorB, meshColorA));
    for(unsigned int i=0; i<vectMesh.size(); i++) {
        viewer << vectMesh[i];
    }

    if(vm.count("drawVertex")) {
        for(unsigned int i=0; i<vectMesh.size(); i++) {
            for( Mesh<DGtal::Z3i::RealPoint>::VertexStorage::const_iterator it = vectMesh[i].vertexBegin();
                    it!=vectMesh[i].vertexEnd(); ++it) {
                DGtal::Z3i::Point pt;
                pt[0]=(*it)[0];
                pt[1]=(*it)[1];
                pt[2]=(*it)[2];
                viewer << pt;
            }
        }
    }


    if (displayVectorField) {
        std::vector<unsigned int > vectFieldIndices1 = {vectFieldIndices[0],vectFieldIndices[1], vectFieldIndices[2]};
        std::vector<unsigned int > vectFieldIndices2 = {vectFieldIndices[3],vectFieldIndices[4], vectFieldIndices[5]};

        std::vector<DGtal::Z3i::RealPoint> vectPt1 = PointListReader<DGtal::Z3i::RealPoint>::getPointsFromFile(vm["displayVectorField"].as<std::string>(), vectFieldIndices1);
        std::vector<DGtal::Z3i::RealPoint> vectPt2 = PointListReader<DGtal::Z3i::RealPoint>::getPointsFromFile(vm["displayVectorField"].as<std::string>(), vectFieldIndices2);
        viewer.createNewLineList();
        for (unsigned int i = 0; i < vectPt1.size(); i++) {

            viewer.setLineColor(vFieldLineColor);
            viewer.addLine(vectPt1[i], vectPt2[i]);
        }


    }


    viewer << Viewer3D<>::updateDisplay;
    return application.exec();
}