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)
63 mAddLandmarkButton->setToolTip(
"Add landmark");
64 mAddLandmarkButton->setDisabled(
true);
87 QHBoxLayout* landmarkButtonsLayout =
new QHBoxLayout;
88 landmarkButtonsLayout->addWidget(mAddLandmarkButton);
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();
136 Vector3D pos_r = PickerRep->getPosition();
137 Vector3D pos_d = image->get_rMd().inv().coord(pos_r);
138 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
153 DataPtr image = this->getCurrentData();
158 Vector3D pos_r = PickerRep->getPosition();
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();
void reportError(QString msg)
One landmark, or fiducial, coordinate.
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkSmartPointer< class vtkCellArray > vtkCellArrayPtr
static StringPropertySelectDataPtr New(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
boost::shared_ptr< class Image > ImagePtr
QString timestampSecondsFormatNice()
vtkSmartPointer< vtkPoints > vtkPointsPtr
boost::shared_ptr< class ActiveData > ActiveDataPtr
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class PickerRep > PickerRepPtr
Picking of points in an image.
void setVtkPolyData(const vtkPolyDataPtr &polyData)
boost::shared_ptr< class RegServices > RegServicesPtr
void changed()
emit when the underlying data value is changed: The user interface will be updated.
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
std::map< QString, class Landmark > LandmarkMap
boost::shared_ptr< class Mesh > MeshPtr
Namespace for all CustusX production code.