CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxRMPCWidget.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 #include "cxRMPCWidget.h"
12 
13 #include "cxPatientModelService.h"
14 #include "cxRegistrationService.h"
19 #include "cxICPWidget.h"
20 #include "cxSpaceListener.h"
21 #include "cxSpaceProvider.h"
22 
23 namespace cx
24 {
25 RMPCWidget::RMPCWidget(RegServicesPtr services, QWidget* parent) :
26  ICPRegistrationBaseWidget(services, parent, "org_custusx_registration_method_pointcloud_widget",
27  "Point Cloud Registration")
28 {
29 }
30 
32 {
33  mSpaceListenerMoving = mServices->spaceProvider()->createListener();
34  mSpaceListenerFixed = mServices->spaceProvider()->createListener();
35  mSpaceListenerMoving->setSpace(mServices->spaceProvider()->getPr());
36  connect(mSpaceListenerMoving.get(), &SpaceListener::changed, this, &RMPCWidget::onSpacesChanged);
37  connect(mSpaceListenerFixed.get(), &SpaceListener::changed, this, &RMPCWidget::onSpacesChanged);
38 
39  mFixedImage.reset(new StringPropertyRegistrationFixedImage(mServices->registration(), mServices->patient()));
40  mMovingImage.reset(new StringPropertyRegistrationMovingImage(mServices->registration(), mServices->patient()));
41 
42  connect(mServices->registration().get(), &RegistrationService::fixedDataChanged,
44  connect(mServices->registration().get(), &RegistrationService::movingDataChanged,
46 
47  QVBoxLayout* layout = new QVBoxLayout(this);
48  layout->setMargin(0);
49  layout->addWidget(new LabeledComboBoxWidget(this, mFixedImage));
50  layout->addWidget(new LabeledComboBoxWidget(this, mMovingImage));
51 
52  layout->addWidget(mICPWidget);
53  layout->addStretch();
54 
55  this->inputChanged();
56  this->onSettingsChanged();
57 }
58 
59 
61 {
62  DataPtr fixed = mServices->registration()->getFixedData();
63  DataPtr moving = mServices->registration()->getMovingData();
64  QString logPath = mServices->patient()->getActivePatientFolder() + "/Logs/";
65 
66  mRegistrator->initialize(moving, fixed, logPath);
67 }
68 
70 {
71  if (mObscuredListener->isObscured())
72  return;
73 
74  DataPtr fixed = mServices->registration()->getFixedData();
75  mSpaceListenerFixed->setSpace(mServices->spaceProvider()->getD(fixed));
76 
77  this->onSpacesChanged();
78 }
79 
81 {
82  Transform3D rMpr = mServices->patient()->get_rMpr();
83  Transform3D new_rMpr = delta*rMpr;//output
84  mServices->registration()->addPatientRegistration(new_rMpr, "I2P Surface to Surface");
85 
86  mServices->registration()->addImage2ImageRegistration(delta, "I2P Surface to Surface - correction");
87 
88 }
89 
91 {
92  this->inputChanged();
93 }
94 
95 
96 } //namespace cx
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual void inputChanged()
Composite widget for string selection.
void fixedDataChanged(QString uid)
virtual void initializeRegistrator()
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class WidgetObscuredListener > mObscuredListener
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
RMPCWidget(RegServicesPtr services, QWidget *parent)
virtual void onShown()
virtual void applyRegistration(Transform3D delta)
void movingDataChanged(QString uid)
virtual void setup()
Namespace for all CustusX production code.