NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxLandmark.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 
34 #ifndef CXLANDMARK_H_
35 #define CXLANDMARK_H_
36 
37 #include "cxResourceExport.h"
38 #include "cxPrecompiledHeader.h"
39 
40 #include <string>
41 #include <map>
42 #include <QObject>
43 #include <QDateTime>
44 #include "cxVector3D.h"
45 #include "boost/shared_ptr.hpp"
46 
47 class QDomNode;
48 
49 namespace cx
50 {
51 
52 
61 class cxResource_EXPORT Landmark
62 {
63 public:
64  explicit Landmark(QString uid = "", Vector3D coord = Vector3D(0, 0, 0));
65  ~Landmark();
66 
67  QString getUid() const;
68  Vector3D getCoord() const;
69  QDateTime getTimestamp() const;
70 
71  void addXml(QDomNode& dataNode) const;
72  void parseXml(QDomNode& dataNode);
73 
74 private:
75  QString mUid;
76  Vector3D mCoord;
77  QDateTime mTimestamp;
78 };
79 typedef std::map<QString, Landmark> LandmarkMap;
80 
81 cxResource_EXPORT bool operator<(const Landmark& lhs, const Landmark& rhs);
82 
83 typedef boost::shared_ptr<class Landmarks> LandmarksPtr;
86 class cxResource_EXPORT Landmarks : public QObject
87 {
88  Q_OBJECT
89 public:
90  static LandmarksPtr create();
91 
92  LandmarkMap getLandmarks();
93  void addXml(QDomNode dataNode) const;
94  void parseXml(QDomNode dataNode);
95  void clear();
96 
97 public slots:
98  void setLandmark(Landmark landmark);
99  void removeLandmark(QString uid);
100 
101 signals:
102  void landmarkRemoved(QString uid);
103  void landmarkAdded(QString uid);
104 
105 private:
106  Landmarks();
107  LandmarkMap mLandmarks;
108 };
109 
110 
111 class cxResource_EXPORT LandmarkProperty
112 {
113 public:
114  explicit LandmarkProperty(const QString& uid = "", const QString& name = "", bool active = true);
115  bool getActive() const;
116  QString getName() const;
117  QString getUid() const;
118  void setName(const QString& name);
119  void setActive(bool active);
120 
121  void addXml(QDomNode& dataNode);
122  void parseXml(QDomNode& dataNode);
123 
124 private:
125  QString mUid;
126  QString mName;
127  bool mActive;
128 };
129 typedef std::map<QString, LandmarkProperty> LandmarkPropertyMap;
130 
131 } //namespace cx
132 
133 #endif /* CXLANDMARK_H_ */
bool operator<(const Landmark &lhs, const Landmark &rhs)
Definition: cxLandmark.cpp:94
One landmark, or fiducial, coordinate.
Definition: cxLandmark.h:61
boost::shared_ptr< class Landmarks > LandmarksPtr
Definition: cxData.h:61
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
std::map< QString, class Landmark > LandmarkMap
std::map< QString, LandmarkProperty > LandmarkPropertyMap
Definition: cxLandmark.h:129