NorMIT-nav  22.09
An IGT application
cxViewGroupData.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 #ifndef CXVIEWGROUPDATA_H
12 #define CXVIEWGROUPDATA_H
13 
14 #include "cxResourceVisualizationExport.h"
15 
16 #include <vector>
17 #include <QVariant>
18 #include <QObject>
19 #include "cxDefinitions.h"
20 #include "vtkForwardDeclarations.h"
21 #include "cxForwardDeclarations.h"
22 #include "cxForwardDeclarations.h"
23 #include "cxPlaneTypeCollection.h"
24 #include "cxViewService.h"
25 class QDomNode;
26 
27 namespace cx
28 {
29 
30 typedef boost::shared_ptr<class CameraData> CameraDataPtr;
31 typedef boost::shared_ptr<class CoreServices> CoreServicesPtr;
32 typedef boost::shared_ptr<class VisServices> VisServicesPtr;
33 typedef boost::shared_ptr<class StringListProperty> StringListPropertyPtr;
34 
35 
41 struct cxResourceVisualization_EXPORT CameraStyleData
42 {
44  explicit CameraStyleData(CAMERA_STYLE_TYPE style);
45  void setCameraStyle(CAMERA_STYLE_TYPE style);
46  CAMERA_STYLE_TYPE getStyle();
47  void clear();
48  void addXml(QDomNode& dataNode);
49  void parseXml(QDomNode dataNode);
50 
56  bool mTableLock;
57  double mElevation;
58  bool mUniCam;
59  QString mCameraNotBehindROI; // never move camera behind this roi
60  QString mFocusROI; // name of ROI to set focus in.
61  QString mAutoZoomROI; // name of ROI to zoom to.
62 };
63 cxResourceVisualization_EXPORT bool operator==(const CameraStyleData& lhs, const CameraStyleData& rhs);
64 
68 cxResourceVisualization_EXPORT int getPriority(DataPtr data);
69 
72 cxResourceVisualization_EXPORT bool dataTypeSort(const DataPtr data1, const DataPtr data2);
73 
74 typedef boost::shared_ptr<class SyncedValue> SyncedValuePtr;
75 typedef boost::shared_ptr<class ViewGroupData> ViewGroupDataPtr;
76 
79 class cxResourceVisualization_EXPORT DataViewProperties
80 {
81 public:
82  DataViewProperties() : mVolume3D(false), mSlice3D(false), mSlice2D(false) {}
83  static DataViewProperties createDefault();
84  static DataViewProperties createFull();
85  static DataViewProperties createVolume3D();
86  static DataViewProperties createSlice3D();
87  static DataViewProperties createSlice2D();
88  static DataViewProperties create3D();
89  void addXml(QDomNode& dataNode);
90  void parseXml(QDomNode dataNode);
91  bool empty() const;
92  DataViewProperties addFlagsIn(DataViewProperties rhs) const;
93  DataViewProperties removeFlagsIn(DataViewProperties rhs) const;
94  bool containsAnyFlagsIn(DataViewProperties required) const;
95 
96  bool hasVolume3D() const { return mVolume3D; }
97  bool hasSlice3D() const { return mSlice3D; }
98  bool hasSlice2D() const { return mSlice2D; }
99 
100 private:
101  bool mVolume3D;
102  bool mSlice3D;
103  bool mSlice2D;
104 };
105 
108 class cxResourceVisualization_EXPORT ViewGroupData: public QObject
109 {
110 Q_OBJECT
111 
112 public:
113  explicit ViewGroupData(CoreServicesPtr services, QString uid);
114  void requestInitialize();
115  QString getUid() const { return mUid; }
116  std::vector<DataPtr> getData(DataViewProperties properties=DataViewProperties::createFull()) const;
117  QString getVideoSource() const;
118  void addData(QString uid);
119  void addDataSorted(QString uid);
120  void setVideoSource(QString uid);
121  bool removeData(QString uid);
122  void clearData();
123  std::vector<ImagePtr> getImages(DataViewProperties properties) const;
124  std::vector<MeshPtr> getMeshes(DataViewProperties properties) const;
125  std::vector<TrackedStreamPtr> getTrackedStreams(DataViewProperties properties) const;
126  std::vector<ImagePtr> getImagesAndChangingImagesFromTrackedStreams(DataViewProperties properties, bool include2D = false) const;
127  DataViewProperties getProperties(QString uid);
128  void setProperties(QString uid, DataViewProperties properties);
129 
130  void initializeGlobal2DZoom(SyncedValuePtr val);
131  SyncedValuePtr getGroup2DZoom();
132  SyncedValuePtr getGlobal2DZoom();
133 
134  CameraDataPtr getCamera3D() { return mCamera3D; }
135  void zoomCamera3D(int zoomFactor);
136 
137  PlaneTypeCollection getSliceDefinitions();
138  void setSliceDefinitions(PlaneTypeCollection val);
139  StringListPropertyPtr getSliceDefinitionProperty();
140 
141  ToolPtr getControllingTool();
142  void setControllingTool(ToolPtr tool);
143 
144  // view options for this group.
145  struct Options
146  {
147  Options();
152  };
153 
154  Options getOptions() const;
155  void setOptions(Options options);
156  void setRegistrationMode(REGISTRATION_STATUS mode);
157 
158  void addXml(QDomNode& dataNode);
159  void parseXml(QDomNode dataNode);
160 
161 private slots:
162  void purgeDataNotExistingInPatientModelService();
163 
164 signals:
165  void dataViewPropertiesChanged(QString uid);
166  void videoSourceChanged(QString uid);
167  void initialized();
168  void optionsChanged();
169  void controllingToolChanged();
170 
171 private:
172  typedef std::pair<QString, DataViewProperties> DataAndViewPropertiesPair;
173 
174  struct data_equals
175  {
176  data_equals(QString uid) : mData(uid) {}
177  bool operator()(const DataAndViewPropertiesPair& right)
178  {
179  return mData == right.first;
180  }
181  QString mData;
182  };
183 
184  template<class DATA_TYPE>
185  std::vector<boost::shared_ptr<DATA_TYPE> > getDataOfType(DataViewProperties requiredProperties) const;
186  bool contains(QString uid) const;
187  void createSliceDefinitionProperty();
188  void insertData(std::vector<DataAndViewPropertiesPair>::iterator iter, DataAndViewPropertiesPair &item);
189 
190  QString mUid;
191  CoreServicesPtr mServices;
192  QString mVideoSource;
193  std::vector<DataAndViewPropertiesPair> mData;
194  CameraDataPtr mCamera3D;
195  Options mOptions;
196  SyncedValuePtr mGroup2DZoom;
197  SyncedValuePtr mGlobal2DZoom;
198  StringListPropertyPtr mSliceDefinitionProperty;
199  DataPtr getData(QString uid) const;
200  //SharedOpenGLContextPtr mSharedOpenGLContext;
201  ToolPtr mControllingTool;
202 
203 };
204 
205 
209 } //namespace cx
210 
211 #endif // CXVIEWGROUPDATA_H
cx::CameraStyleData::mElevation
double mElevation
Definition: cxViewGroupData.h:57
cx::PlaneTypeCollection
Definition: cxPlaneTypeCollection.h:29
cx::ViewGroupData::Options::mShowLandmarks
bool mShowLandmarks
Definition: cxViewGroupData.h:148
cx::ViewGroupData::Options::mShowPointPickerProbe
bool mShowPointPickerProbe
Definition: cxViewGroupData.h:149
cx::ViewGroupDataPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
cx::CameraDataPtr
boost::shared_ptr< class CameraData > CameraDataPtr
Definition: cxViewWrapper.h:36
cx::CameraStyleData::mUniCam
bool mUniCam
Definition: cxViewGroupData.h:58
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ViewGroupData::getUid
QString getUid() const
Definition: cxViewGroupData.h:115
cx::CameraStyleData::mAutoZoomROI
QString mAutoZoomROI
Definition: cxViewGroupData.h:61
cxForwardDeclarations.h
cx::CameraStyleData::mTableLock
bool mTableLock
Definition: cxViewGroupData.h:56
cx::dataTypeSort
bool dataTypeSort(const DataPtr data1, const DataPtr data2)
Definition: cxViewGroupData.cpp:257
cx::CameraStyleData::mCameraTooltipOffset
double mCameraTooltipOffset
Definition: cxViewGroupData.h:55
cxDefinitions.h
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cx::CameraStyleData::mFocusFollowTool
bool mFocusFollowTool
Definition: cxViewGroupData.h:53
cx::CameraStyleData::mCameraViewAngle
double mCameraViewAngle
Definition: cxViewGroupData.h:51
cx::ViewGroupData::Options::mCameraStyle
CameraStyleData mCameraStyle
Definition: cxViewGroupData.h:151
cx::DataViewProperties::DataViewProperties
DataViewProperties()
Definition: cxViewGroupData.h:82
cx::ViewGroupData::Options::mPickerGlyph
MeshPtr mPickerGlyph
Definition: cxViewGroupData.h:150
cx::DataViewProperties::hasSlice3D
bool hasSlice3D() const
Definition: cxViewGroupData.h:97
cx::ViewGroupData::Options
Definition: cxViewGroupData.h:145
cx::MeshPtr
boost::shared_ptr< class Mesh > MeshPtr
Definition: cxForwardDeclarations.h:48
cxViewService.h
cx::DataViewProperties::hasSlice2D
bool hasSlice2D() const
Definition: cxViewGroupData.h:98
cx::CoreServicesPtr
boost::shared_ptr< class CoreServices > CoreServicesPtr
Definition: cxCameraStyle.h:37
cx::CameraStyleData::mCameraLockToTooltip
bool mCameraLockToTooltip
Definition: cxViewGroupData.h:54
cx::CameraStyleData::mFocusROI
QString mFocusROI
Definition: cxViewGroupData.h:60
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cx::DataViewProperties
Definition: cxViewGroupData.h:79
cxPlaneTypeCollection.h
cx::CameraStyleData
Definition: cxViewGroupData.h:41
vtkForwardDeclarations.h
cx::DataViewProperties::createFull
static DataViewProperties createFull()
Definition: cxViewGroupData.cpp:158
cx::ViewGroupData::getCamera3D
CameraDataPtr getCamera3D()
Definition: cxViewGroupData.h:134
cx::StringListPropertyPtr
boost::shared_ptr< class StringListProperty > StringListPropertyPtr
Definition: cxTreeItemModel.h:21
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cx::operator==
bool operator==(const RegistrationTransform &lhs, const RegistrationTransform &rhs)
Definition: cxRegistrationTransform.cpp:151
cx::SyncedValuePtr
boost::shared_ptr< class SyncedValue > SyncedValuePtr
Definition: cxViewGroup.h:30
cx::CameraStyleData::mCameraNotBehindROI
QString mCameraNotBehindROI
Definition: cxViewGroupData.h:59
cx::DataViewProperties::hasVolume3D
bool hasVolume3D() const
Definition: cxViewGroupData.h:96
cx::ViewGroupData
Container for data shared between all members of a view group.
Definition: cxViewGroupData.h:108
cx::CameraStyleData::mCameraFollowTool
bool mCameraFollowTool
Definition: cxViewGroupData.h:52
cx::getPriority
int getPriority(DataPtr data)
Definition: cxViewGroupData.cpp:262