14 #include <QPushButton> 28 RegistrationBaseWidget(services, parent,
"org_custusx_registration_method_plate_reference_landmarks",
"Plate Registration Reference landmarks"),
29 mPlateRegistrationButton(new QPushButton(
"Load registration points", this)),
30 mReferenceToolInfoLabel(new QLabel(
"", this))
32 connect(mPlateRegistrationButton, SIGNAL(clicked()),
this, SLOT(plateRegistrationSlot()));
35 QVBoxLayout* toptopLayout =
new QVBoxLayout(
this);
36 toptopLayout->addWidget(mReferenceToolInfoLabel);
37 toptopLayout->addWidget(mPlateRegistrationButton);
38 toptopLayout->addStretch();
40 this->internalUpdate();
48 void PlateRegistrationWidget::showEvent(QShowEvent* event)
52 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
54 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
56 mServices->view()->setRegistrationMode(rsPATIENT_REGISTRATED);
59 void PlateRegistrationWidget::hideEvent(QHideEvent* event)
61 BaseWidget::hideEvent(event);
63 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
65 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
70 void PlateRegistrationWidget::landmarkUpdatedSlot()
72 mServices->registration()->doFastRegistration_Translation();
75 void PlateRegistrationWidget::plateRegistrationSlot()
77 mServices->patient()->getPatientLandmarks()->clear();
85 std::map<int, Vector3D> referencePoints = refTool->getReferencePoints();
86 if(referencePoints.empty())
88 reportDebug(
"No referenceppoints in reftool "+refTool->getName());
92 std::map<int, Vector3D>::iterator it = referencePoints.begin();
93 for(; it != referencePoints.end(); ++it)
95 QString uid =
mServices->patient()->addLandmark();
97 mServices->patient()->getPatientLandmarks()->setLandmark(
Landmark(uid, it->second));
102 LandmarkPropertyMap::iterator landmarkIt = map.begin();
103 for(; landmarkIt != map.end(); ++landmarkIt)
105 mServices->patient()->setLandmarkActive(landmarkIt->first,
false);
109 mPlateRegistrationButton->setDisabled(
true);
112 void PlateRegistrationWidget::internalUpdate()
116 QString labelText =
"";
117 if(!refTool || refTool->getReferencePoints().size()<1)
119 mPlateRegistrationButton->setDisabled(
true);
121 labelText.append(
"Configure the tracker to have <br>a reference frame that has at least <br>one reference point.");
124 mPlateRegistrationButton->setEnabled(
true);
126 labelText =
"<b>Reference tool selected:</b> <br>";
127 labelText.append(
"Tool name: <i>"+refTool->getName()+
"</i><br>");
128 labelText.append(
"Number of defined reference points: <i>"+
qstring_cast(refTool->getReferencePoints().size())+
"</i>");
131 mReferenceToolInfoLabel->setText(labelText);
QString qstring_cast(const T &val)
One landmark, or fiducial, coordinate.
void landmarkAdded(QString uid)
boost::shared_ptr< class RegServices > RegServicesPtr
std::map< QString, LandmarkProperty > LandmarkPropertyMap
void landmarkRemoved(QString uid)
void reportDebug(QString msg)
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr