CustusX  2023.01.05-dev+develop.0da12
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
QString mLoggingFolderName
path to where log should be saved
boost::shared_ptr< ToolInternalStructure > ToolInternalStructurePtr
QString mInstrumentScannerId
The id of the ultrasound scanner if the instrument is a probe.
tsNONE
Not specified.
QString mLoggingFolder
absolutepath to the logging folder
bool m5DOF
whether or not the tool have 5 DOF
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
std::vector< QString > mClinicalApplications
the tools clinical application applications
QString mTransformSaveFileName
path to where transforms should be saved
TRACKING_SYSTEM mType
the trackers type
QString mSROMFilename
path to the tools SROM file
unsigned int mPortNumber
the port number the tool is connected to
QDomDocument mToolDoc
the tool xml document
QString mOpenigtlinkImageId
The image id when sent over OpenIGTLink.
std::map< QString, Vector3D > mReferencePoints
optional point on the frame, specifying a known reference point, 0,0,0 is default, in sensor space
QString mOpenigtlinkTransformId
The transform id when sent over OpenIGTLink.
ToolInternalStructure()
sets up default values for all the members
unsigned int mChannelNumber
the channel the tool is connected to
QString mToolFilePath
absolutepath to the tool file
bool mWireless
whether or not the tool is wireless
TRACKING_SYSTEM mTrackerType
what product the tool belongs to
TrackerInternalStructure()
set default values for the internal structure
QString mCalibrationFilename
path to the tools calibration file
QString mPictureFileName
path to picture of the tool
QString mGraphicsFileName
path to this tools graphics file
QString mLoggingFolderName
path to where log should be saved
Transform3D mCalibration
transform read from mCalibrationFilename
const QString mToolTypeTag
Class for reading the files defining a CustusX tool.
QString mInstrumentId
The instruments id.
Namespace for all CustusX production code.