NorMIT-nav  22.09
An IGT application
cxData.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 CXDATA_H_
14 #define CXDATA_H_
15 
16 #include "cxResourceExport.h"
17 #include "cxPrecompiledHeader.h"
18 
19 #include <string>
20 #include <set>
21 
22 #include <boost/shared_ptr.hpp>
23 #include <boost/weak_ptr.hpp>
24 
25 #include <QObject>
26 #include <QIcon>
27 #include "vtkForwardDeclarations.h"
28 #include "cxTransform3D.h"
29 #include "cxForwardDeclarations.h"
30 #include "cxDefinitions.h"
31 
32 #include <QDateTime>
33 
34 class QDomNode;
35 
36 namespace cx
37 {
39 typedef boost::weak_ptr<class Rep> RepWeakPtr;
40 typedef boost::shared_ptr<class RegistrationHistory> RegistrationHistoryPtr;
41 typedef boost::shared_ptr<class Landmarks> LandmarksPtr;
42 
43 struct cxResource_EXPORT TimeInfo
44 {
45  QDateTime mAcquisitionTime;
48 
50  mAcquisitionTime(QDateTime()),
51  mSoftwareAcquisitionTime(QDateTime()),
52  mOriginalAcquisitionTime(QDateTime())
53  {
54  }
55  TimeInfo(double acquisitionTime) :
56  mSoftwareAcquisitionTime(QDateTime()),
57  mOriginalAcquisitionTime(QDateTime())
58  {
59  this->setAcquisitionTime(acquisitionTime);
60  }
61 
62  double getAcquisitionTime() const
63  {
64  return mAcquisitionTime.toMSecsSinceEpoch();
65  }
66  void setAcquisitionTime(double mSecsSinceEpoch)
67  {
68  mAcquisitionTime.setMSecsSinceEpoch(mSecsSinceEpoch);
69  }
70 
72  {
73  return mSoftwareAcquisitionTime.toMSecsSinceEpoch();
74  }
76  {
77  return mOriginalAcquisitionTime.toMSecsSinceEpoch();
78  }
79 
80 };
81 
82 
89 class cxResource_EXPORT Data: public QObject
90 {
91 Q_OBJECT
92 public:
93  Data(const QString& uid, const QString& name = "");
94  virtual ~Data();
95 
96  void setUid(const QString& uid);
97  void setName(const QString& name);
98  void setAcquisitionTime(QDateTime time);
99  void setSoftwareAcquisitionTime(QDateTime time);
100  void setOriginalAcquisitionTime(QDateTime time);
101  virtual RegistrationHistoryPtr get_rMd_History();
102  LandmarksPtr getLandmarks();
103 
104  virtual QString getUid() const;
105  virtual QString getName() const;
106  virtual Transform3D get_rMd() const;
107  virtual QDateTime getAcquisitionTime() const;
108  virtual TimeInfo getAdvancedTimeInfo() const;
109  virtual QString getType() const
110  {
111  return "data";
112  }
113  virtual QIcon getIcon() {return QIcon();}
114  virtual bool isEqual(DataPtr metric);
115 
116  virtual QString getFilename() const;
117  virtual void setFilename(QString val);
118 
119  virtual QString getSpace();
120  virtual QString getParentSpace();
121  virtual DoubleBoundingBox3D boundingBox() const = 0;
122  virtual std::vector<Vector3D> getPointCloud() const; // get a point cloud spanning volume occupied by data, in data space.
123 
124  virtual void addXml(QDomNode& dataNode);
125  virtual void parseXml(QDomNode& dataNode);
126 
127  //Consider removing this, as these are only implemented in Mesh and Image
128  virtual bool load(QString path, FileManagerServicePtr port) = 0;
129  virtual void save(const QString& basePath, FileManagerServicePtr port) = 0;
130 
131  virtual CoordinateSystem getCoordinateSystem();
132 
133  //Moved from Image
134  // methods for defining and storing clip planes. Data does not use these data, this is up to the mapper
135  virtual void addPersistentClipPlane(vtkPlanePtr plane);
136  virtual std::vector<vtkPlanePtr> getAllClipPlanes();
137  virtual void clearPersistentClipPlanes();
138  virtual void setInteractiveClipPlane(vtkPlanePtr plane);
139 
140  void addInteractiveClipPlane(vtkPlanePtr plane);
141  void removeInteractiveClipPlane(vtkPlanePtr plane);
142 signals:
143  void transformChanged();
144  void propertiesChanged();
145  void clipPlanesChanged();
146 
147 protected slots:
148  virtual void transformChangedSlot()
149  {
150  }
151 
152 protected:
153  QString mUid;
154  QString mName;
155  QString mFilename;
158 
159  REGISTRATION_STATUS mRegistrationStatus;
161  std::vector<vtkPlanePtr> mPersistentClipPlanes;
162  std::vector<vtkPlanePtr> mInteractiveClipPlanes;
164 
165 private:
166  Data(const Data& other);
167  Data& operator=(const Data& other);
168 
169  void addPlane(vtkPlanePtr plane, std::vector<vtkPlanePtr> &planes);
170 };
171 
172 typedef boost::shared_ptr<Data> DataPtr;
173 
174 } // end namespace cx
175 
176 #endif /*CXDATA_H_*/
cx::Data::getType
virtual QString getType() const
Definition: cxData.h:109
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxPrecompiledHeader.h
cxForwardDeclarations.h
cxDefinitions.h
cx::TimeInfo::TimeInfo
TimeInfo()
Definition: cxData.h:49
cx::FileManagerServicePtr
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
Definition: cxLogicManager.h:31
cx::Data::mRegistrationStatus
REGISTRATION_STATUS mRegistrationStatus
Definition: cxData.h:159
cx::TimeInfo::getAcquisitionTime
double getAcquisitionTime() const
Definition: cxData.h:62
cx::Data::mPersistentClipPlanes
std::vector< vtkPlanePtr > mPersistentClipPlanes
Definition: cxData.h:161
cx::Data::mInteractiveClipPlanes
std::vector< vtkPlanePtr > mInteractiveClipPlanes
Definition: cxData.h:162
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::TimeInfo
Definition: cxData.h:43
cx::Data::mUid
QString mUid
Definition: cxData.h:153
cx::Data::mFilename
QString mFilename
Definition: cxData.h:155
cx::Data::m_rMd_History
RegistrationHistoryPtr m_rMd_History
Definition: cxData.h:160
cx::Data::mInteractiveClipPlane
vtkPlanePtr mInteractiveClipPlane
Definition: cxData.h:163
cx::RegistrationHistoryPtr
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:37
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
vtkForwardDeclarations.h
cx::TimeInfo::mAcquisitionTime
QDateTime mAcquisitionTime
Possibly modified time stamp.
Definition: cxData.h:45
vtkPlanePtr
vtkSmartPointer< class vtkPlane > vtkPlanePtr
Definition: cxProbeSector.cpp:33
cx::TimeInfo::getScannerAcquisitionTime
double getScannerAcquisitionTime() const
Definition: cxData.h:75
cx::Data::getIcon
virtual QIcon getIcon()
Definition: cxData.h:113
cx::TimeInfo::setAcquisitionTime
void setAcquisitionTime(double mSecsSinceEpoch)
Definition: cxData.h:66
cx::TimeInfo::TimeInfo
TimeInfo(double acquisitionTime)
Definition: cxData.h:55
cx::LandmarksPtr
boost::shared_ptr< class Landmarks > LandmarksPtr
Definition: cxData.h:41
cx::TimeInfo::mSoftwareAcquisitionTime
QDateTime mSoftwareAcquisitionTime
Time stamp created in at arrival in CX or CX related software.
Definition: cxData.h:46
cx::Data::mTimeInfo
TimeInfo mTimeInfo
Definition: cxData.h:156
cx::Data::mName
QString mName
Definition: cxData.h:154
cx::Data
Superclass for all data objects.
Definition: cxData.h:89
cx::Data::mLandmarks
LandmarksPtr mLandmarks
Definition: cxData.h:157
cxTransform3D.h
cx::RepWeakPtr
boost::weak_ptr< class Rep > RepWeakPtr
Definition: cxData.h:38
cx::Data::transformChangedSlot
virtual void transformChangedSlot()
Definition: cxData.h:148
cx::TimeInfo::getSoftwareAcquisitionTime
double getSoftwareAcquisitionTime() const
Definition: cxData.h:71
cx::CoordinateSystem
Identification of a Coordinate system.
Definition: cxCoordinateSystemHelpers.h:31
cx::TimeInfo::mOriginalAcquisitionTime
QDateTime mOriginalAcquisitionTime
Original aquisition time (from hardware if possible)
Definition: cxData.h:47