NorMIT-nav  2023.01.05-dev+develop.0da12
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
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx::RegionOfInterest::isValid
bool isValid() const
Definition: cxRegionOfInterestMetric.h:42
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxPrecompiledHeader.h
cx::RegionOfInterestMetric::getMargin
double getMargin()
Definition: cxRegionOfInterestMetric.h:97
cxDataMetric.h
cx::RegionOfInterestMetric::getUseActiveTooltip
bool getUseActiveTooltip()
Definition: cxRegionOfInterestMetric.h:94
cx::RegionOfInterestMetric::getMaxBoundsData
QString getMaxBoundsData()
Definition: cxRegionOfInterestMetric.h:100
cx::RegionOfInterest::mMargin
double mMargin
Definition: cxRegionOfInterestMetric.h:49
cx::RegionOfInterest::mMaxBoundsPoints
std::vector< Vector3D > mMaxBoundsPoints
Definition: cxRegionOfInterestMetric.h:51
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cxMetricReferenceArgumentList.h
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cxOptionalValue.h
cx::DataMetric
Base class for all Data Metrics.
Definition: cxDataMetric.h:43
cx::RegionOfInterestMetricPtr
boost::shared_ptr< class RegionOfInterestMetric > RegionOfInterestMetricPtr
Definition: cxRegionOfInterestMetric.h:58
cx::RegionOfInterest
Definition: cxRegionOfInterestMetric.h:38
cx::RegionOfInterestMetric::getDataList
QStringList getDataList()
Definition: cxRegionOfInterestMetric.h:91
cx::RegionOfInterestMetric::getType
virtual QString getType() const
Definition: cxRegionOfInterestMetric.h:79
cx::RegionOfInterestMetric::getTypeName
static QString getTypeName()
Definition: cxRegionOfInterestMetric.h:83
cx::transform
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
Definition: cxTransform3D.cpp:150
cx::RegionOfInterestMetric::showValueInGraphics
virtual bool showValueInGraphics() const
Definition: cxRegionOfInterestMetric.h:89
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cx::RegionOfInterestMetric
Definition: cxRegionOfInterestMetric.h:64
cx::SpaceProviderPtr
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
Definition: cxLogicManager.h:23
cx::RegionOfInterest::mPoints
std::vector< Vector3D > mPoints
Definition: cxRegionOfInterestMetric.h:50
cx::CoordinateSystem
Identification of a Coordinate system.
Definition: cxCoordinateSystemHelpers.h:31