CustusX  16.12
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 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 #ifndef CXDATAMETRICWRAPPERS_H_
33 #define CXDATAMETRICWRAPPERS_H_
34 
35 #include "cxGuiExport.h"
36 
37 #include <vector>
38 #include <QtWidgets>
39 
40 #include "cxForwardDeclarations.h"
41 #include "cxLandmark.h"
42 #include "cxPointMetric.h"
43 #include "cxDistanceMetric.h"
44 #include "cxAngleMetric.h"
45 #include "cxPlaneMetric.h"
46 #include "cxSphereMetric.h"
48 #include "cxShapedMetric.h"
49 #include "cxCustomMetric.h"
50 #include "cxStringProperty.h"
51 #include "cxVector3DProperty.h"
52 #include "cxColorProperty.h"
53 #include "cxDoubleProperty.h"
54 #include "cxSpaceProperty.h"
55 #include "cxFilePathProperty.h"
56 #include "cxStringListProperty.h"
58 
59 class QVBoxLayout;
60 class QTableWidget;
61 class QPushButton;
62 
63 namespace cx
64 {
65 
72 typedef boost::shared_ptr<class MetricBase> MetricBasePtr;
73 
74 class cxGui_EXPORT MetricBase : public QObject
75 {
76  Q_OBJECT
77 public:
79  virtual ~MetricBase() {}
80  virtual QWidget* createWidget() = 0;
81  virtual QString getValue() const;
82  virtual DataMetricPtr getData() const = 0;
83  virtual QString getArguments() const = 0;
84  virtual QString getType() const = 0;
85  virtual void update() = 0;
86 
87 private slots:
88  void colorSelected();
89 protected:
91  void addColorWidget(QVBoxLayout* layout);
92  QWidget* newWidget(QString objectName);
95 };
96 
100 class cxGui_EXPORT MetricReferenceArgumentListGui : public QObject
101 {
102  Q_OBJECT
103 public:
105  void setArguments(MetricReferenceArgumentListPtr arguments);
106  void addWidgets(QBoxLayout* layout);
107  QString getAsString() const;
108  void update();
109 //public:
110 // void argumentsChanged();
111 private slots:
112  void pointSelected();
113  void dataChangedSlot();
114 private:
116  std::vector<StringPropertyPtr> mPSelector;
117  bool mInternalUpdate;
118  bool mModified;
119  void getAvailableArgumentMetrics(QStringList* uid, std::map<QString,QString>* namemap);
120 };
121 
122 class cxGui_EXPORT PointMetricWrapper : public MetricBase
123 {
124  Q_OBJECT
125 public:
127  virtual ~PointMetricWrapper();
128  virtual QWidget* createWidget();
129  virtual DataMetricPtr getData() const;
130  virtual QString getArguments() const;
131  virtual QString getType() const;
132  virtual void update();
133 
134 private slots:
135  void moveToToolPosition();
136  void spaceSelected();
137  void coordinateChanged();
138 // void dataChangedSlot();
139 private:
140  QWidget* createSampleButton(QWidget* parent) const;
141  SpacePropertyPtr createSpaceSelector() const;
142  Vector3DPropertyPtr createCoordinateSelector() const;
143  PointMetricPtr mData;
144  SpacePropertyPtr mSpaceSelector;
145  Vector3DPropertyPtr mCoordinate;
146  bool mInternalUpdate;
147 };
148 
149 class cxGui_EXPORT PlaneMetricWrapper : public MetricBase
150 {
151  Q_OBJECT
152 public:
154  virtual ~PlaneMetricWrapper();
155  virtual QWidget* createWidget();
156  virtual DataMetricPtr getData() const;
157  virtual QString getArguments() const;
158  virtual QString getType() const;
159  virtual void update();
160 
161 private slots:
162  void dataChangedSlot();
163 private:
164  PlaneMetricPtr mData;
166  bool mInternalUpdate;
167 };
168 
169 class cxGui_EXPORT DistanceMetricWrapper : public MetricBase
170 {
171  Q_OBJECT
172 public:
175  virtual QWidget* createWidget();
176  virtual DataMetricPtr getData() const;
177  virtual QString getArguments() const;
178  virtual QString getType() const;
179  virtual void update();
180 
181 private slots:
182  void dataChangedSlot();
183 
184 private:
185  DistanceMetricPtr mData;
186  bool mInternalUpdate;
188 };
189 
190 class cxGui_EXPORT AngleMetricWrapper : public MetricBase
191 {
192  Q_OBJECT
193 public:
195  virtual ~AngleMetricWrapper();
196  virtual QWidget* createWidget();
197  virtual DataMetricPtr getData() const;
198  virtual QString getArguments() const;
199  virtual QString getType() const;
200  virtual void update();
201 
202 private slots:
203  void dataChangedSlot();
204  void guiChanged();
205 
206 private:
207  AngleMetricPtr mData;
209  BoolPropertyPtr mUseSimpleVisualization;
210  bool mInternalUpdate;
211  BoolPropertyPtr createUseSimpleVisualizationSelector() const;
212 
213 };
214 
215 class cxGui_EXPORT DonutMetricWrapper : public MetricBase
216 {
217  Q_OBJECT
218 public:
220  virtual ~DonutMetricWrapper() {}
221  virtual QWidget* createWidget();
222 // virtual QString getValue() const;
223  virtual DataMetricPtr getData() const;
224  virtual QString getArguments() const;
225  virtual QString getType() const;
226  virtual void update();
227 
228 private slots:
229  void dataChangedSlot();
230  void guiChanged();
231 
232 private:
233  DoublePropertyPtr createRadiusSelector() const;
234  DoublePropertyPtr createThicknessSelector() const;
235  DoublePropertyPtr createHeightSelector() const;
236  BoolPropertyPtr createFlatSelector() const;
237 
238  DonutMetricPtr mData;
239  DoublePropertyPtr mRadius;
240  DoublePropertyPtr mThickness;
241  DoublePropertyPtr mHeight;
242  BoolPropertyPtr mFlat;
243  bool mInternalUpdate;
245 };
246 
247 class cxGui_EXPORT CustomMetricWrapper : public MetricBase
248 {
249  Q_OBJECT
250 public:
252  virtual ~CustomMetricWrapper() {}
253  virtual QWidget* createWidget();
254 // virtual QString getValue() const;
255  virtual DataMetricPtr getData() const;
256  virtual QString getArguments() const;
257  virtual QString getType() const;
258  virtual void update();
259 
260 private slots:
261  void dataChangedSlot();
262  void guiChanged();
263 
264 private:
265  StringPropertyPtr createDefineVectorUpMethodSelector() const;
266  DoublePropertyPtr createOffsetFromP0() const;
267  DoublePropertyPtr createOffsetFromP1() const;
268  DoublePropertyPtr createRepeatDistance() const;
269  BoolPropertyPtr createScaletoP1() const;
270  BoolPropertyPtr createShowDistanceMarkers() const;
271  DoublePropertyPtr createDistanceMarkerVisibility() const;
272  StringPropertySelectDataPtr createModelSelector() const;
273  BoolPropertyPtr createTranslationOnly() const;
274  BoolPropertyPtr createTextureFollowTool() const;
275 
276  CustomMetricPtr mData;
277  StringPropertyPtr mDefineVectorUpMethod;
278  BoolPropertyPtr mScaleToP1;
279  QWidget* mScaleToP1Widget;
280  BoolPropertyPtr mShowDistanceMarkers;
281  BoolPropertyPtr mTranslationOnly;
282  BoolPropertyPtr mTextureFollowTool;
283  DoublePropertyPtr mOffsetFromP0;
284  DoublePropertyPtr mOffsetFromP1;
285  DoublePropertyPtr mRepeatDistance;
286  DoublePropertyPtr mDistanceMarkerVisibility;
287  QWidget* mDistanceMarkerVisibilityWidget;
289  bool mInternalUpdate;
291 };
292 
293 class cxGui_EXPORT SphereMetricWrapper : public MetricBase
294 {
295  Q_OBJECT
296 public:
298  virtual ~SphereMetricWrapper() {}
299  virtual QWidget* createWidget();
300 // virtual QString getValue() const;
301  virtual DataMetricPtr getData() const;
302  virtual QString getArguments() const;
303  virtual QString getType() const;
304  virtual void update();
305 
306 private slots:
307  void dataChangedSlot();
308  void guiChanged();
309 
310 private:
311  DoublePropertyPtr createRadiusSelector() const;
312 
313  SphereMetricPtr mData;
314  DoublePropertyPtr mRadius;
315  bool mInternalUpdate;
317 };
318 
319 class cxGui_EXPORT RegionOfInterestMetricWrapper : public MetricBase
320 {
321  Q_OBJECT
322 public:
325  virtual QWidget* createWidget();
326  virtual DataMetricPtr getData() const;
327  virtual QString getArguments() const;
328  virtual QString getType() const;
329  virtual void update();
330 
331 private slots:
332  void dataChangedSlot();
333  void guiChanged();
334 
335 private:
336  StringListPropertyPtr mDataListProperty;
337  BoolPropertyPtr mUseActiveTooltipProperty;
338  StringPropertyPtr mMaxBoundsDataProperty;
339  DoublePropertyPtr mMarginProperty;
340 
342  bool mInternalUpdate;
343 
344  DoublePropertyPtr createMarginSelector() const;
345  StringListPropertyPtr createDataListProperty();
346  BoolPropertyPtr createUseActiveTooltipSelector() const;
347  StringPropertyPtr createMaxBoundsDataSelector();
348 };
349 
350 
351 
355 }
356 
357 #endif /* CXDATAMETRICWRAPPERS_H_ */
boost::shared_ptr< class ColorProperty > ColorPropertyPtr
boost::shared_ptr< class DonutMetric > DonutMetricPtr
boost::shared_ptr< DataMetric > DataMetricPtr
Definition: cxDataMetric.h:96
boost::shared_ptr< class SpaceProperty > SpacePropertyPtr
boost::shared_ptr< class SphereMetric > SphereMetricPtr
boost::shared_ptr< class ViewService > ViewServicePtr
boost::shared_ptr< class AngleMetric > AngleMetricPtr
Definition: cxAngleMetric.h:54
ViewServicePtr mViewService
ColorPropertyPtr mColorSelector
boost::shared_ptr< class PlaneMetric > PlaneMetricPtr
Definition: cxPlaneMetric.h:55
boost::shared_ptr< class StringProperty > StringPropertyPtr
PatientModelServicePtr mPatientModelService
boost::shared_ptr< class MetricBase > MetricBasePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
boost::shared_ptr< class MetricReferenceArgumentList > MetricReferenceArgumentListPtr
boost::shared_ptr< class DistanceMetric > DistanceMetricPtr
boost::shared_ptr< class RegionOfInterestMetric > RegionOfInterestMetricPtr
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
boost::shared_ptr< class StringListProperty > StringListPropertyPtr
boost::shared_ptr< class Vector3DProperty > Vector3DPropertyPtr
cxLogicManager_EXPORT ViewServicePtr viewService()
boost::shared_ptr< class StringPropertySelectData > StringPropertySelectDataPtr
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< class CustomMetric > CustomMetricPtr
boost::shared_ptr< class PointMetric > PointMetricPtr