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