NorMIT-nav  22.09
An IGT application
cxRegistrationImplService.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 CXREGISTRATIONIMPLSERVICE_H_
13 #define CXREGISTRATIONIMPLSERVICE_H_
14 
15 #include "cxRegistrationService.h"
16 #include <vector>
17 #include "org_custusx_registration_Export.h"
18 #include "qdatetime.h"
19 #include "cxLandmark.h"
20 #include "vtkForwardDeclarations.h"
21 class ctkPluginContext;
22 class QDomElement;
23 
24 namespace cx
25 {
26 class RegistrationTransform;
27 class PatientModelService;
28 typedef boost::shared_ptr<class PatientModelService> PatientModelServicePtr;
29 typedef boost::shared_ptr<class SessionStorageService> SessionStorageServicePtr;
30 
31 
41 class org_custusx_registration_EXPORT RegistrationImplService : public RegistrationService
42 {
43  Q_INTERFACES(cx::RegistrationService)
44 public:
45  RegistrationImplService(ctkPluginContext *context);
46  virtual ~RegistrationImplService();
47 
48  virtual void setMovingData(DataPtr data);
49  virtual void setFixedData(DataPtr data);
50  void setMovingData(QString uid);
51  void setFixedData(QString uid);
52  virtual DataPtr getMovingData();
53  virtual DataPtr getFixedData();
54 
55  virtual void doPatientRegistration();
56  virtual void doFastRegistration_Translation();
57  virtual void doFastRegistration_Orientation(const Transform3D& tMtm, const Transform3D &prMt);
58  virtual void doImageRegistration(bool translationOnly);
59  virtual void addImage2ImageRegistration(Transform3D dMd, QString description);
60  virtual void updateImage2ImageRegistration(Transform3D dMd, QString description);
61  virtual void addPatientRegistration(Transform3D rMpr_new, QString description);
62  virtual void updatePatientRegistration(Transform3D rMpr_new, QString description);
63  virtual void applyPatientOrientation(const Transform3D &tMtm, const Transform3D &prMt);
64 
65  virtual QDateTime getLastRegistrationTime();
66  virtual void setLastRegistrationTime(QDateTime time);
67 
68  virtual bool isNull();
69 
70 private slots:
71  void duringSavePatientSlot(QDomElement &node);
72  void duringLoadPatientSlot(QDomElement &node);
73  void addXml(QDomNode &parentNode);
74  void parseXml(QDomNode &dataNode);
75  void clearSlot();
76 private:
77  virtual void updateRegistration_rMd(QDateTime oldTime, RegistrationTransform dMd, DataPtr data);
78 // PatientModelService* getPatientModelService();
79  void writePreLandmarkRegistration(QString name, LandmarkMap landmarks);
80  vtkPointsPtr convertTovtkPoints(const std::vector<QString> &uids, const LandmarkMap &data, Transform3D M);
81  std::vector<QString> getUsableLandmarks(const LandmarkMap &data_a, const LandmarkMap &data_b);
82  Transform3D performLandmarkRegistration(vtkPointsPtr source, vtkPointsPtr target, bool *ok) const;
83  std::vector<Vector3D> convertAndTransformToPoints(const std::vector<QString> &uids, const LandmarkMap &data, Transform3D M);
84  std::vector<Vector3D> convertVtkPointsToPoints(vtkPointsPtr base);
85 
86 // DataPtr mFixedData; ///< the data that shouldn't update its matrices during a registrations
87 // DataPtr mMovingData; ///< the data that should update its matrices during a registration
88  QString mFixedData;
89  QString mMovingData;
90 
91  QDateTime mLastRegistrationTime;
92 
93  ctkPluginContext* mContext;
94  PatientModelServicePtr mPatientModelService;
95  SessionStorageServicePtr mSession;
96  void performImage2ImageRegistration(Transform3D dMd, QString description, bool temporaryRegistration = false);
97  void performPatientRegistration(Transform3D rMpr_new, QString description, bool temporaryRegistration = false);
98 };
99 
100 typedef boost::shared_ptr<RegistrationImplService> RegistrationImplServicePtr;
101 
102 } /* namespace cx */
103 
104 #endif /* CXREGISTRATIONIMPLSERVICE_H_ */
105 
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::performLandmarkRegistration
Eigen::Matrix4d performLandmarkRegistration(vtkPointsPtr source, vtkPointsPtr target)
Definition: cxBronchoscopyRegistration.cpp:133
cx::LandmarkMap
std::map< QString, class Landmark > LandmarkMap
Definition: cxLandmarkRegistrationWidget.h:31
cx::RegistrationImplServicePtr
boost::shared_ptr< RegistrationImplService > RegistrationImplServicePtr
Definition: cxRegistrationImplService.h:100
cx::RegistrationService
Registration services.
Definition: cxRegistrationService.h:45
cx::SessionStorageServicePtr
boost::shared_ptr< class SessionStorageService > SessionStorageServicePtr
Definition: cxLogicManager.h:30
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cx::vtkPointsPtr
vtkSmartPointer< vtkPoints > vtkPointsPtr
Definition: cxCenterlineRegistration.h:41
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
vtkForwardDeclarations.h
cx::RegistrationImplService
Definition: cxRegistrationImplService.h:41
cx::RegistrationTransform
A registration event and its transform.
Definition: cxRegistrationTransform.h:39
cxRegistrationService.h
cx::convertTovtkPoints
vtkPointsPtr convertTovtkPoints(Eigen::MatrixXd positions)
Definition: cxBronchoscopyRegistration.cpp:119
cxLandmark.h