Fraxinus  16.5.0-fx-rc1
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"
47 #include "cxShapedMetric.h"
48 #include "cxStringProperty.h"
49 #include "cxVector3DProperty.h"
50 #include "cxColorProperty.h"
51 #include "cxDoubleProperty.h"
52 #include "cxSpaceProperty.h"
53 
54 class QVBoxLayout;
55 class QTableWidget;
56 class QPushButton;
57 
58 namespace cx
59 {
60 
67 typedef boost::shared_ptr<class MetricBase> MetricBasePtr;
68 
69 class cxGui_EXPORT MetricBase : public QObject
70 {
71  Q_OBJECT
72 public:
74  virtual ~MetricBase() {}
75  virtual QWidget* createWidget() = 0;
76  virtual QString getValue() const;
77  virtual DataMetricPtr getData() const = 0;
78  virtual QString getArguments() const = 0;
79  virtual QString getType() const = 0;
80  virtual void update() = 0;
81 
82 private slots:
83  void colorSelected();
84 protected:
86  void addColorWidget(QVBoxLayout* layout);
89 };
90 
94 class cxGui_EXPORT MetricReferenceArgumentListGui : public QObject
95 {
96  Q_OBJECT
97 public:
99  void setArguments(MetricReferenceArgumentListPtr arguments);
100  void addWidgets(QBoxLayout* layout);
101  QString getAsString() const;
102  void update();
103 //public:
104 // void argumentsChanged();
105 private slots:
106  void pointSelected();
107  void dataChangedSlot();
108 private:
110  std::vector<StringPropertyPtr> mPSelector;
111  bool mInternalUpdate;
112  bool mModified;
113  void getAvailableArgumentMetrics(QStringList* uid, std::map<QString,QString>* namemap);
114 };
115 
116 class cxGui_EXPORT PointMetricWrapper : public MetricBase
117 {
118  Q_OBJECT
119 public:
121  virtual ~PointMetricWrapper();
122  virtual QWidget* createWidget();
123  virtual DataMetricPtr getData() const;
124  virtual QString getArguments() const;
125  virtual QString getType() const;
126  virtual void update();
127 
128 private slots:
129  void moveToToolPosition();
130  void spaceSelected();
131  void coordinateChanged();
132 // void dataChangedSlot();
133 private:
134  QWidget* createSampleButton(QWidget* parent) const;
135  SpacePropertyPtr createSpaceSelector() const;
136  Vector3DPropertyPtr createCoordinateSelector() const;
137  PointMetricPtr mData;
138  SpacePropertyPtr mSpaceSelector;
139  Vector3DPropertyPtr mCoordinate;
140  bool mInternalUpdate;
141 };
142 
143 class cxGui_EXPORT PlaneMetricWrapper : public MetricBase
144 {
145  Q_OBJECT
146 public:
148  virtual ~PlaneMetricWrapper();
149  virtual QWidget* createWidget();
150  virtual DataMetricPtr getData() const;
151  virtual QString getArguments() const;
152  virtual QString getType() const;
153  virtual void update();
154 
155 private slots:
156  void dataChangedSlot();
157 private:
158  PlaneMetricPtr mData;
160  bool mInternalUpdate;
161 };
162 
163 class cxGui_EXPORT DistanceMetricWrapper : public MetricBase
164 {
165  Q_OBJECT
166 public:
169  virtual QWidget* createWidget();
170  virtual DataMetricPtr getData() const;
171  virtual QString getArguments() const;
172  virtual QString getType() const;
173  virtual void update();
174 
175 private slots:
176  void dataChangedSlot();
177 
178 private:
179  DistanceMetricPtr mData;
180  bool mInternalUpdate;
182 };
183 
184 class cxGui_EXPORT AngleMetricWrapper : public MetricBase
185 {
186  Q_OBJECT
187 public:
189  virtual ~AngleMetricWrapper();
190  virtual QWidget* createWidget();
191  virtual DataMetricPtr getData() const;
192  virtual QString getArguments() const;
193  virtual QString getType() const;
194  virtual void update();
195 
196 private slots:
197  void dataChangedSlot();
198  void guiChanged();
199 
200 private:
201  AngleMetricPtr mData;
203  BoolPropertyPtr mUseSimpleVisualization;
204  bool mInternalUpdate;
205  BoolPropertyPtr createUseSimpleVisualizationSelector() const;
206 
207 };
208 
209 class cxGui_EXPORT DonutMetricWrapper : public MetricBase
210 {
211  Q_OBJECT
212 public:
214  virtual ~DonutMetricWrapper() {}
215  virtual QWidget* createWidget();
216 // virtual QString getValue() const;
217  virtual DataMetricPtr getData() const;
218  virtual QString getArguments() const;
219  virtual QString getType() const;
220  virtual void update();
221 
222 private slots:
223  void dataChangedSlot();
224  void guiChanged();
225 
226 private:
227  DoublePropertyPtr createRadiusSelector() const;
228  DoublePropertyPtr createThicknessSelector() const;
229  DoublePropertyPtr createHeightSelector() const;
230  BoolPropertyPtr createFlatSelector() const;
231 
232  DonutMetricPtr mData;
233  DoublePropertyPtr mRadius;
234  DoublePropertyPtr mThickness;
235  DoublePropertyPtr mHeight;
236  BoolPropertyPtr mFlat;
237  bool mInternalUpdate;
239 
240 };
241 
242 class cxGui_EXPORT SphereMetricWrapper : public MetricBase
243 {
244  Q_OBJECT
245 public:
247  virtual ~SphereMetricWrapper() {}
248  virtual QWidget* createWidget();
249 // virtual QString getValue() const;
250  virtual DataMetricPtr getData() const;
251  virtual QString getArguments() const;
252  virtual QString getType() const;
253  virtual void update();
254 
255 private slots:
256  void dataChangedSlot();
257  void guiChanged();
258 
259 private:
260  DoublePropertyPtr createRadiusSelector() const;
261 
262  SphereMetricPtr mData;
263  DoublePropertyPtr mRadius;
264  bool mInternalUpdate;
266 };
267 
271 }
272 
273 #endif /* CXDATAMETRICWRAPPERS_H_ */
boost::shared_ptr< class ColorProperty > ColorPropertyPtr
boost::shared_ptr< class DonutMetric > DonutMetricPtr
boost::shared_ptr< DataMetric > DataMetricPtr
Definition: cxDataMetric.h:95
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
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 DoubleProperty > DoublePropertyPtr
cxLogicManager_EXPORT ViewServicePtr viewService()
boost::shared_ptr< class Vector3DProperty > Vector3DPropertyPtr
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< class PointMetric > PointMetricPtr