34 #include <QTreeWidget>
35 #include <QTreeWidgetItem>
36 #include <QStringList>
37 #include <QVBoxLayout>
38 #include <QHeaderView>
57 BaseWidget(parent,
"PointSamplingWidget",
"Point sampler/3D ruler"),
58 mVerticalLayout(new QVBoxLayout(this)),
59 mTable(new QTableWidget(this)),
61 mAddButton(new QPushButton(
"Add", this)),
62 mEditButton(new QPushButton(
"Resample", this)),
63 mRemoveButton(new QPushButton(
"Remove", this)),
64 mLoadReferencePointsButton(new QPushButton(
"Load reference points", this))
66 this->setToolTip(
"Sample and store points");
85 QHBoxLayout* buttonLayout =
new QHBoxLayout;
101 QTableWidgetItem* item =
mTable->currentItem();
105 for (
unsigned i=0; i<
mSamples.size(); ++i)
118 QWidget::showEvent(event);
123 data->setOptions(options);
130 QWidget::hideEvent(event);
135 mTable->blockSignals(
true);
140 mTable->setColumnCount(3);
141 QStringList headerItems(QStringList() <<
"Name" <<
"Coordinates(r)" <<
"Delta (mm)");
142 mTable->setHorizontalHeaderLabels(headerItems);
143 mTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
144 mTable->setSelectionBehavior(QAbstractItemView::SelectRows);
146 for (
unsigned i = 0; i <
mSamples.size(); ++i)
148 std::vector<QTableWidgetItem*> items(3);
157 coordText = tr(
"(%1, %2, %3)").arg(coord[0], width,
'f', prec).arg(coord[1], width,
'f', prec).arg(coord[2],
160 items[1] =
new QTableWidgetItem(coordText);
164 items[2] =
new QTableWidgetItem;
169 items[2] =
new QTableWidgetItem(tr(
"%1").arg(delta, width,
'f', prec));
172 for (
unsigned j = 0; j < items.size(); ++j)
175 mTable->setItem(i, j, items[j]);
181 mTable->setCurrentItem(items[1]);
185 mTable->blockSignals(
false);
202 for (
unsigned i=0; i<
mSamples.size(); ++i)
223 Vector3D tool_t(0,0,tool->getTooltipOffset());
224 Vector3D tool_r = (rMpr*prMt).coord(tool_t);
233 Vector3D delta_pr = rMpr.inv().vector(delta_r);
238 tool->set_prMt(MD*prMt);
256 for (
unsigned i=0; i<
mSamples.size(); ++i)
267 for (
unsigned i=0; i<
mSamples.size(); ++i)
290 reportDebug(
"No reference tool, cannot load reference points into the pointsampler");
294 std::map<int, Vector3D> referencePoints_s = refTool->getReferencePoints();
295 if(referencePoints_s.empty())
297 reportWarning(
"No referenceppoints in reference tool "+refTool->getName());
304 std::map<int, Vector3D>::iterator it = referencePoints_s.begin();
305 for(; it != referencePoints_s.end(); ++it)
QString qstring_cast(const T &val)
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
One landmark, or fiducial, coordinate.
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
static CoordinateSystem reference()
void reportWarning(QString msg)
Transform3D createTransformTranslate(const Vector3D &translation)
Identification of a Coordinate system.
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
cxLogicManager_EXPORT ViewServicePtr viewService()
cxLogicManager_EXPORT PatientModelServicePtr patientService()
RealScalar length() const
cxLogicManager_EXPORT TrackingServicePtr trackingService()
bool mShowPointPickerProbe
void reportDebug(QString msg)
boost::shared_ptr< class Tool > ToolPtr