Fraxinus  18.10
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<int, Vector3D> mReferencePoints;
69  bool mWireless;
70  bool m5DOF;
71  //TODO use Transform3D instead
75  QString mPictureFileName;
78  QString mInstrumentId;
81  mIsReference(false), mIsPointer(false), mIsProbe(false),
82  //mType(Tool::TOOL_NONE),
83  mName(""), mUid(""),
84  mTrackerType(tsNONE), mSROMFilename(""),
85  mPortNumber(UINT_MAX), mChannelNumber(UINT_MAX),
86  mReferencePoints(), mWireless(true),
87  m5DOF(true),
88  mCalibration(Transform3D::Identity()),
89  mCalibrationFilename(""),
90  mGraphicsFileName(""), mPictureFileName(""),
91  mTransformSaveFileName(""),
92  mLoggingFolderName(""), mInstrumentId(""),
93  mInstrumentScannerId("")
94  {}
95  };
96 
97  typedef boost::shared_ptr<ToolInternalStructure> ToolInternalStructurePtr;
98 
99 public:
100  ToolFileParser(QString absoluteToolFilePath, QString loggingFolder = "");
101  virtual ~ToolFileParser();
102 
103  virtual ToolInternalStructurePtr getTool();
104 
105  //static QString getTemplatesAbsoluteFilePath();
106 
107 protected:
108  QDomNode getToolNode(QString toolAbsoluteFilePath);
109  Transform3D readCalibrationFile(QString absoluteFilePath);
110 
111  QString mToolFilePath;
112  QString mLoggingFolder;
113 
114  QDomDocument mToolDoc;
115  const QString mToolTag, mToolTypeTag, mToolIdTag, mToolNameTag, mToolDescriptionTag, mToolManufacturerTag,
116  mToolClinicalAppTag, mToolGeoFileTag, mToolPicFileTag, mToolDocFileTag, mToolInstrumentTag,
117  mToolInstrumentTypeTag, mToolInstrumentIdTag, mToolInstrumentNameTag,
118  mToolInstrumentManufacturerTag, mToolInstrumentScannerIdTag, mToolInstrumentDescriptionTag,
119  mToolSensorTag, mToolSensorTypeTag, mToolSensorIdTag, mToolSensorNameTag, mToolSensorWirelessTag,
120  mToolSensorDOFTag, mToolSensorPortnumberTag, mToolSensorChannelnumberTag,
121  mToolSensorReferencePointTag, mToolSensorManufacturerTag, mToolSensorDescriptionTag,
122  mToolSensorRomFileTag, mToolCalibrationTag, mToolCalibrationFileTag;
124 
125 };
126 }//namespace
127 
128 
129 #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
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
std::map< int, Vector3D > mReferencePoints
optional point on the frame, specifying a known reference point, 0,0,0 is default, in sensor space
Class for reading the files defining a CustusX tool.
QString mInstrumentId
The instruments id.
Namespace for all CustusX production code.