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