NorMIT-nav  22.09
An IGT application
cxToolFileParser.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 CXTOOLFILEPARSER_H
13 #define CXTOOLFILEPARSER_H
14 
15 #include "cxResourceExport.h"
16 
17 #include <QDomDocument>
18 #include "cxTransform3D.h"
19 #include "cxVector3D.h"
20 #include "cxDefinitions.h"
21 #include <vector>
22 #include <map>
23 
24 namespace cx {
25 
33 class cxResource_EXPORT ToolFileParser
34 {
35 public:
37  struct cxResource_EXPORT TrackerInternalStructure
38  {
39  TRACKING_SYSTEM mType;
42  mType(tsNONE),
43  mLoggingFolderName("")
44  {}
45  };
46 
50  struct cxResource_EXPORT ToolInternalStructure
51  {
52  Transform3D getCalibrationAsSSC() const;
53  void setCalibration(const Transform3D& cal);
54  void saveCalibrationToFile();
55  bool verify();
56 
58  bool mIsPointer;
59  bool mIsProbe;
60  // Tool::Type mType; ///< the tools type
61  QString mName;
62  QString mUid;
63  std::vector<QString> mClinicalApplications;
64  TRACKING_SYSTEM mTrackerType;
65  QString mSROMFilename;
66  unsigned int mPortNumber;
67  unsigned int mChannelNumber;
68  std::map<QString, Vector3D> mReferencePoints;
69  bool mWireless;
70  bool m5DOF;
71  //TODO use Transform3D instead
75  QString mPictureFileName;
78  QString mInstrumentId;
83  mIsReference(false), mIsPointer(false), mIsProbe(false),
84  //mType(Tool::TOOL_NONE),
85  mName(""), mUid(""),
86  mTrackerType(tsNONE), mSROMFilename(""),
87  mPortNumber(UINT_MAX), mChannelNumber(UINT_MAX),
88  mReferencePoints(), mWireless(true),
89  m5DOF(true),
90  mCalibration(Transform3D::Identity()),
91  mCalibrationFilename(""),
92  mGraphicsFileName(""), mPictureFileName(""),
93  mTransformSaveFileName(""),
94  mLoggingFolderName(""), mInstrumentId(""),
95  mInstrumentScannerId("")
96  {}
97  };
98 
99  typedef boost::shared_ptr<ToolInternalStructure> ToolInternalStructurePtr;
100 
101 public:
102  ToolFileParser(QString absoluteToolFilePath, QString loggingFolder = "");
103  virtual ~ToolFileParser();
104 
105  virtual ToolInternalStructurePtr getTool();
106 
107  //static QString getTemplatesAbsoluteFilePath();
108 
109 protected:
110  QDomNode getToolNode(QString toolAbsoluteFilePath);
111  Transform3D readCalibrationFile(QString absoluteFilePath);
112 
113  QString mToolFilePath;
114  QString mLoggingFolder;
115 
116  QDomDocument mToolDoc;
117  const QString mToolTag, mToolTypeTag, mToolIdTag, mToolNameTag, mToolDescriptionTag, mToolManufacturerTag,
118  mToolClinicalAppTag, mToolGeoFileTag, mToolPicFileTag, mToolDocFileTag, mToolInstrumentTag,
119  mToolInstrumentTypeTag, mToolInstrumentIdTag, mToolInstrumentNameTag,
120  mToolInstrumentManufacturerTag, mToolInstrumentScannerIdTag, mToolInstrumentDescriptionTag,
121  mToolSensorTag, mToolSensorTypeTag, mToolSensorIdTag, mToolSensorNameTag, mToolSensorWirelessTag,
122  mToolSensorDOFTag, mToolSensorPortnumberTag, mToolSensorChannelnumberTag,
123  mToolSensorReferencePointTag, mToolSensorManufacturerTag, mToolSensorDescriptionTag,
124  mToolSensorRomFileTag, mToolCalibrationTag, mToolCalibrationFileTag,
125  mToolOpenigtlinkImageIdTag, mToolOpenigtlinkTransformIdTag;
127 
128 };
129 }//namespace
130 
131 
132 #endif // CXTOOLFILEPARSER_H
cx::ToolFileParser::ToolInternalStructure::mClinicalApplications
std::vector< QString > mClinicalApplications
the tools clinical application applications
Definition: cxToolFileParser.h:63
cx::ToolFileParser::mToolSensorWirelessTag
const QString mToolSensorWirelessTag
Definition: cxToolFileParser.h:121
cx::ToolFileParser::mLoggingFolder
QString mLoggingFolder
absolutepath to the logging folder
Definition: cxToolFileParser.h:114
cx::ToolFileParser
Class for reading the files defining a CustusX tool.
Definition: cxToolFileParser.h:33
cx::ToolFileParser::ToolInternalStructure::mIsReference
bool mIsReference
Definition: cxToolFileParser.h:57
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ToolFileParser::TrackerInternalStructure::mType
TRACKING_SYSTEM mType
the trackers type
Definition: cxToolFileParser.h:39
cx::ToolFileParser::mToolOpenigtlinkTransformIdTag
const QString mToolOpenigtlinkTransformIdTag
names of necessary tags in the tool file
Definition: cxToolFileParser.h:125
cx::ToolFileParser::ToolInternalStructure::mTransformSaveFileName
QString mTransformSaveFileName
path to where transforms should be saved
Definition: cxToolFileParser.h:76
cxDefinitions.h
cx::ToolFileParser::ToolInternalStructure
A tools internal structure.
Definition: cxToolFileParser.h:50
cx::ToolFileParser::ToolInternalStructure::mLoggingFolderName
QString mLoggingFolderName
path to where log should be saved
Definition: cxToolFileParser.h:77
cx::ToolFileParser::ToolInternalStructure::mPictureFileName
QString mPictureFileName
path to picture of the tool
Definition: cxToolFileParser.h:75
cxVector3D.h
cx::ToolFileParser::ToolInternalStructure::mUid
QString mUid
the tools unique id
Definition: cxToolFileParser.h:62
cx::ToolFileParser::mToolDoc
QDomDocument mToolDoc
the tool xml document
Definition: cxToolFileParser.h:116
cx::ToolFileParser::ToolInternalStructure::mCalibration
Transform3D mCalibration
transform read from mCalibrationFilename
Definition: cxToolFileParser.h:72
cx::ToolFileParser::mToolInstrumentTypeTag
const QString mToolInstrumentTypeTag
Definition: cxToolFileParser.h:119
cx::ToolFileParser::mToolFilePath
QString mToolFilePath
absolutepath to the tool file
Definition: cxToolFileParser.h:113
cx::ToolFileParser::ToolInternalStructure::mName
QString mName
the tools name
Definition: cxToolFileParser.h:61
cx::ToolFileParser::ToolInternalStructure::mChannelNumber
unsigned int mChannelNumber
the channel the tool is connected to
Definition: cxToolFileParser.h:67
cx::ToolFileParser::ToolInternalStructure::mSROMFilename
QString mSROMFilename
path to the tools SROM file
Definition: cxToolFileParser.h:65
cx::ToolFileParser::ToolInternalStructure::mInstrumentScannerId
QString mInstrumentScannerId
The id of the ultrasound scanner if the instrument is a probe.
Definition: cxToolFileParser.h:79
cx::ToolFileParser::ToolInternalStructure::mTrackerType
TRACKING_SYSTEM mTrackerType
what product the tool belongs to
Definition: cxToolFileParser.h:64
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::ToolFileParser::ToolInternalStructure::mOpenigtlinkImageId
QString mOpenigtlinkImageId
The image id when sent over OpenIGTLink.
Definition: cxToolFileParser.h:80
cx::ToolFileParser::mToolPicFileTag
const QString mToolPicFileTag
Definition: cxToolFileParser.h:118
cx::ToolFileParser::mToolSensorRomFileTag
const QString mToolSensorRomFileTag
Definition: cxToolFileParser.h:124
cx::ToolFileParser::mToolSensorReferencePointTag
const QString mToolSensorReferencePointTag
Definition: cxToolFileParser.h:123
cx::ToolFileParser::TrackerInternalStructure
Definition: cxToolFileParser.h:37
cx::ToolFileParser::ToolInternalStructure::mCalibrationFilename
QString mCalibrationFilename
path to the tools calibration file
Definition: cxToolFileParser.h:73
cx::ToolFileParser::ToolInternalStructure::m5DOF
bool m5DOF
whether or not the tool have 5 DOF
Definition: cxToolFileParser.h:70
cx::ToolFileParser::ToolInternalStructure::mWireless
bool mWireless
whether or not the tool is wireless
Definition: cxToolFileParser.h:69
cx::ToolFileParser::ToolInternalStructure::mOpenigtlinkTransformId
QString mOpenigtlinkTransformId
The transform id when sent over OpenIGTLink.
Definition: cxToolFileParser.h:81
cx::ToolFileParser::mToolInstrumentScannerIdTag
const QString mToolInstrumentScannerIdTag
Definition: cxToolFileParser.h:120
cx::ToolFileParser::ToolInternalStructure::mIsProbe
bool mIsProbe
Definition: cxToolFileParser.h:59
cx::ToolFileParser::mToolTypeTag
const QString mToolTypeTag
Definition: cxToolFileParser.h:117
cx::ToolFileParser::mToolSensorPortnumberTag
const QString mToolSensorPortnumberTag
Definition: cxToolFileParser.h:122
cx::ToolFileParser::ToolInternalStructure::mInstrumentId
QString mInstrumentId
The instruments id.
Definition: cxToolFileParser.h:78
cx::ToolFileParser::ToolInternalStructure::mIsPointer
bool mIsPointer
Definition: cxToolFileParser.h:58
cxTransform3D.h
cx::ToolFileParser::ToolInternalStructure::mReferencePoints
std::map< QString, Vector3D > mReferencePoints
optional point on the frame, specifying a known reference point, 0,0,0 is default,...
Definition: cxToolFileParser.h:68
tsNONE
tsNONE
Not specified.
Definition: cxDefinitions.h:112
cx::ToolFileParser::ToolInternalStructurePtr
boost::shared_ptr< ToolInternalStructure > ToolInternalStructurePtr
Definition: cxToolFileParser.h:99
cx::ToolFileParser::ToolInternalStructure::mPortNumber
unsigned int mPortNumber
the port number the tool is connected to
Definition: cxToolFileParser.h:66
cx::ToolFileParser::TrackerInternalStructure::mLoggingFolderName
QString mLoggingFolderName
path to where log should be saved
Definition: cxToolFileParser.h:40
cx::ToolFileParser::ToolInternalStructure::mGraphicsFileName
QString mGraphicsFileName
path to this tools graphics file
Definition: cxToolFileParser.h:74