CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxMetricManager.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 CXMETRICMANAGER_H
13 #define CXMETRICMANAGER_H
14 
15 #include "cxGuiExport.h"
16 
17 #include "cxForwardDeclarations.h"
18 #include "cxDataMetric.h"
19 #include "cxDefinitions.h"
21 
22 class QDomElement;
23 
24 namespace cx
25 {
26 typedef boost::shared_ptr<class MetricReferenceArgumentList> MetricReferenceArgumentListPtr;
27 typedef boost::shared_ptr<class MetricManager> MetricManagerPtr;
28 
36 class cxGui_EXPORT MetricManager : public QObject
37 {
38  Q_OBJECT
39 public:
40  MetricManager(ViewServicePtr viewService, PatientModelServicePtr patientModelService, TrackingServicePtr trackingService, SpaceProviderPtr spaceProvider, FileManagerServicePtr filemanager);
41 
42  DataMetricPtr getMetric(QString uid);
43  int getNumberOfMetrics() const;
44  void moveToMetric(QString uid);
45  void setSelection(std::set<QString> selection);
46  void setActiveUid(QString uid);
47  QString getActiveUid() const { return mActiveLandmark; }
48  void exportMetricsToXMLFile(QString& filename);
49  void importMetricsFromXMLFile(QString& filename);
50  PointMetricPtr addPoint(Vector3D point, CoordinateSystem space=CoordinateSystem(csREF), QString uid="point%1", QColor color = QColor(240, 170, 255, 255));
51  DistanceMetricPtr addDistance(QString uid = "distance%1");
52 
53 signals:
54  void activeMetricChanged();
55  void metricsChanged();
56 
57 public slots:
58  void loadReferencePointsSlot();
59  void addPointButtonClickedSlot();
60  void addFrameButtonClickedSlot();
61  void addToolButtonClickedSlot();
62  void addPlaneButtonClickedSlot();
63  void addAngleButtonClickedSlot();
64  void addDistanceButtonClickedSlot();
65  void addSphereButtonClickedSlot();
66  void addDonutButtonClickedSlot();
67  void addCustomButtonClickedSlot();
68  void addROIButtonClickedSlot();
69 
70 protected:
72  std::vector<QString> imageRefs;
73  PATIENT_COORDINATE_SYSTEM coordSys;
74  };
76 
77 private:
78  void setManualToolPosition(Vector3D p_r);
79  std::vector<DataPtr> refinePointArguments(std::vector<DataPtr> args, unsigned argNo);
80  std::vector<DataPtr> getSpecifiedNumberOfValidArguments(MetricReferenceArgumentListPtr arguments, int numberOfRequiredArguments=-1);
81  void installNewMetric(DataMetricPtr metric);
82  PointMetricPtr addPointInDefaultPosition();
83  std::vector<DataMetricPtr> getAllMetrics() const;
84  DataPtr loadDataFromXMLNode(QDomElement node);
85  DataPtr createData(QString type, QString uid, QString name);
86 
87  QString mActiveLandmark;
88  std::set<QString> mSelection;
89  PatientModelServicePtr mPatientModelService;
90  ViewServicePtr mViewService;
91  TrackingServicePtr mTrackingService;
92  SpaceProviderPtr mSpaceProvider;
93  FileManagerServicePtr mFileManager;
94  //QColor getRandomColor();
95  //std::vector<QString> dialogForSelectingVolumesForImportedMNITagFile(int number_of_volumes, QString description);
96  QColor getRandomColor();
97  ImportMNIuserSettings dialogForSelectingVolumesForImportedMNITagFile(int number_of_volumes, QString description);
98  void resolveUnknownParentSpacesForPointMetrics(QDomNode dataNode, std::map<QString, QString> mapping_of_unknown_to_known_spaces, DataPtr data);
99 };
100 
101 
102 } // namespace cx
103 
104 #endif // CXMETRICMANAGER_H
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
boost::shared_ptr< class DistanceMetric > DistanceMetricPtr
boost::shared_ptr< DataMetric > DataMetricPtr
Definition: cxDataMetric.h:73
boost::shared_ptr< class TrackingService > TrackingServicePtr
csREF
the data reference space (r) using LPS (left-posterior-superior) coordinates.
Definition: cxDefinitions.h:90
boost::shared_ptr< class ViewService > ViewServicePtr
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class MetricManager > MetricManagerPtr
ImportMNIuserSettings mUserSettings
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
boost::shared_ptr< class MetricReferenceArgumentList > MetricReferenceArgumentListPtr
Identification of a Coordinate system.
QString getActiveUid() const
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
Namespace for all CustusX production code.
boost::shared_ptr< class PointMetric > PointMetricPtr