CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxDataMetricWrappers.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 CXDATAMETRICWRAPPERS_H_
12 #define CXDATAMETRICWRAPPERS_H_
13 
14 #include "cxGuiExport.h"
15 
16 #include <vector>
17 #include <QtWidgets>
18 
19 #include "cxForwardDeclarations.h"
20 #include "cxLandmark.h"
21 #include "cxPointMetric.h"
22 #include "cxDistanceMetric.h"
23 #include "cxAngleMetric.h"
24 #include "cxPlaneMetric.h"
25 #include "cxSphereMetric.h"
27 #include "cxShapedMetric.h"
28 #include "cxCustomMetric.h"
29 #include "cxStringProperty.h"
30 #include "cxVector3DProperty.h"
31 #include "cxColorProperty.h"
32 #include "cxDoubleProperty.h"
33 #include "cxSpaceProperty.h"
34 #include "cxFilePathProperty.h"
35 #include "cxStringListProperty.h"
37 
38 class QVBoxLayout;
39 class QTableWidget;
40 class QPushButton;
41 
42 namespace cx
43 {
44 
51 typedef boost::shared_ptr<class MetricBase> MetricBasePtr;
52 
53 class cxGui_EXPORT MetricBase : public QObject
54 {
55  Q_OBJECT
56 public:
57  MetricBase(VisServicesPtr services);
58  virtual ~MetricBase() {}
59  virtual QWidget* createWidget() = 0;
60  virtual QString getValue() const;
61  virtual DataMetricPtr getData() const = 0;
62  virtual QString getArguments() const = 0;
63  virtual QString getType() const = 0;
64  virtual void update() = 0;
65 
66 private slots:
67  void colorSelected();
68 protected:
70  void addColorWidget(QVBoxLayout* layout);
71  QWidget* newWidget(QString objectName);
73 
74 };
75 
79 class cxGui_EXPORT MetricReferenceArgumentListGui : public QObject
80 {
81  Q_OBJECT
82 public:
84  void setArguments(MetricReferenceArgumentListPtr arguments);
85  void addWidgets(QBoxLayout* layout);
86  QString getAsString() const;
87  void update();
88 //public:
89 // void argumentsChanged();
90 private slots:
91  void pointSelected();
92  void dataChangedSlot();
93 private:
95  std::vector<StringPropertyPtr> mPSelector;
96  bool mInternalUpdate;
97  bool mModified;
98  VisServicesPtr mServices;
99 
100  void getAvailableArgumentMetrics(QStringList* uid, std::map<QString,QString>* namemap);
101 };
102 
103 class cxGui_EXPORT PointMetricWrapper : public MetricBase
104 {
105  Q_OBJECT
106 public:
107  explicit PointMetricWrapper(VisServicesPtr services, PointMetricPtr data);
108  virtual ~PointMetricWrapper();
109  virtual QWidget* createWidget();
110  virtual DataMetricPtr getData() const;
111  virtual QString getArguments() const;
112  virtual QString getType() const;
113  virtual void update();
114 
115 private slots:
116  void moveToToolPosition();
117  void spaceSelected();
118  void coordinateChanged();
119 // void dataChangedSlot();
120 private:
121  QWidget* createSampleButton(QWidget* parent) const;
122  SpacePropertyPtr createSpaceSelector() const;
123  Vector3DPropertyPtr createCoordinateSelector() const;
124  PointMetricPtr mData;
125  SpacePropertyPtr mSpaceSelector;
126  Vector3DPropertyPtr mCoordinate;
127  bool mInternalUpdate;
128 };
129 
130 class cxGui_EXPORT PlaneMetricWrapper : public MetricBase
131 {
132  Q_OBJECT
133 public:
134  explicit PlaneMetricWrapper(VisServicesPtr services, PlaneMetricPtr data);
135  virtual ~PlaneMetricWrapper();
136  virtual QWidget* createWidget();
137  virtual DataMetricPtr getData() const;
138  virtual QString getArguments() const;
139  virtual QString getType() const;
140  virtual void update();
141 
142 private slots:
143  void dataChangedSlot();
144 private:
145  PlaneMetricPtr mData;
147  bool mInternalUpdate;
148 };
149 
150 class cxGui_EXPORT DistanceMetricWrapper : public MetricBase
151 {
152  Q_OBJECT
153 public:
154  explicit DistanceMetricWrapper(VisServicesPtr services, DistanceMetricPtr data);
156  virtual QWidget* createWidget();
157  virtual DataMetricPtr getData() const;
158  virtual QString getArguments() const;
159  virtual QString getType() const;
160  virtual void update();
161 
162 private slots:
163  void dataChangedSlot();
164 
165 private:
166  DistanceMetricPtr mData;
167  bool mInternalUpdate;
169 };
170 
171 class cxGui_EXPORT AngleMetricWrapper : public MetricBase
172 {
173  Q_OBJECT
174 public:
175  explicit AngleMetricWrapper(VisServicesPtr services, AngleMetricPtr data);
176  virtual ~AngleMetricWrapper();
177  virtual QWidget* createWidget();
178  virtual DataMetricPtr getData() const;
179  virtual QString getArguments() const;
180  virtual QString getType() const;
181  virtual void update();
182 
183 private slots:
184  void dataChangedSlot();
185  void guiChanged();
186 
187 private:
188  AngleMetricPtr mData;
190  BoolPropertyPtr mUseSimpleVisualization;
191  bool mInternalUpdate;
192  BoolPropertyPtr createUseSimpleVisualizationSelector() const;
193 
194 };
195 
196 class cxGui_EXPORT DonutMetricWrapper : public MetricBase
197 {
198  Q_OBJECT
199 public:
200  explicit DonutMetricWrapper(VisServicesPtr services, DonutMetricPtr data);
201  virtual ~DonutMetricWrapper() {}
202  virtual QWidget* createWidget();
203 // virtual QString getValue() const;
204  virtual DataMetricPtr getData() const;
205  virtual QString getArguments() const;
206  virtual QString getType() const;
207  virtual void update();
208 
209 private slots:
210  void dataChangedSlot();
211  void guiChanged();
212 
213 private:
214  DoublePropertyPtr createRadiusSelector() const;
215  DoublePropertyPtr createThicknessSelector() const;
216  DoublePropertyPtr createHeightSelector() const;
217  BoolPropertyPtr createFlatSelector() const;
218 
219  DonutMetricPtr mData;
220  DoublePropertyPtr mRadius;
221  DoublePropertyPtr mThickness;
222  DoublePropertyPtr mHeight;
223  BoolPropertyPtr mFlat;
224  bool mInternalUpdate;
226 };
227 
228 class cxGui_EXPORT CustomMetricWrapper : public MetricBase
229 {
230  Q_OBJECT
231 public:
232  explicit CustomMetricWrapper(VisServicesPtr services, CustomMetricPtr data);
233  virtual ~CustomMetricWrapper() {}
234  virtual QWidget* createWidget();
235 // virtual QString getValue() const;
236  virtual DataMetricPtr getData() const;
237  virtual QString getArguments() const;
238  virtual QString getType() const;
239  virtual void update();
240 
241 private slots:
242  void dataChangedSlot();
243  void guiChanged();
244 
245 private:
246  StringPropertyPtr createDefineVectorUpMethodSelector() const;
247  DoublePropertyPtr createOffsetFromP0() const;
248  DoublePropertyPtr createOffsetFromP1() const;
249  DoublePropertyPtr createRepeatDistance() const;
250  BoolPropertyPtr createScaletoP1() const;
251  BoolPropertyPtr createShowDistanceMarkers() const;
252  DoublePropertyPtr createDistanceMarkerVisibility() const;
253  StringPropertySelectDataPtr createModelSelector() const;
254  BoolPropertyPtr createTranslationOnly() const;
255  BoolPropertyPtr createTextureFollowTool() const;
256 
257  CustomMetricPtr mData;
258  StringPropertyPtr mDefineVectorUpMethod;
259  BoolPropertyPtr mScaleToP1;
260  QWidget* mScaleToP1Widget;
261  BoolPropertyPtr mShowDistanceMarkers;
262  BoolPropertyPtr mTranslationOnly;
263  BoolPropertyPtr mTextureFollowTool;
264  DoublePropertyPtr mOffsetFromP0;
265  DoublePropertyPtr mOffsetFromP1;
266  DoublePropertyPtr mRepeatDistance;
267  DoublePropertyPtr mDistanceMarkerVisibility;
268  QWidget* mDistanceMarkerVisibilityWidget;
270  bool mInternalUpdate;
272 };
273 
274 class cxGui_EXPORT SphereMetricWrapper : public MetricBase
275 {
276  Q_OBJECT
277 public:
278  explicit SphereMetricWrapper(VisServicesPtr services, SphereMetricPtr data);
279  virtual ~SphereMetricWrapper() {}
280  virtual QWidget* createWidget();
281 // virtual QString getValue() const;
282  virtual DataMetricPtr getData() const;
283  virtual QString getArguments() const;
284  virtual QString getType() const;
285  virtual void update();
286 
287 private slots:
288  void dataChangedSlot();
289  void guiChanged();
290 
291 private:
292  DoublePropertyPtr createRadiusSelector() const;
293 
294  SphereMetricPtr mData;
295  DoublePropertyPtr mRadius;
296  bool mInternalUpdate;
298 };
299 
300 class cxGui_EXPORT RegionOfInterestMetricWrapper : public MetricBase
301 {
302  Q_OBJECT
303 public:
306  virtual QWidget* createWidget();
307  virtual DataMetricPtr getData() const;
308  virtual QString getArguments() const;
309  virtual QString getType() const;
310  virtual void update();
311 
312 private slots:
313  void dataChangedSlot();
314  void guiChanged();
315 
316 private:
317  StringListPropertyPtr mDataListProperty;
318  BoolPropertyPtr mUseActiveTooltipProperty;
319  StringPropertyPtr mMaxBoundsDataProperty;
320  DoublePropertyPtr mMarginProperty;
321 
323  bool mInternalUpdate;
324 
325  DoublePropertyPtr createMarginSelector() const;
326  StringListPropertyPtr createDataListProperty();
327  BoolPropertyPtr createUseActiveTooltipSelector() const;
328  StringPropertyPtr createMaxBoundsDataSelector();
329 };
330 
331 
332 
336 }
337 
338 #endif /* CXDATAMETRICWRAPPERS_H_ */
boost::shared_ptr< class DistanceMetric > DistanceMetricPtr
boost::shared_ptr< class ColorProperty > ColorPropertyPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
boost::shared_ptr< class DonutMetric > DonutMetricPtr
boost::shared_ptr< DataMetric > DataMetricPtr
Definition: cxDataMetric.h:73
boost::shared_ptr< class SpaceProperty > SpacePropertyPtr
boost::shared_ptr< class SphereMetric > SphereMetricPtr
boost::shared_ptr< class AngleMetric > AngleMetricPtr
Definition: cxAngleMetric.h:33
ColorPropertyPtr mColorSelector
boost::shared_ptr< class PlaneMetric > PlaneMetricPtr
Definition: cxPlaneMetric.h:34
boost::shared_ptr< class StringProperty > StringPropertyPtr
boost::shared_ptr< class MetricBase > MetricBasePtr
boost::shared_ptr< class MetricReferenceArgumentList > MetricReferenceArgumentListPtr
boost::shared_ptr< class RegionOfInterestMetric > RegionOfInterestMetricPtr
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
boost::shared_ptr< class StringListProperty > StringListPropertyPtr
boost::shared_ptr< class Vector3DProperty > Vector3DPropertyPtr
VisServicesPtr mServices
boost::shared_ptr< class StringPropertySelectData > StringPropertySelectDataPtr
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< class CustomMetric > CustomMetricPtr
Namespace for all CustusX production code.
boost::shared_ptr< class PointMetric > PointMetricPtr