CustusX  22.04-rc5
An IGT application
cxRegionOfInterestMetric.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 #ifndef CXREGIONOFINTERESTMETRIC_H
13 #define CXREGIONOFINTERESTMETRIC_H
14 
15 #include "cxResourceExport.h"
16 #include "cxPrecompiledHeader.h"
17 
18 #include "cxDataMetric.h"
20 #include "cxOptionalValue.h"
21 
22 namespace cx
23 {
38 class cxResource_EXPORT RegionOfInterest
39 {
40 public:
42  bool isValid() const { return !mPoints.empty(); }
47  DoubleBoundingBox3D getBox(Transform3D qMd = Transform3D::Identity());
48 
49  double mMargin;
50  std::vector<Vector3D> mPoints;
51  std::vector<Vector3D> mMaxBoundsPoints;
52 
53 private:
54  DoubleBoundingBox3D generateROIFromPointsAndMargin(const std::vector<Vector3D> &points, double margin) const;
55  std::vector<Vector3D> transform(const std::vector<Vector3D> &points, Transform3D M) const;
56 };
57 
58 typedef boost::shared_ptr<class RegionOfInterestMetric> RegionOfInterestMetricPtr;
59 
64 class cxResource_EXPORT RegionOfInterestMetric: public DataMetric
65 {
66 Q_OBJECT
67 public:
68  virtual ~RegionOfInterestMetric();
69  static RegionOfInterestMetricPtr create(QString uid, QString name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider);
70 
71  virtual Vector3D getRefCoord() const;
72  virtual QString getAsSingleLineString() const;
73 
74  virtual bool isValid() const;
75 
76  virtual void addXml(QDomNode& dataNode);
77  virtual void parseXml(QDomNode& dataNode);
78  virtual DoubleBoundingBox3D boundingBox() const;
79  virtual QString getType() const
80  {
81  return getTypeName();
82  }
83  static QString getTypeName()
84  {
85  return "roiMetric";
86  }
87 
88  virtual QString getValueAsString() const;
89  virtual bool showValueInGraphics() const { return false; }
90 
91  QStringList getDataList() { return mContainedData; }
92  void setDataList(QStringList val);
93 
94  bool getUseActiveTooltip() { return mUseActiveTooltip; }
95  void setUseActiveTooltip(bool val);
96 
97  double getMargin() { return mMargin; }
98  void setMargin(double val);
99 
100  QString getMaxBoundsData() { return mMaxBoundsData; }
101  void setMaxBoundsData(QString val);
102 
103  RegionOfInterest getROI() const; // return a ROI in ref space.
104 
105 private:
106  RegionOfInterestMetric(const QString& uid, const QString& name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider);
107 
108  QString mMaxBoundsData;
109  QStringList mContainedData;
110  bool mUseActiveTooltip;
111  double mMargin;
112 
113  std::vector<SpaceListenerPtr> mListeners;
114  void listenTo(CoordinateSystem space);
115  void onContentTransformsChanged();
116  void onContentChanged();
117  Vector3D getToolTip_r() const;
118 };
119 
123 }
124 
125 #endif // CXREGIONOFINTERESTMETRIC_H
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
virtual QString getType() const
virtual bool showValueInGraphics() const
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Identification of a Coordinate system.
boost::shared_ptr< class RegionOfInterestMetric > RegionOfInterestMetricPtr
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.
std::vector< Vector3D > mPoints
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
std::vector< Vector3D > mMaxBoundsPoints
Namespace for all CustusX production code.