Fraxinus  16.5.0-fx-rc9
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 
142  virtual void addXml(QDomNode& dataNode);
143  virtual void parseXml(QDomNode& dataNode);
144 
145  //Consider removing this, as these are only implemented in Mesh and Image
146  virtual bool load(QString path) = 0;
147  virtual void save(const QString& basePath) = 0;
148 
149  virtual CoordinateSystem getCoordinateSystem();
150 
151  //Moved from Image
152  // methods for defining and storing clip planes. Data does not use these data, this is up to the mapper
153  virtual void addPersistentClipPlane(vtkPlanePtr plane);
154  virtual std::vector<vtkPlanePtr> getAllClipPlanes();
155  virtual void clearPersistentClipPlanes();
156  virtual void setInteractiveClipPlane(vtkPlanePtr plane);
157 
158  void addInteractiveClipPlane(vtkPlanePtr plane);
159  void removeInteractiveClipPlane(vtkPlanePtr plane);
160 signals:
161  void transformChanged();
162  void propertiesChanged();
163  void clipPlanesChanged();
164 
165 protected slots:
166  virtual void transformChangedSlot()
167  {
168  }
169 
170 protected:
171  QString mUid;
172  QString mName;
173  QString mFilename;
176 
177  REGISTRATION_STATUS mRegistrationStatus;
179  std::vector<vtkPlanePtr> mPersistentClipPlanes;
180  std::vector<vtkPlanePtr> mInteractiveClipPlanes;
182 
183 private:
184  Data(const Data& other);
185  Data& operator=(const Data& other);
186 
187  void addPlane(vtkPlanePtr plane, std::vector<vtkPlanePtr> &planes);
188 };
189 
190 typedef boost::shared_ptr<Data> DataPtr;
191 
192 } // end namespace cx
193 
194 #endif /*CXDATA_H_*/
std::vector< vtkPlanePtr > mInteractiveClipPlanes
Definition: cxData.h:180
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:57
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:171
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
QString mName
Definition: cxData.h:172
TimeInfo mTimeInfo
Definition: cxData.h:174
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:173
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:181
QDateTime mAcquisitionTime
Possibly modified time stamp.
Definition: cxData.h:65
RegistrationHistoryPtr m_rMd_History
Definition: cxData.h:178
Superclass for all data objects.
Definition: cxData.h:109
virtual void transformChangedSlot()
Definition: cxData.h:166
TimeInfo(double acquisitionTime)
Definition: cxData.h:75
REGISTRATION_STATUS mRegistrationStatus
Definition: cxData.h:177
LandmarksPtr mLandmarks
Definition: cxData.h:175
vtkSmartPointer< class vtkPlane > vtkPlanePtr
std::vector< vtkPlanePtr > mPersistentClipPlanes
Definition: cxData.h:179