NorMIT-nav  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_ */
cx::OptionalValue
Definition: cxOptionalValue.h:26
cx::MetricReferenceArgumentListPtr
boost::shared_ptr< class MetricReferenceArgumentList > MetricReferenceArgumentListPtr
Definition: cxMetricManager.h:26
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxPrecompiledHeader.h
cxDataMetric.h
cx::DistanceMetric::getArguments
MetricReferenceArgumentListPtr getArguments()
Definition: cxDistanceMetric.h:58
cx::DistanceMetric::getType
virtual QString getType() const
Definition: cxDistanceMetric.h:65
cxMetricReferenceArgumentList.h
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cx::DistanceMetric::showValueInGraphics
virtual bool showValueInGraphics() const
Definition: cxDistanceMetric.h:75
cx::DistanceMetric::getIcon
virtual QIcon getIcon()
Definition: cxDistanceMetric.h:46
cxOptionalValue.h
cx::DataMetric
Base class for all Data Metrics.
Definition: cxDataMetric.h:43
cx::DistanceMetric::getTypeName
static QString getTypeName()
Definition: cxDistanceMetric.h:69
cx::DistanceMetricPtr
boost::shared_ptr< class DistanceMetric > DistanceMetricPtr
Definition: cxForwardDeclarations.h:67
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cx::DistanceMetric
Data class that represents a distance between two points, or a point and a plane.
Definition: cxDistanceMetric.h:39
cx::SpaceProviderPtr
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
Definition: cxLogicManager.h:23