UsTK : Ultrasound ToolKit  version 2.0.1 under development (2023-12-07)
us.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ustk software.
4  * Copyright (C) 2016 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ustk with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * This software was developed at:
17  * Inria Rennes - Bretagne Atlantique
18  * Campus Universitaire de Beaulieu
19  * 35042 Rennes Cedex
20  * France
21  *
22  * If you have questions regarding the use of this file, please contact
23  * Inria at ustk@inria.fr
24  *
25  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27  *
28  * Authors:
29  * Marc Pouliquen
30  *
31  *****************************************************************************/
32 
38 #include <visp3/ustk_core/us.h>
39 
40 namespace us
41 {
42 
54 std::string getDataSetPath()
55 {
56  std::string data_path;
57  std::string file_to_test("post-scan/3D_mhd/volume.mhd");
58  std::string filename;
59 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX
60  // Test if ustk-data package is installed (Ubuntu and Debian)
61  data_path = "/usr/share/ustk-dataset";
62  filename = data_path + "/" + file_to_test;
63  if (vpIoTools::checkFilename(filename))
64  return data_path;
65 #endif
66  // Test if USTK_DATASET_PATH env var is set
67  try {
68  data_path = vpIoTools::getenv("USTK_DATASET_PATH");
69  filename = data_path + "/" + file_to_test;
70  if (vpIoTools::checkFilename(filename))
71  return data_path;
72  } catch (...) {
73  }
74  data_path = "";
75  return data_path;
76 }
77 };
General tools.
VISP_EXPORT std::string getDataSetPath()
Definition: us.cpp:54