UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-11-21)
tutorial-mesh-deformation.cpp
1 #include <visp3/ustk_core/usConfig.h>
3 
4 #ifdef USTK_HAVE_VTK_QT
5 #include "usMeshDeformation.h"
6 
7 #include <visp3/ustk_core/us.h>
8 
9 #include <vtkPolyData.h>
10 #include <vtkSmartPointer.h>
11 #include <vtkUnstructuredGridReader.h>
12 
13 int main(int argc, char **argv)
14 {
15  // QT application
16  QApplication app(argc, argv);
17 
18  // setup view widget
19  usMeshDeformation scene;
20 
21  // Create the mesh to display
22  vtkSmartPointer<vtkUnstructuredGridReader> reader = vtkSmartPointer<vtkUnstructuredGridReader>::New();
23 
24  std::string filename = us::getDataSetPath() + "/mesh/liver.vtk";
25  reader->SetFileName(filename.c_str());
26  reader->Update();
27 
28  scene.setMeshInScene(reader->GetOutput());
29 
30  app.setActiveWindow(&scene);
31  scene.showMaximized();
32 
33  return app.exec();
34 }
35 #else
36 #include <iostream>
37 
38 int main() { std::cout << "Install vtk with qt4 or qt5 support to run this tutorial." << std::endl; }
39 
40 #endif
Class used to render a 3D mesh in a 3D environment.
void setMeshInScene(vtkUnstructuredGrid *mesh)
VISP_EXPORT std::string getDataSetPath()
Definition: us.cpp:54