35 #include <QPushButton> 49 RegistrationBaseWidget(services, parent,
"org_custusx_registration_method_plate_reference_landmarks",
"Plate Registration Reference landmarks"),
50 mPlateRegistrationButton(new QPushButton(
"Load registration points", this)),
51 mReferenceToolInfoLabel(new QLabel(
"", this))
53 connect(mPlateRegistrationButton, SIGNAL(clicked()),
this, SLOT(plateRegistrationSlot()));
56 QVBoxLayout* toptopLayout =
new QVBoxLayout(
this);
57 toptopLayout->addWidget(mReferenceToolInfoLabel);
58 toptopLayout->addWidget(mPlateRegistrationButton);
59 toptopLayout->addStretch();
61 this->internalUpdate();
69 void PlateRegistrationWidget::showEvent(QShowEvent* event)
73 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
75 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
77 mServices->view()->setRegistrationMode(rsPATIENT_REGISTRATED);
80 void PlateRegistrationWidget::hideEvent(QHideEvent* event)
82 BaseWidget::hideEvent(event);
84 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
86 this, &PlateRegistrationWidget::landmarkUpdatedSlot);
91 void PlateRegistrationWidget::landmarkUpdatedSlot()
93 mServices->registration()->doFastRegistration_Translation();
96 void PlateRegistrationWidget::plateRegistrationSlot()
98 mServices->patient()->getPatientLandmarks()->clear();
106 std::map<int, Vector3D> referencePoints = refTool->getReferencePoints();
107 if(referencePoints.empty())
109 reportDebug(
"No referenceppoints in reftool "+refTool->getName());
113 std::map<int, Vector3D>::iterator it = referencePoints.begin();
114 for(; it != referencePoints.end(); ++it)
116 QString uid =
mServices->patient()->addLandmark();
118 mServices->patient()->getPatientLandmarks()->setLandmark(
Landmark(uid, it->second));
123 LandmarkPropertyMap::iterator landmarkIt = map.begin();
124 for(; landmarkIt != map.end(); ++landmarkIt)
126 mServices->patient()->setLandmarkActive(landmarkIt->first,
false);
130 mPlateRegistrationButton->setDisabled(
true);
133 void PlateRegistrationWidget::internalUpdate()
137 QString labelText =
"";
138 if(!refTool || refTool->getReferencePoints().size()<1)
140 mPlateRegistrationButton->setDisabled(
true);
142 labelText.append(
"Configure the tracker to have <br>a reference frame that has at least <br>one reference point.");
145 mPlateRegistrationButton->setEnabled(
true);
147 labelText =
"<b>Reference tool selected:</b> <br>";
148 labelText.append(
"Tool name: <i>"+refTool->getName()+
"</i><br>");
149 labelText.append(
"Number of defined reference points: <i>"+
qstring_cast(refTool->getReferencePoints().size())+
"</i>");
152 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