14 #include <vtkPolyData.h>
52 "Centerline Registration"),
54 mRecordTrackingWidget(NULL)
56 mVerticalLayout =
new QVBoxLayout(
this);
61 if (!mRecordTrackingWidget)
67 void CenterlineRegistrationWidget::setup()
69 mOptions =
profile()->getXmlSettings().descend(
"centerlineregistrationwidget");
72 mSelectMeshWidget->setValueName(
"Centerline: ");
79 mRegisterButton =
new QPushButton(
"Register");
80 connect(mRegisterButton, SIGNAL(clicked()),
this, SLOT(registerSlot()));
84 mServices->acquisition(), mServices,
87 mRecordTrackingWidget->
getSessionSelector()->setHelp(
"Select tool path for registration");
90 mVerticalLayout->setMargin(0);
91 mVerticalLayout->addWidget(
new DataSelectWidget(mServices->view(), mServices->patient(),
this, mSelectMeshWidget));
93 this->selectXtranslation(mOptions.
getElement());
94 this->selectYtranslation(mOptions.
getElement());
95 this->selectZtranslation(mOptions.
getElement());
100 mVerticalLayout->addWidget(mRecordTrackingWidget);
101 mVerticalLayout->addWidget(
new CheckBoxWidget(
this, mUseXtranslation));
102 mVerticalLayout->addWidget(
new CheckBoxWidget(
this, mUseYtranslation));
103 mVerticalLayout->addWidget(
new CheckBoxWidget(
this, mUseZtranslation));
104 mVerticalLayout->addWidget(
new CheckBoxWidget(
this, mUseXrotation));
105 mVerticalLayout->addWidget(
new CheckBoxWidget(
this, mUseYrotation));
106 mVerticalLayout->addWidget(
new CheckBoxWidget(
this, mUseZrotation));
107 mVerticalLayout->addWidget(mRegisterButton);
109 mVerticalLayout->addStretch();
117 void CenterlineRegistrationWidget::initializeTrackingService()
124 void CenterlineRegistrationWidget::registerSlot()
127 if(!mSelectMeshWidget->getMesh())
132 vtkPolyDataPtr centerline = mSelectMeshWidget->getMesh()->getVtkPolyData();
133 Transform3D rMd = mSelectMeshWidget->getMesh()->get_rMd();
135 mCenterlineRegistration->UpdateScales(
136 mUseXrotation->getValue(), mUseYrotation->getValue(), mUseZrotation->getValue(),
137 mUseXtranslation->getValue(), mUseYtranslation->getValue(), mUseZtranslation->getValue());
139 Transform3D old_rMpr = mServices->patient()->get_rMpr();
143 if(trackerRecordedData_prMt.empty())
151 new_rMpr = mCenterlineRegistration->runCenterlineRegistration(centerline, rMd, trackerRecordedData_prMt, old_rMpr);
153 std::cout <<
"Running centerline registration." << std::endl;
155 new_rMpr = new_rMpr*old_rMpr;
156 mServices->registration()->addPatientRegistration(new_rMpr,
"Centerline centerline to tracking data");
158 Eigen::Matrix4d display_rMpr = Eigen::Matrix4d::Identity();
159 display_rMpr = new_rMpr*display_rMpr;
160 std::cout <<
"New prMt: " << std::endl;
161 for (
int i = 0; i < 4; i++)
162 std::cout << display_rMpr.row(i) << std::endl;
167 void CenterlineRegistrationWidget::selectXtranslation(QDomElement root)
170 "Select if X translation be used in registration",
true,
174 void CenterlineRegistrationWidget::selectYtranslation(QDomElement root)
177 "Select if Y translation be used in registration",
true,
181 void CenterlineRegistrationWidget::selectZtranslation(QDomElement root)
184 "Select if Z translation be used in registration",
true,
188 void CenterlineRegistrationWidget::selectXrotation(QDomElement root)
191 "Select if X rotation be used in registration",
true,
195 void CenterlineRegistrationWidget::selectYrotation(QDomElement root)
198 "Select if Y rotation be used in registration",
true,
202 void CenterlineRegistrationWidget::selectZrotation(QDomElement root)
205 "Select if Z rotation be used in registration",
true,
211 void CenterlineRegistrationWidget::clearDataOnNewPatient()