Fraxinus  18.10
An IGT application
cxRegistrationTransform.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 CXREGISTRATIONTRANSFORM_H_
14 #define CXREGISTRATIONTRANSFORM_H_
15 
16 #include "cxResourceExport.h"
17 #include "cxPrecompiledHeader.h"
18 
19 #include <string>
20 #include <vector>
21 #include <boost/shared_ptr.hpp>
22 #include <QObject>
23 #include <QDateTime>
24 
25 #include "cxTransform3D.h"
26 
27 class QDomNode;
28 
29 namespace cx
30 {
31 
39 class cxResource_EXPORT RegistrationTransform
40 {
41 public:
43  QDateTime mTimestamp;
44  QString mType;
45 
46  QString mFixed;
47  QString mMoving;
48  bool mTemp;
49 
51  explicit RegistrationTransform(const Transform3D& value, const QDateTime& timestamp = QDateTime(),
52  const QString& type = "", bool tempTransform = false);
53  void addXml(QDomNode& parentNode) const;
54  void parseXml(QDomNode& dataNode);
55 };
56 
57 cxResource_EXPORT bool operator<(const RegistrationTransform& lhs, const RegistrationTransform& rhs);
58 cxResource_EXPORT bool operator==(const RegistrationTransform& lhs, const RegistrationTransform& rhs);
59 
69 class cxResource_EXPORT ParentSpace
70 {
71 public:
72  QString mUid;
73  QDateTime mTimestamp;
74  QString mType;
75 
76  ParentSpace();
77  explicit
78  ParentSpace(const QString& parentFrame, const QDateTime& timestamp = QDateTime(), const QString& type = "");
79  void addXml(QDomNode& parentNode) const;
80  void parseXml(QDomNode& dataNode);
81 };
82 
83 cxResource_EXPORT bool operator<(const ParentSpace& lhs, const ParentSpace& rhs);
84 cxResource_EXPORT bool operator==(const ParentSpace& lhs, const ParentSpace& rhs);
85 
86 typedef boost::shared_ptr<class RegistrationHistory> RegistrationHistoryPtr;
87 
96 class cxResource_EXPORT RegistrationHistory: public QObject
97 {
98 Q_OBJECT
99 public:
100  virtual void addXml(QDomNode& parentNode) const;
101  virtual void parseXml(QDomNode& dataNode);
102 
103  virtual void setRegistration(const Transform3D& transform);
104  virtual void addOrUpdateRegistration(const QDateTime& oldTime, const RegistrationTransform& newTransform);
105 
106  virtual void setParentSpace(const QString& newParent);
107  virtual void addParentSpace(const QString& newParent);
108  virtual void updateParentSpace(const QDateTime& oldTime, const ParentSpace& newParent);
109 
110  virtual std::vector<RegistrationTransform> getData() const;
111  virtual std::vector<ParentSpace> getParentSpaces() const;
112  virtual void removeNewerThan(const QDateTime& timestamp);
113  virtual void setActiveTime(const QDateTime& timestamp);
114  virtual QDateTime getActiveTime() const;
115  virtual RegistrationTransform getCurrentRegistration() const;
116  virtual ParentSpace getCurrentParentSpace();
117  virtual void clear();
118 
119  virtual bool isNull() const
120  {
121  return false;
122  }
123  static RegistrationHistoryPtr getNullObject();
124 
125 signals:
126  void currentChanged();
127 private:
128  virtual void addParentSpace(const ParentSpace& newParent);
129  virtual void addRegistrationInternal(const RegistrationTransform& transform);
130  void setCache(const RegistrationTransform& val, const ParentSpace& parent, const QDateTime& timestamp);
131  static RegistrationHistoryPtr mNull;
132  std::vector<RegistrationTransform> mData;
133  std::vector<ParentSpace> mParentSpaces;
134  QDateTime mCurrentTime;
135  RegistrationTransform mTransformCache;
136  ParentSpace mParentSpaceCache;
137 };
138 
139 } // end namespace cx
140 
141 #endif /*CXREGISTRATIONTRANSFORM_H_*/
bool operator<(const Landmark &lhs, const Landmark &rhs)
Definition: cxLandmark.cpp:73
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:37
Definition of a parent space event.
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
QString mUid
parent frame uid
QDateTime mTimestamp
time the transform was registrated.
QDateTime mTimestamp
time the transform was registrated.
Transform3D mValue
value of transform
virtual bool isNull() const
QString mType
description of the kind if registration (manual, patient, landmark, coregistration etc) ...
QString mType
description of the kind if registration (manual, patient, landmark, coregistration etc) ...
A registration event and its transform.
bool operator==(const RegistrationTransform &lhs, const RegistrationTransform &rhs)
A history of registration events.
Namespace for all CustusX production code.