15 #include <QVBoxLayout>
16 #include <QPushButton>
17 #include <QTableWidget>
18 #include <QTableWidgetItem>
19 #include <QHeaderView>
22 #include <vtkDoubleArray.h>
23 #include <vtkImageData.h>
44 CenterlinePointsWidget::CenterlinePointsWidget(
RegServicesPtr services, QWidget* parent,
45 QString objectName, QString windowTitle,
bool useRegistrationFixedPropertyInsteadOfActiveImage) :
47 mUseRegistrationFixedPropertyInsteadOfActiveImage(useRegistrationFixedPropertyInsteadOfActiveImage)
49 if(mUseRegistrationFixedPropertyInsteadOfActiveImage)
87 QHBoxLayout* landmarkButtonsLayout =
new QHBoxLayout;
106 if (data && !
mServices->registration()->getFixedData())
107 mServices->registration()->setFixedData(data);
117 DataPtr CenterlinePointsWidget::getCurrentData()
const
131 DataPtr image = this->getCurrentData();
135 QString uid =
mServices->patient()->addLandmark();
137 Vector3D pos_d = image->get_rMd().inv().coord(pos_r);
138 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
153 DataPtr image = this->getCurrentData();
159 Vector3D pos_d = image->get_rMd().inv().coord(pos_r);
160 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
167 DataPtr image = this->getCurrentData();
178 DataPtr image = this->getCurrentData();
190 for(
int i=0; i<landmarkVector.size(); i++)
195 Vector3D pos = landmarkVector[i].getCoord();
196 pos = rMd.coord(pos);
197 points->InsertNextPoint(pos(0),pos(1),pos(2));
200 for(
int i=0; i<points->GetNumberOfPoints()-1; i++)
202 vtkIdType connection[2] = {i, i+1};
203 lines->InsertNextCell(2, connection);
206 outputPositions->SetPoints(points);
207 outputPositions->SetLines(lines);
211 filename =
"CenterlineFromPoints " + QDateTime::currentDateTime().toString(format);
215 mesh->setColor(QColor(0, 0, 255, 255));
229 bool loaded = this->getCurrentData() != 0;
236 DataPtr image = this->getCurrentData();
239 mAddLandmarkButton->setToolTip(QString(
"Add landmark to image %1").arg(image->getName()));
240 mEditLandmarkButton->setToolTip(QString(
"Resample landmark in image %1").arg(image->getName()));
250 if(!mUseRegistrationFixedPropertyInsteadOfActiveImage)
279 DataPtr image = this->getCurrentData();
283 return image->getLandmarks()->getLandmarks();
291 DataPtr image = this->getCurrentData();
293 return Transform3D::Identity();
294 return image->get_rMd();
299 DataPtr image = this->getCurrentData();
302 image->getLandmarks()->setLandmark(
Landmark(uid, p_target));
307 DataPtr image = this->getCurrentData();
310 return image->getName();