NorMIT-nav  22.09
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
cx::MetricManager
Definition: cxMetricManager.h:36
cx::MetricReferenceArgumentListPtr
boost::shared_ptr< class MetricReferenceArgumentList > MetricReferenceArgumentListPtr
Definition: cxMetricManager.h:26
cx::MetricManager::mUserSettings
ImportMNIuserSettings mUserSettings
Definition: cxMetricManager.h:75
cx::MetricManagerPtr
boost::shared_ptr< class MetricManager > MetricManagerPtr
Definition: cxMetricManager.h:27
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
cxDataMetric.h
cx::DataMetricPtr
boost::shared_ptr< DataMetric > DataMetricPtr
Definition: cxDataMetric.h:73
cxDefinitions.h
cx::MetricManager::getActiveUid
QString getActiveUid() const
Definition: cxMetricManager.h:47
cx::FileManagerServicePtr
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
Definition: cxLogicManager.h:31
cx::MetricManager::ImportMNIuserSettings::coordSys
PATIENT_COORDINATE_SYSTEM coordSys
Definition: cxMetricManager.h:73
csREF
csREF
the data reference space (r) using LPS (left-posterior-superior) coordinates.
Definition: cxDefinitions.h:90
cx::TrackingServicePtr
boost::shared_ptr< class TrackingService > TrackingServicePtr
Definition: cxToolFilterWidget.h:27
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cx::ViewServicePtr
boost::shared_ptr< class ViewService > ViewServicePtr
Definition: cxLogicManager.h:28
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cx::MetricManager::ImportMNIuserSettings
Definition: cxMetricManager.h:71
cxCoordinateSystemHelpers.h
cx::MetricManager::ImportMNIuserSettings::imageRefs
std::vector< QString > imageRefs
Definition: cxMetricManager.h:72
cx::DistanceMetricPtr
boost::shared_ptr< class DistanceMetric > DistanceMetricPtr
Definition: cxForwardDeclarations.h:67
cx::PointMetricPtr
boost::shared_ptr< class PointMetric > PointMetricPtr
Definition: cxForwardDeclarations.h:84
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cx::SpaceProviderPtr
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
Definition: cxLogicManager.h:23
cx::CoordinateSystem
Identification of a Coordinate system.
Definition: cxCoordinateSystemHelpers.h:31