UsTK : Ultrasound ToolKit  version 2.0.1 under development (2025-01-22)
usMedicalViewerExample.cpp
1 #include <visp3/ustk_core/usConfig.h>
2 
3 #ifdef USTK_HAVE_VTK_QT
4 
5 #include <visp3/ustk_core/us.h>
6 #include <visp3/ustk_gui/usMedicalImageViewer.h>
7 
8 int main(int argc, char **argv)
9 {
10  std::string mhd_filename;
11 
12  for (int i = 0; i < argc; i++) {
13  if (std::string(argv[i]) == "--input")
14  mhd_filename = std::string(argv[i + 1]);
15  else if (std::string(argv[i]) == "--help") {
16  std::cout << "\nUsage: " << argv[0] << " [--input <3D volume.mhd>] [--help]\n" << std::endl;
17  return 0;
18  }
19  }
20 
21  // Get the ustk-dataset package path or USTK_DATASET_PATH environment variable value
22  if (mhd_filename.empty()) {
23  std::string env_ipath = us::getDataSetPath();
24  if (!env_ipath.empty())
25  mhd_filename = env_ipath + "/post-scan/3D_mhd/volume.mhd";
26  else {
27  std::cout << "You should set USTK_DATASET_PATH environment var to access to ustk dataset" << std::endl;
28  return 0;
29  }
30  }
31 
32  // QT application
33  QApplication app(argc, argv);
34 
35  usMedicalImageViewer medicalImageViewer(mhd_filename);
36  medicalImageViewer.show();
37 
38  return app.exec();
39 }
40 #else
41 #include <iostream>
42 
43 int main() { std::cout << "Install vtk with qt4 or qt5 support to run this tutorial." << std::endl; }
44 
45 #endif
Graphical main window containing 4 vtk views.
VISP_EXPORT std::string getDataSetPath()
Definition: us.cpp:54