CustusX  2023.01.05-dev+develop.0da12
An IGT application
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) 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 
13 #ifndef CXLANDMARK_H_
14 #define CXLANDMARK_H_
15 
16 #include "cxResourceExport.h"
17 #include "cxPrecompiledHeader.h"
18 
19 #include <string>
20 #include <map>
21 #include <QObject>
22 #include <QDateTime>
23 #include "cxVector3D.h"
24 #include "boost/shared_ptr.hpp"
25 
26 class QDomNode;
27 
28 namespace cx
29 {
30 
31 
40 class cxResource_EXPORT Landmark
41 {
42 public:
43  explicit Landmark(QString uid = "", Vector3D coord = Vector3D(0, 0, 0));
44  ~Landmark();
45 
46  QString getUid() const;
47  Vector3D getCoord() const;
48  QDateTime getTimestamp() const;
49 
50  void addXml(QDomNode& dataNode) const;
51  void parseXml(QDomNode& dataNode);
52 
53 private:
54  QString mUid;
55  Vector3D mCoord;
56  QDateTime mTimestamp;
57 };
58 typedef std::map<QString, Landmark> LandmarkMap;
59 
60 cxResource_EXPORT bool operator<(const Landmark& lhs, const Landmark& rhs);
61 
62 typedef boost::shared_ptr<class Landmarks> LandmarksPtr;
65 class cxResource_EXPORT Landmarks : public QObject
66 {
67  Q_OBJECT
68 public:
69  static LandmarksPtr create();
70 
71  LandmarkMap getLandmarks();
72  void addXml(QDomNode dataNode) const;
73  void parseXml(QDomNode dataNode);
74  void clear();
75 
76 public slots:
77  void setLandmark(Landmark landmark);
78  void removeLandmark(QString uid);
79 
80 signals:
81  void landmarkRemoved(QString uid);
82  void landmarkAdded(QString uid);
83 
84 private:
85  Landmarks();
86  LandmarkMap mLandmarks;
87 };
88 
89 
90 class cxResource_EXPORT LandmarkProperty
91 {
92 public:
93  explicit LandmarkProperty(const QString& uid = "", const QString& name = "", bool active = true);
94  bool getActive() const;
95  QString getName() const;
96  QString getUid() const;
97  void setName(const QString& name);
98  void setActive(bool active);
99 
100  void addXml(QDomNode& dataNode);
101  void parseXml(QDomNode& dataNode);
102 
103 private:
104  QString mUid;
105  QString mName;
106  bool mActive;
107 };
108 typedef std::map<QString, LandmarkProperty> LandmarkPropertyMap;
109 
110 } //namespace cx
111 
112 #endif /* CXLANDMARK_H_ */
bool operator<(const Landmark &lhs, const Landmark &rhs)
Definition: cxLandmark.cpp:73
One landmark, or fiducial, coordinate.
Definition: cxLandmark.h:40
boost::shared_ptr< class Landmarks > LandmarksPtr
Definition: cxData.h:41
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
std::map< QString, class Landmark > LandmarkMap
std::map< QString, LandmarkProperty > LandmarkPropertyMap
Definition: cxLandmark.h:108
Namespace for all CustusX production code.