CustusX  20.03-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 
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;
157  LandmarksPtr mLandmarks;
158 
159  REGISTRATION_STATUS mRegistrationStatus;
160  RegistrationHistoryPtr m_rMd_History;
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_*/
std::vector< vtkPlanePtr > mInteractiveClipPlanes
Definition: cxData.h:162
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:37
TimeInfo()
Definition: cxData.h:49
QDateTime mOriginalAcquisitionTime
Original aquisition time (from hardware if possible)
Definition: cxData.h:47
double getSoftwareAcquisitionTime() const
Definition: cxData.h:71
QString mUid
Definition: cxData.h:153
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
QString mName
Definition: cxData.h:154
TimeInfo mTimeInfo
Definition: cxData.h:156
virtual QIcon getIcon()
Definition: cxData.h:113
boost::weak_ptr< class Rep > RepWeakPtr
Definition: cxData.h:38
boost::shared_ptr< class Landmarks > LandmarksPtr
Definition: cxData.h:41
boost::shared_ptr< class Data > DataPtr
QString mFilename
Definition: cxData.h:155
double getScannerAcquisitionTime() const
Definition: cxData.h:75
void setAcquisitionTime(double mSecsSinceEpoch)
Definition: cxData.h:66
virtual QString getType() const
Definition: cxData.h:109
double getAcquisitionTime() const
Definition: cxData.h:62
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:46
vtkPlanePtr mInteractiveClipPlane
Definition: cxData.h:163
QDateTime mAcquisitionTime
Possibly modified time stamp.
Definition: cxData.h:45
RegistrationHistoryPtr m_rMd_History
Definition: cxData.h:160
Superclass for all data objects.
Definition: cxData.h:89
virtual void transformChangedSlot()
Definition: cxData.h:148
TimeInfo(double acquisitionTime)
Definition: cxData.h:55
REGISTRATION_STATUS mRegistrationStatus
Definition: cxData.h:159
LandmarksPtr mLandmarks
Definition: cxData.h:157
vtkSmartPointer< class vtkPlane > vtkPlanePtr
Namespace for all CustusX production code.
std::vector< vtkPlanePtr > mPersistentClipPlanes
Definition: cxData.h:161