Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxDistanceMetric.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 
12 
13 #ifndef CXDISTANCEMETRIC_H_
14 #define CXDISTANCEMETRIC_H_
15 
16 #include "cxResourceExport.h"
17 #include "cxPrecompiledHeader.h"
18 
19 #include "cxDataMetric.h"
21 #include "cxOptionalValue.h"
22 
23 namespace cx
24 {
31 typedef boost::shared_ptr<class DistanceMetric> DistanceMetricPtr;
32 
39 class cxResource_EXPORT DistanceMetric: public DataMetric
40 {
41 Q_OBJECT
42 public:
43  virtual ~DistanceMetric();
44  static DistanceMetricPtr create(QString uid, QString name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider);
45 
46  virtual QIcon getIcon() {return QIcon(":/icons/metric_distance.png");}
49  double getDistance() const;
54  Vector3D getDirection() const;
55  std::vector<Vector3D> getEndpoints() const;
56  virtual Vector3D getRefCoord() const;
57 
59 
60  virtual bool isValid() const;
61 
62  virtual void addXml(QDomNode& dataNode);
63  virtual void parseXml(QDomNode& dataNode);
64  virtual DoubleBoundingBox3D boundingBox() const;
65  virtual QString getType() const
66  {
67  return getTypeName();
68  }
69  static QString getTypeName()
70  {
71  return "distanceMetric";
72  }
73 
74  virtual QString getValueAsString() const;
75  virtual bool showValueInGraphics() const { return true; }
76 
77 private slots:
78  void resetCachedValues();
79 private:
80  DistanceMetric(const QString& uid, const QString& name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider);
81  void getEndpointsUncached(std::vector<Vector3D>* endpoints, Vector3D *direction) const;
83  mutable OptionalValue<std::vector<Vector3D> > mCachedEndPoints;
84  mutable OptionalValue<Vector3D> mCachedDirection;
85 
86  void updateCache() const;
87 };
88 
92 }
93 
94 #endif /* CXDISTANCEMETRIC_H_ */
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
virtual QIcon getIcon()
virtual QString getType() const
boost::shared_ptr< class DistanceMetric > DistanceMetricPtr
static QString getTypeName()
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
boost::shared_ptr< class MetricReferenceArgumentList > MetricReferenceArgumentListPtr
virtual bool showValueInGraphics() const
Data class that represents a distance between two points, or a point and a plane. ...
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.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
Base class for all Data Metrics.
Definition: cxDataMetric.h:43
MetricReferenceArgumentListPtr getArguments()
Namespace for all CustusX production code.