CustusX  2021.04.21-dev+develop.337f9
An IGT application
cxDataManagerImpl.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 CXDATAMANAGERIMPL_H_
14 #define CXDATAMANAGERIMPL_H_
15 
16 #include "org_custusx_core_patientmodel_Export.h"
17 #include "cxPrecompiledHeader.h"
18 
19 #include <map>
20 #include <set>
21 #include <string>
22 #include <QMutex>
23 #include <vector>
24 #include "cxImage.h"
25 #include "cxMesh.h"
26 #include "cxDataManager.h"
27 #include <QFileInfo>
28 #include "boost/scoped_ptr.hpp"
29 #include "cxPatientModelService.h"
30 
31 class QDomElement;
32 
33 namespace cx
34 {
35 
36 typedef boost::shared_ptr<class DataManager> DataServicePtr;
37 typedef boost::shared_ptr<class DataManagerImpl> DataManagerImplPtr;
38 
47 class org_custusx_core_patientmodel_EXPORT DataManagerImpl: public DataManager
48 {
49 Q_OBJECT
50 public:
51  static DataManagerImplPtr create(ActiveDataPtr activeData);
52  virtual ~DataManagerImpl();
53  void setServices(SpaceProviderPtr spaceProvider, FileManagerServicePtr filemanager);
54  void setDataFactory(DataFactoryPtr dataFactory);
55 
56  // streams
57  virtual VideoSourcePtr getStream(const QString& uid) const;
58  virtual StreamMap getStreams() const;
59  virtual void loadStream(VideoSourcePtr stream);
60 
61  // images
62  virtual std::map<QString, ImagePtr> getImages() const;
63 
64  void loadData(DataPtr data, bool overWrite = false);
65  DataPtr loadData(const QString& uid, const QString& path);
66  std::map<QString, DataPtr> getData() const;
67  DataPtr getData(const QString& uid) const;
68  virtual SpaceProviderPtr getSpaceProvider();
69  virtual DataFactoryPtr getDataFactory();
70 
71  // meshes
72  virtual std::map<QString, MeshPtr> getMeshes() const;
73 
74  // global data (move to separate class if list grows)
75  virtual Vector3D getCenter() const;
76  virtual void setCenter(const Vector3D& center);
77  void setOperatingTable(const OperatingTable &ot);
78  OperatingTable getOperatingTable() const;
79 
80  virtual QString addLandmark();
81  virtual void deleteLandmarks();
82  virtual void setLandmarkNames(std::vector<QString> names);
83  virtual void setLandmarkName(QString uid, QString name);
84  virtual void setLandmarkActive(QString uid, bool active);
85  virtual std::map<QString, LandmarkProperty> getLandmarkProperties() const;
86  virtual void clear();
87  virtual void removeData(const QString& uid, QString basePath);
88 
89  //Interface for saving/loading
90  virtual void addXml(QDomNode& parentNode);
91  virtual void parseXml(QDomNode& datamangerNode, QString absolutePath = QString());
92 
93  virtual CLINICAL_VIEW getClinicalApplication() const;
94  virtual void setClinicalApplication(CLINICAL_VIEW application);
95 
96  virtual Transform3D get_rMpr() const;
97  virtual void set_rMpr(const Transform3D& val);
98  virtual RegistrationHistoryPtr get_rMpr_History() const;
99 
100  virtual LandmarksPtr getPatientLandmarks();
101  virtual PresetTransferFunctions3DPtr getPresetTransferFunctions3D() const;
102 
103  virtual void generateUidAndName(QString* _uid, QString* _name);
104 protected:
105  DataManagerImpl(ActiveDataPtr activeData);
106 
107 protected:
108  std::map<QString, VideoSourcePtr> mStreams;
109  DataMap mData;
112  CLINICAL_VIEW mClinicalApplication;
113  void deleteFiles(DataPtr data, QString basePath);
114 
115  DataPtr loadData(QDomElement node, QString rootPath);
116  int findUniqueUidNumber(QString uidBase) const;
117 
118  void readClinicalView();
119 
124 
129 
130 private:
131  QDir findRelativePath(QDomElement node, QString rootPath);
132  QString findPath(QDomElement node);
133  QString findAbsolutePath(QDir relativePath, QString rootPath);
134 private slots:
135  void settingsChangedSlot(QString key);
136 };
137 
138 } // namespace cx
139 
140 #endif /* CXDATAMANAGERIMPL_H_ */
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
DataFactoryPtr mDataFactory
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
FileManagerServicePtr mFileManagerService
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:37
std::map< QString, VideoSourcePtr > mStreams
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
OperatingTable mOperatingTable
boost::shared_ptr< class TransferFunctions3DPresets > PresetTransferFunctions3DPtr
Definition: cxDataManager.h:36
boost::shared_ptr< class DataManagerImpl > DataManagerImplPtr
boost::shared_ptr< class ActiveData > ActiveDataPtr
Definition: cxColorWidget.h:21
ActiveDataPtr mActiveData
boost::shared_ptr< class DataManager > DataServicePtr
boost::shared_ptr< class Landmarks > LandmarksPtr
Definition: cxData.h:41
PresetTransferFunctions3DPtr mPresetTransferFunctions3D
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class VideoSource > VideoSourcePtr
RegistrationHistoryPtr m_rMpr_History
transform from the patient reference to the reference, along with historical data.
LandmarksPtr mPatientLandmarks
in space patient reference.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
std::map< QString, LandmarkProperty > LandmarkPropertyMap
Definition: cxLandmark.h:108
CLINICAL_VIEW mClinicalApplication
The OperatingTable class.
LandmarkPropertyMap mLandmarkProperties
uid and name
SpaceProviderPtr mSpaceProvider
boost::shared_ptr< class DataFactory > DataFactoryPtr
Definition: cxDataManager.h:39
Namespace for all CustusX production code.
std::map< QString, VideoSourcePtr > StreamMap
Definition: cxDataManager.h:55