CustusX  16.5.0-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXTOOLFILEPARSER_H
34 #define CXTOOLFILEPARSER_H
35 
36 #include "cxResourceExport.h"
37 
38 #include <QDomDocument>
39 #include "cxTransform3D.h"
40 #include "cxVector3D.h"
41 #include "cxDefinitions.h"
42 #include <vector>
43 #include <map>
44 
45 namespace cx {
46 
54 class cxResource_EXPORT ToolFileParser
55 {
56 public:
58  struct cxResource_EXPORT TrackerInternalStructure
59  {
60  TRACKING_SYSTEM mType;
63  mType(tsNONE),
64  mLoggingFolderName("")
65  {}
66  };
67 
71  struct cxResource_EXPORT ToolInternalStructure
72  {
73  Transform3D getCalibrationAsSSC() const;
74  void setCalibration(const Transform3D& cal);
75  void saveCalibrationToFile();
76  bool verify();
77 
79  bool mIsPointer;
80  bool mIsProbe;
81 // Tool::Type mType; ///< the tools type
82  QString mName;
83  QString mUid;
84  std::vector<QString> mClinicalApplications;
85  TRACKING_SYSTEM mTrackerType;
86  QString mSROMFilename;
87  unsigned int mPortNumber;
88  unsigned int mChannelNumber;
89  std::map<int, Vector3D> mReferencePoints;
90  bool mWireless;
91  bool m5DOF;
92  //TODO use Transform3D instead
96  QString mPictureFileName;
99  QString mInstrumentId;
102  mIsReference(false), mIsPointer(false), mIsProbe(false),
103  //mType(Tool::TOOL_NONE),
104  mName(""), mUid(""),
105  mTrackerType(tsNONE), mSROMFilename(""),
106  mPortNumber(UINT_MAX), mChannelNumber(UINT_MAX),
107  mReferencePoints(), mWireless(true),
108  m5DOF(true), mCalibrationFilename(""),
109  mGraphicsFileName(""), mPictureFileName(""),
110  mTransformSaveFileName(""),
111  mLoggingFolderName(""), mInstrumentId(""),
112  mInstrumentScannerId("")
113  {}
114  };
115 
116 public:
117  ToolFileParser(QString absoluteToolFilePath, QString loggingFolder = "");
118  ~ToolFileParser();
119 
120  virtual ToolInternalStructure getTool();
121 
122  //static QString getTemplatesAbsoluteFilePath();
123 
124 protected:
125  QDomNode getToolNode(QString toolAbsoluteFilePath);
126  Transform3D readCalibrationFile(QString absoluteFilePath);
127 
128  QString mToolFilePath;
129  QString mLoggingFolder;
130 
131  QDomDocument mToolDoc;
132  const QString mToolTag, mToolTypeTag, mToolIdTag, mToolNameTag, mToolDescriptionTag, mToolManufacturerTag,
133  mToolClinicalAppTag, mToolGeoFileTag, mToolPicFileTag, mToolDocFileTag, mToolInstrumentTag,
134  mToolInstrumentTypeTag, mToolInstrumentIdTag, mToolInstrumentNameTag,
135  mToolInstrumentManufacturerTag, mToolInstrumentScannerIdTag, mToolInstrumentDescriptionTag,
136  mToolSensorTag, mToolSensorTypeTag, mToolSensorIdTag, mToolSensorNameTag, mToolSensorWirelessTag,
137  mToolSensorDOFTag, mToolSensorPortnumberTag, mToolSensorChannelnumberTag,
138  mToolSensorReferencePointTag, mToolSensorManufacturerTag, mToolSensorDescriptionTag,
139  mToolSensorRomFileTag, mToolCalibrationTag, mToolCalibrationFileTag;
141 
142 };
143 }//namespace
144 
145 
146 #endif // CXTOOLFILEPARSER_H
QString mLoggingFolderName
path to where log should be saved
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.