CustusX  16.12
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 
34 #ifndef CXDATAMANAGERIMPL_H_
35 #define CXDATAMANAGERIMPL_H_
36 
37 #include "org_custusx_core_patientmodel_Export.h"
38 #include "cxPrecompiledHeader.h"
39 
40 #include <map>
41 #include <set>
42 #include <string>
43 #include <QMutex>
44 #include <vector>
45 #include "cxImage.h"
46 #include "cxMesh.h"
47 #include "cxDataManager.h"
48 #include <QFileInfo>
49 #include "boost/scoped_ptr.hpp"
50 #include "cxPatientModelService.h"
51 
52 class QDomElement;
53 
54 namespace cx
55 {
56 
57 typedef boost::shared_ptr<class DataManager> DataServicePtr;
58 typedef boost::shared_ptr<class DataManagerImpl> DataManagerImplPtr;
59 
68 class org_custusx_core_patientmodel_EXPORT DataManagerImpl: public DataManager
69 {
70 Q_OBJECT
71 public:
72  static DataManagerImplPtr create(ActiveDataPtr activeData);
73  virtual ~DataManagerImpl();
74  void setSpaceProvider(SpaceProviderPtr spaceProvider);
75  void setDataFactory(DataFactoryPtr dataFactory);
76 
77  // streams
78  virtual VideoSourcePtr getStream(const QString& uid) const;
79  virtual StreamMap getStreams() const;
80  virtual void loadStream(VideoSourcePtr stream);
81 
82  // images
83  virtual std::map<QString, ImagePtr> getImages() const;
84 
85  void loadData(DataPtr data);
86  DataPtr loadData(const QString& uid, const QString& path);
87  std::map<QString, DataPtr> getData() const;
88  DataPtr getData(const QString& uid) const;
89  virtual SpaceProviderPtr getSpaceProvider();
90  virtual DataFactoryPtr getDataFactory();
91 
92  // meshes
93  virtual std::map<QString, MeshPtr> getMeshes() const;
94 
95  // global data (move to separate class if list grows)
96  virtual Vector3D getCenter() const;
97  virtual void setCenter(const Vector3D& center);
98  void setOperatingTable(const OperatingTable &ot);
99  OperatingTable getOperatingTable() const;
100 
101  virtual QString addLandmark();
102  virtual void setLandmarkNames(std::vector<QString> names);
103  virtual void setLandmarkName(QString uid, QString name);
104  virtual void setLandmarkActive(QString uid, bool active);
105  virtual std::map<QString, LandmarkProperty> getLandmarkProperties() const;
106  virtual void clear();
107  virtual void removeData(const QString& uid, QString basePath);
108 
109  //Interface for saving/loading
110  virtual void addXml(QDomNode& parentNode);
111  virtual void parseXml(QDomNode& datamangerNode, QString absolutePath = QString());
112 
113  virtual CLINICAL_VIEW getClinicalApplication() const;
114  virtual void setClinicalApplication(CLINICAL_VIEW application);
115 
116  virtual Transform3D get_rMpr() const;
117  virtual void set_rMpr(const Transform3D& val);
118  virtual RegistrationHistoryPtr get_rMpr_History() const;
119 
120  virtual LandmarksPtr getPatientLandmarks();
121  virtual PresetTransferFunctions3DPtr getPresetTransferFunctions3D() const;
122 
123  virtual void generateUidAndName(QString* _uid, QString* _name);
124 protected:
125  DataManagerImpl(ActiveDataPtr activeData);
126 
127 protected:
128  std::map<QString, VideoSourcePtr> mStreams;
129  DataMap mData;
132  CLINICAL_VIEW mClinicalApplication;
133  void deleteFiles(DataPtr data, QString basePath);
134 
135  DataPtr loadData(QDomElement node, QString rootPath);
136  int findUniqueUidNumber(QString uidBase) const;
137 
138  void readClinicalView();
139 
144 
148 
149 private:
150  QDir findRelativePath(QDomElement node, QString rootPath);
151  QString findPath(QDomElement node);
152  QString findAbsolutePath(QDir relativePath, QString rootPath);
153 private slots:
154  void settingsChangedSlot(QString key);
155 };
156 
157 } // namespace cx
158 
159 #endif /* CXDATAMANAGERIMPL_H_ */
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
DataFactoryPtr mDataFactory
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:58
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:57
boost::shared_ptr< class DataManagerImpl > DataManagerImplPtr
boost::shared_ptr< class ActiveData > ActiveDataPtr
Definition: cxColorWidget.h:42
ActiveDataPtr mActiveData
boost::shared_ptr< class DataManager > DataServicePtr
boost::shared_ptr< class Landmarks > LandmarksPtr
Definition: cxData.h:61
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.
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
std::map< QString, LandmarkProperty > LandmarkPropertyMap
Definition: cxLandmark.h:129
CLINICAL_VIEW mClinicalApplication
The OperatingTable class.
LandmarkPropertyMap mLandmarkProperties
uid and name
SpaceProviderPtr mSpaceProvider
boost::shared_ptr< class DataFactory > DataFactoryPtr
std::map< QString, VideoSourcePtr > StreamMap
Definition: cxDataManager.h:76