CustusX  16.12
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 
34 #ifndef CXDATA_H_
35 #define CXDATA_H_
36 
37 #include "cxResourceExport.h"
38 #include "cxPrecompiledHeader.h"
39 
40 #include <string>
41 #include <set>
42 
43 #include <boost/shared_ptr.hpp>
44 #include <boost/weak_ptr.hpp>
45 
46 #include <QObject>
47 #include <QIcon>
48 #include "vtkForwardDeclarations.h"
49 #include "cxTransform3D.h"
50 #include "cxForwardDeclarations.h"
51 #include "cxDefinitions.h"
52 
53 #include <QDateTime>
54 class QDomNode;
55 
56 namespace cx
57 {
59 typedef boost::weak_ptr<class Rep> RepWeakPtr;
60 typedef boost::shared_ptr<class RegistrationHistory> RegistrationHistoryPtr;
61 typedef boost::shared_ptr<class Landmarks> LandmarksPtr;
62 
63 struct cxResource_EXPORT TimeInfo
64 {
65  QDateTime mAcquisitionTime;
68 
70  mAcquisitionTime(QDateTime()),
71  mSoftwareAcquisitionTime(QDateTime()),
72  mOriginalAcquisitionTime(QDateTime())
73  {
74  }
75  TimeInfo(double acquisitionTime) :
76  mSoftwareAcquisitionTime(QDateTime()),
77  mOriginalAcquisitionTime(QDateTime())
78  {
79  this->setAcquisitionTime(acquisitionTime);
80  }
81 
82  double getAcquisitionTime() const
83  {
84  return mAcquisitionTime.toMSecsSinceEpoch();
85  }
86  void setAcquisitionTime(double mSecsSinceEpoch)
87  {
88  mAcquisitionTime.setMSecsSinceEpoch(mSecsSinceEpoch);
89  }
90 
92  {
93  return mSoftwareAcquisitionTime.toMSecsSinceEpoch();
94  }
96  {
97  return mOriginalAcquisitionTime.toMSecsSinceEpoch();
98  }
99 
100 };
101 
102 
109 class cxResource_EXPORT Data: public QObject
110 {
111 Q_OBJECT
112 public:
113  Data(const QString& uid, const QString& name = "");
114  virtual ~Data();
115 
116  void setUid(const QString& uid);
117  void setName(const QString& name);
118  void setAcquisitionTime(QDateTime time);
119  void setSoftwareAcquisitionTime(QDateTime time);
120  void setOriginalAcquisitionTime(QDateTime time);
121  virtual RegistrationHistoryPtr get_rMd_History();
122  LandmarksPtr getLandmarks();
123 
124  virtual QString getUid() const;
125  virtual QString getName() const;
126  virtual Transform3D get_rMd() const;
127  virtual QDateTime getAcquisitionTime() const;
128  virtual TimeInfo getAdvancedTimeInfo() const;
129  virtual QString getType() const
130  {
131  return "data";
132  }
133  virtual QIcon getIcon() {return QIcon();}
134 
135  virtual QString getFilename() const;
136  virtual void setFilename(QString val);
137 
138  virtual QString getSpace();
139  virtual QString getParentSpace();
140  virtual DoubleBoundingBox3D boundingBox() const = 0;
141  virtual std::vector<Vector3D> getPointCloud() const; // get a point cloud spanning volume occupied by data, in data space.
142 
143  virtual void addXml(QDomNode& dataNode);
144  virtual void parseXml(QDomNode& dataNode);
145 
146  //Consider removing this, as these are only implemented in Mesh and Image
147  virtual bool load(QString path) = 0;
148  virtual void save(const QString& basePath) = 0;
149 
150  virtual CoordinateSystem getCoordinateSystem();
151 
152  //Moved from Image
153  // methods for defining and storing clip planes. Data does not use these data, this is up to the mapper
154  virtual void addPersistentClipPlane(vtkPlanePtr plane);
155  virtual std::vector<vtkPlanePtr> getAllClipPlanes();
156  virtual void clearPersistentClipPlanes();
157  virtual void setInteractiveClipPlane(vtkPlanePtr plane);
158 
159  void addInteractiveClipPlane(vtkPlanePtr plane);
160  void removeInteractiveClipPlane(vtkPlanePtr plane);
161 signals:
162  void transformChanged();
163  void propertiesChanged();
164  void clipPlanesChanged();
165 
166 protected slots:
167  virtual void transformChangedSlot()
168  {
169  }
170 
171 protected:
172  QString mUid;
173  QString mName;
174  QString mFilename;
177 
178  REGISTRATION_STATUS mRegistrationStatus;
180  std::vector<vtkPlanePtr> mPersistentClipPlanes;
181  std::vector<vtkPlanePtr> mInteractiveClipPlanes;
183 
184 private:
185  Data(const Data& other);
186  Data& operator=(const Data& other);
187 
188  void addPlane(vtkPlanePtr plane, std::vector<vtkPlanePtr> &planes);
189 };
190 
191 typedef boost::shared_ptr<Data> DataPtr;
192 
193 } // end namespace cx
194 
195 #endif /*CXDATA_H_*/
std::vector< vtkPlanePtr > mInteractiveClipPlanes
Definition: cxData.h:181
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:58
TimeInfo()
Definition: cxData.h:69
QDateTime mOriginalAcquisitionTime
Original aquisition time (from hardware if possible)
Definition: cxData.h:67
double getSoftwareAcquisitionTime() const
Definition: cxData.h:91
QString mUid
Definition: cxData.h:172
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
QString mName
Definition: cxData.h:173
TimeInfo mTimeInfo
Definition: cxData.h:175
virtual QIcon getIcon()
Definition: cxData.h:133
boost::weak_ptr< class Rep > RepWeakPtr
Definition: cxData.h:58
boost::shared_ptr< class Landmarks > LandmarksPtr
Definition: cxData.h:61
boost::shared_ptr< class Data > DataPtr
QString mFilename
Definition: cxData.h:174
double getScannerAcquisitionTime() const
Definition: cxData.h:95
void setAcquisitionTime(double mSecsSinceEpoch)
Definition: cxData.h:86
virtual QString getType() const
Definition: cxData.h:129
double getAcquisitionTime() const
Definition: cxData.h:82
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:66
vtkPlanePtr mInteractiveClipPlane
Definition: cxData.h:182
QDateTime mAcquisitionTime
Possibly modified time stamp.
Definition: cxData.h:65
RegistrationHistoryPtr m_rMd_History
Definition: cxData.h:179
Superclass for all data objects.
Definition: cxData.h:109
virtual void transformChangedSlot()
Definition: cxData.h:167
TimeInfo(double acquisitionTime)
Definition: cxData.h:75
REGISTRATION_STATUS mRegistrationStatus
Definition: cxData.h:178
LandmarksPtr mLandmarks
Definition: cxData.h:176
vtkSmartPointer< class vtkPlane > vtkPlanePtr
std::vector< vtkPlanePtr > mPersistentClipPlanes
Definition: cxData.h:180