NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProbeXmlConfigParser.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 PROBEXMLCONFIGPARSER_H_
34 #define PROBEXMLCONFIGPARSER_H_
35 
36 #include "cxResourceExport.h"
37 
38 #include <math.h>
39 #include <vector>
40 #include <boost/shared_ptr.hpp>
41 #include <QDomDocument>
42 #include "cxXmlOptionItem.h"
43 
52 class cxResource_EXPORT ProbeXmlConfigParser
53 {
54 public:
55  typedef std::pair<double,double> ColRowPair;
56  struct Configuration
57  {
58  QString mUsScanner;
59  QString mUsProbe;
60  QString mRtSource;
61  QString mConfigId;
62  QString mName;
65  double mWidthDeg;
66  double mDepth;
67  double mOffset;
68  double mOriginCol;
69  double mOriginRow;
70  int mNCorners;
71  std::vector<ColRowPair> mCorners;
72  int mLeftEdge;
73  int mRightEdge;
74  int mTopEdge;
76  double mPixelWidth;
77  double mPixelHeight;
79  QString mNotes;
81 // int mColumns; ///< X dim
82 // int mRows; ///< Y dim
83 
84  bool mEmpty;
85 
87  mConfigId(""),
88  mImageWidth(0),
89  mImageHeight(0),
90  mWidthDeg(0),
91  mDepth(0),
92  mOffset(0),
93  mOriginCol(0),
94  mOriginRow(0),
95  mNCorners(0),
96  mLeftEdge(0),
97  mRightEdge(0),
98  mTopEdge(0),
99  mBottomEdge(0),
100  mPixelWidth(0),
101  mPixelHeight(0),
102  mHorizontalOffset(0),
103  mTemporalCalibration(0),
104  mEmpty(true)
105  {};
106  bool isEmpty(){return mEmpty;};
107  };
108 
109  //ProbeXmlConfigParser(QString& pathToXml) {}; ///< opens the file and reads it onto the QDomDocument
110  //~ProbeXmlConfigParser() {};
111  virtual QString getFileName() = 0;
112  virtual void removeConfig(QString scanner, QString probe, QString rtsource, QString configId) = 0;
113  virtual void saveCurrentConfig(Configuration config) = 0;
114  virtual QStringList getScannerList() = 0;
115  virtual QStringList getProbeList(QString scanner) = 0;
116  virtual QStringList getRtSourceList(QString scanner, QString probe) = 0;
117  virtual QStringList getConfigIdList(QString scanner, QString probe, QString rtSource) = 0;
118  virtual Configuration getConfiguration(QString scanner, QString probe, QString rtsource, QString configId) = 0;
119 
120 };
121 typedef boost::shared_ptr<ProbeXmlConfigParser> ProbeXmlConfigParserPtr;
122 
123 #endif /* PROBEXMLCONFIGPARSER_H_ */
< a easy-to-work-with struct for a specific xml configuration
Class that works as a interface to a ProbeCalibConfigs.xml.
int mHorizontalOffset
parameter for the grabber
std::vector< ColRowPair > mCorners
corners <col,row>
boost::shared_ptr< ProbeXmlConfigParser > ProbeXmlConfigParserPtr
std::pair< double, double > ColRowPair
int mImageWidth
Width of the used image format (x dim)
int mImageHeight
Height of the used image format (y dim)
double mTemporalCalibration
delay in timestamping in grabber source relative to master clock.
QString mName
Name of config set.