UsTK : Ultrasound ToolKit  version 2.0.1 under development (2025-01-22)
usResliceMatrixExample.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/usResliceMatrixViewer.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  // mhd_filename = env_ipath + "/needle/postScanMHDNeedleInsertion/postscan-vol0.mhd";
27  else {
28  std::cout << "You should set USTK_DATASET_PATH environment var to access to ustk dataset" << std::endl;
29  return 0;
30  }
31  }
32 
33  // QT application
34  QApplication app(argc, argv);
35 
36  usResliceMatrixViewer viewer(mhd_filename);
37  viewer.show();
38 
39  return app.exec();
40 }
41 #else
42 #include <iostream>
43 
44 int main() { std::cout << "Install vtk with qt4 or qt5 support to run this tutorial." << std::endl; }
45 
46 #endif
Graphical main window containing 4 vtk views.
VISP_EXPORT std::string getDataSetPath()
Definition: us.cpp:54