NorMIT-nav  18.04
An IGT application
cxToolConfigurationParser.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXTOOLCONFIGURATIONPARSER_H_
13 #define CXTOOLCONFIGURATIONPARSER_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include <utility>
18 #include <map>
19 #include <vector>
20 #include <QString>
21 #include <QDomDocument>
22 #include "cxDefinitions.h"
23 #include "cxToolFileParser.h"
24 
25 namespace cx
26 {
27 
34 class cxResource_EXPORT ConfigurationFileParser
35 {
36 public:
37 
38  struct cxResource_EXPORT ToolStructure
39  {
43  bool mReference;
45  mAbsoluteToolFilePath(""),
46  mOpenIGTLinkTransformId(""),
47  mOpenIGTLinkImageId(""),
48  mReference(false)
49  {}
50  };
51 
52 
53  typedef std::vector<ToolStructure> ToolStructureVector;
54  typedef std::map<TRACKING_SYSTEM, ToolStructureVector> TrackersAndToolsMap;
56  {
57  QString mFileName;
58  QString mClinical_app;
59  QString mTrackingSystemImplementation;//Tracking system implementation (igstk or openigtlink)
60  TrackersAndToolsMap mTrackersAndTools;
61  };
62 
63 public:
64  ConfigurationFileParser(QString absoluteConfigFilePath, QString loggingFolder = "");
66 
67  QString getApplicationapplication();
68  std::vector<ToolFileParser::TrackerInternalStructure> getTrackers();
69  std::vector<QString> getAbsoluteToolFilePaths();
70  QString getAbsoluteReferenceFilePath();
71  std::vector<ConfigurationFileParser::ToolStructure> getToolListWithMetaInformation();
72 
73  static QString getTemplatesAbsoluteFilePath();
74  static void saveConfiguration(Configuration& config);
75 
76  QString getTrackingSystemImplementation();
77 private:
78  void setConfigDocument(QString configAbsoluteFilePath);
79  bool isConfigFileValid();
80  QString getAbsoluteToolFilePath(QDomElement toolfileelement);
81  QString findXmlFileWithDirNameInPath(QString path);
82  QString searchForExistingToolFilePath(QString relativeToolFilePath);
83  static QString convertToRelativeToolFilePath(QString configFilename, QString absoluteToolFilePath);
84  static QString getToolPathFromRoot(QString root);
85 
86  QString mConfigurationFilePath;
87  QString mLoggingFolder;
88 
89  QDomDocument mConfigureDoc;
90 };
91 
92 
96 } //namespace cx
97 #endif /* CXTOOLCONFIGURATIONPARSER_H_ */
TrackersAndToolsMap mTrackersAndTools
the trackers and tools (relative path) that should be used in the config
std::map< TRACKING_SYSTEM, ToolStructureVector > TrackersAndToolsMap
QString mFileName
absolute path and filename for the new config file
std::vector< ToolStructure > ToolStructureVector
Class for reading the files defining a CustusX tool.
QString mClinical_app
the clinical application this config is made for
Namespace for all CustusX production code.