NorMIT-nav  22.09
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;
46  mAbsoluteToolFilePath(""),
47  mOpenIGTLinkTransformId(""),
48  mOpenIGTLinkImageId(""),
49  mReference(false),
50  mApplyRefToTool(false)
51  {}
52  };
53 
54 
55  typedef std::vector<ToolStructure> ToolStructureVector;
56  typedef std::map<TRACKING_SYSTEM, ToolStructureVector> TrackersAndToolsMap;
58  {
59  QString mFileName;
60  QString mClinical_app;
61  QString mTrackingSystemImplementation;//Tracking system implementation (igstk or openigtlink)
64  };
65 
66 public:
67  ConfigurationFileParser(QString absoluteConfigFilePath, QString loggingFolder = "");
69 
70  QString getApplicationapplication();
71  std::vector<ToolFileParser::TrackerInternalStructure> getTrackers();
72  std::vector<QString> getAbsoluteToolFilePaths();
73  QString getAbsoluteReferenceFilePath();
74  std::vector<ConfigurationFileParser::ToolStructure> getToolListWithMetaInformation();
75 
76  static QString getTemplatesAbsoluteFilePath();
77  static void saveConfiguration(Configuration& config);
78 
79  QString getTrackingSystemImplementation();
80  bool getApplyRefToTools();
81 private:
82  void setConfigDocument(QString configAbsoluteFilePath);
83  bool isConfigFileValid();
84  QString getAbsoluteToolFilePath(QDomElement toolfileelement);
85  QString findXmlFileWithDirNameInPath(QString path);
86  QString searchForExistingToolFilePath(QString relativeToolFilePath);
87  static QString convertToRelativeToolFilePath(QString configFilename, QString absoluteToolFilePath);
88  static QString getToolPathFromRoot(QString root);
89  static void createToolFileNode(ToolStructureVector::iterator iter, QDomElement &toolFileNode, ToolFileParser &toolparser);
90 
91  QString mConfigurationFilePath;
92  QString mLoggingFolder;
93 
94  QDomDocument mConfigureDoc;
95 };
96 
97 
101 } //namespace cx
102 #endif /* CXTOOLCONFIGURATIONPARSER_H_ */
cx::ToolFileParser
Class for reading the files defining a CustusX tool.
Definition: cxToolFileParser.h:33
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ConfigurationFileParser::ToolStructure::mOpenIGTLinkTransformId
QString mOpenIGTLinkTransformId
Definition: cxToolConfigurationParser.h:41
cx::ConfigurationFileParser::TrackersAndToolsMap
std::map< TRACKING_SYSTEM, ToolStructureVector > TrackersAndToolsMap
Definition: cxToolConfigurationParser.h:56
cxDefinitions.h
cx::ConfigurationFileParser::Configuration::mClinical_app
QString mClinical_app
the clinical application this config is made for
Definition: cxToolConfigurationParser.h:60
cx::ConfigurationFileParser::ToolStructure
Definition: cxToolConfigurationParser.h:38
cx::ConfigurationFileParser::ToolStructure::mAbsoluteToolFilePath
QString mAbsoluteToolFilePath
Definition: cxToolConfigurationParser.h:40
cx::ConfigurationFileParser::Configuration::mFileName
QString mFileName
absolute path and filename for the new config file
Definition: cxToolConfigurationParser.h:59
cx::ConfigurationFileParser::Configuration
Definition: cxToolConfigurationParser.h:57
cx::ConfigurationFileParser::Configuration::mApplyRefToTools
bool mApplyRefToTools
Definition: cxToolConfigurationParser.h:63
cxToolFileParser.h
cx::ConfigurationFileParser::ToolStructureVector
std::vector< ToolStructure > ToolStructureVector
Definition: cxToolConfigurationParser.h:55
cx::ConfigurationFileParser::Configuration::mTrackingSystemImplementation
QString mTrackingSystemImplementation
Definition: cxToolConfigurationParser.h:61
cx::ConfigurationFileParser::ToolStructure::ToolStructure
ToolStructure()
Definition: cxToolConfigurationParser.h:45
cx::ConfigurationFileParser::Configuration::mTrackersAndTools
TrackersAndToolsMap mTrackersAndTools
the trackers and tools (relative path) that should be used in the config
Definition: cxToolConfigurationParser.h:62
cx::ConfigurationFileParser::ToolStructure::mOpenIGTLinkImageId
QString mOpenIGTLinkImageId
Definition: cxToolConfigurationParser.h:42
cx::ConfigurationFileParser::ToolStructure::mApplyRefToTool
bool mApplyRefToTool
Definition: cxToolConfigurationParser.h:44
cx::ConfigurationFileParser::ToolStructure::mReference
bool mReference
Definition: cxToolConfigurationParser.h:43
cx::ConfigurationFileParser
Class for reading the files defining a CustusX tool.
Definition: cxToolConfigurationParser.h:34