NorMIT-nav  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
cx::LabeledComboBoxWidget
Composite widget for string selection.
Definition: cxLabeledComboBoxWidget.h:36
cxSpaceListener.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ICPRegistrationBaseWidget::mICPWidget
ICPWidget * mICPWidget
Definition: cxICPRegistrationBaseWidget.h:97
cx::SpaceListener::changed
void changed()
cx::RMPCWidget::applyRegistration
virtual void applyRegistration(Transform3D delta)
Definition: cxRMPCWidget.cpp:80
cxLabeledComboBoxWidget.h
cx::ICPRegistrationBaseWidget
Definition: cxICPRegistrationBaseWidget.h:49
cx::StringPropertyRegistrationMovingImage
Definition: cxRegistrationProperties.h:51
cx::ICPRegistrationBaseWidget::onSettingsChanged
void onSettingsChanged()
Definition: cxICPRegistrationBaseWidget.cpp:174
cx::RMPCWidget::onShown
virtual void onShown()
Definition: cxRMPCWidget.cpp:90
SeansVesselReg.hxx
cxICPWidget.h
cx::ICPRegistrationBaseWidget::mObscuredListener
boost::shared_ptr< class WidgetObscuredListener > mObscuredListener
Definition: cxICPRegistrationBaseWidget.h:100
cx::ICPRegistrationBaseWidget::mRegistrator
SeansVesselRegPtr mRegistrator
Definition: cxICPRegistrationBaseWidget.h:99
cx::RegistrationBaseWidget::mServices
RegServicesPtr mServices
Definition: cxRegistrationBaseWidget.h:35
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cxWidgetObscuredListener.h
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cx::RMPCWidget::inputChanged
virtual void inputChanged()
Definition: cxRMPCWidget.cpp:69
cxPatientModelService.h
cxRMPCWidget.h
cx::RegistrationService::movingDataChanged
void movingDataChanged(QString uid)
cx::ICPRegistrationBaseWidget::onSpacesChanged
void onSpacesChanged()
Definition: cxICPRegistrationBaseWidget.cpp:161
cx::RegServicesPtr
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
cxRegistrationProperties.h
cx::StringPropertyRegistrationFixedImage
Definition: cxRegistrationProperties.h:31
cx::RMPCWidget::initializeRegistrator
virtual void initializeRegistrator()
Definition: cxRMPCWidget.cpp:60
cx::RegistrationService::fixedDataChanged
void fixedDataChanged(QString uid)
cx::RMPCWidget::RMPCWidget
RMPCWidget(RegServicesPtr services, QWidget *parent)
Definition: cxRMPCWidget.cpp:25
cxRegistrationService.h
cx::RMPCWidget::setup
virtual void setup()
Definition: cxRMPCWidget.cpp:31
cxSpaceProvider.h