CustusX  22.04-rc5
An IGT application
cxLandmarkPatientRegistrationWidget.cpp
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 
13 
14 #include <QVBoxLayout>
15 #include <QPushButton>
16 #include <QTableWidgetItem>
17 #include <QHeaderView>
18 #include <QSlider>
19 #include <QGridLayout>
20 #include <QSpinBox>
21 #include <vtkDoubleArray.h>
22 #include "cxVector3D.h"
23 #include "cxLogger.h"
25 #include "cxLandmarkRep.h"
26 #include "cxView.h"
27 #include "cxRegistrationService.h"
28 #include "cxViewService.h"
29 #include "cxPatientModelService.h"
30 #include "cxReporter.h"
31 #include "cxLandmarkListener.h"
32 #include "cxActiveData.h"
33 
34 namespace cx
35 {
36 
37 LandmarkPatientRegistrationWidget::LandmarkPatientRegistrationWidget(RegServicesPtr services, QWidget* parent, QString objectName, QString windowTitle) :
38  LandmarkRegistrationWidget(services, parent, objectName, windowTitle)
39 {
40  mLandmarkTableWidget->hide();
41 
42  mLandmarkListener->useI2IRegistration(false);
43 
44  mFixedProperty.reset(new StringPropertyRegistrationFixedImage(services->registration(), services->patient()));
45  connect(services->patient().get(), &PatientModelService::rMprChanged, this, &LandmarkPatientRegistrationWidget::setModified);
46 
47 
48  mRegisterButton = new QPushButton("Register", this);
49  mRegisterButton->setToolTip("Perform registration");
50  connect(mRegisterButton, SIGNAL(clicked()), this, SLOT(registerSlot()));
51 
52  mVerticalLayout->addWidget(new LabeledComboBoxWidget(this, mFixedProperty));
53 
54  QHBoxLayout* regLayout = new QHBoxLayout;
55  regLayout->addWidget(mRegisterButton);
57  mVerticalLayout->addLayout(regLayout);
58  mVerticalLayout->addStretch();
59 
60 }
61 
63 {
64  this->performRegistration();
65 }
66 
68 {
69 // std::cout << "LandmarkPatientRegistrationWidget::showEvent" << std::endl;
70  mServices->view()->setRegistrationMode(rsPATIENT_REGISTRATED);
72 }
73 
75 {
76  mServices->view()->setRegistrationMode(rsNOT_REGISTRATED);
78 }
79 
80 //The following functions look (almost) exactly like the same functions in PatientLandMarksWidget
82 {
83  if (!mServices->registration()->getFixedData())
84  {
85  ActiveDataPtr activeData = mServices->patient()->getActiveData();
86  mServices->registration()->setFixedData(activeData->getActive<Image>());
87  }
88 
89  if (mServices->patient()->getPatientLandmarks()->getLandmarks().size() < 3)
90  return;
91 
92  mServices->registration()->doPatientRegistration();
93 
95 }
96 
98 {
99  return mServices->patient()->getPatientLandmarks()->getLandmarks();
100 }
101 
103 {
104  Transform3D rMpr = mServices->patient()->get_rMpr();
105  return rMpr;
106 }
107 
109 {
110  mServices->patient()->getPatientLandmarks()->setLandmark(Landmark(uid, p_target));
111  reporter()->playSampleSound();
112 }
113 
115 {
116  return "Patient";
117 }
118 
119 
120 
121 }//namespace cx
virtual void showEvent(QShowEvent *event)
updates internal info before showing the widget
ReporterPtr reporter()
Definition: cxReporter.cpp:36
QLabel * mAvarageAccuracyLabel
label showing the average accuracy
One landmark, or fiducial, coordinate.
Definition: cxLandmark.h:40
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class ActiveData > ActiveDataPtr
Definition: cxColorWidget.h:21
Composite widget for string selection.
QVBoxLayout * mVerticalLayout
vertical layout is used
virtual Transform3D getTargetTransform() const
Return transform from target space to reference space.
virtual void hideEvent(QHideEvent *event)
A volumetric data set.
Definition: cxImage.h:45
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
rsNOT_REGISTRATED
LandmarkPatientRegistrationWidget(RegServicesPtr services, QWidget *parent, QString objectName, QString windowTitle)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
std::map< QString, class Landmark > LandmarkMap
virtual void setTargetLandmark(QString uid, Vector3D p_target)
virtual void showEvent(QShowEvent *event)
updates internal info before showing the widget
QTableWidget * mLandmarkTableWidget
the table widget presenting the landmarks
Namespace for all CustusX production code.