36 #include <QVBoxLayout> 37 #include <QPushButton> 38 #include <QTableWidget> 39 #include <QTableWidgetItem> 40 #include <QHeaderView> 43 #include <vtkDoubleArray.h> 44 #include <vtkImageData.h> 65 CenterlinePointsWidget::CenterlinePointsWidget(
RegServicesPtr services, QWidget* parent,
66 QString objectName, QString windowTitle,
bool useRegistrationFixedPropertyInsteadOfActiveImage) :
68 mUseRegistrationFixedPropertyInsteadOfActiveImage(useRegistrationFixedPropertyInsteadOfActiveImage)
70 if(mUseRegistrationFixedPropertyInsteadOfActiveImage)
84 mAddLandmarkButton->setToolTip(
"Add landmark");
85 mAddLandmarkButton->setDisabled(
true);
108 QHBoxLayout* landmarkButtonsLayout =
new QHBoxLayout;
109 landmarkButtonsLayout->addWidget(mAddLandmarkButton);
127 if (data && !
mServices->registration()->getFixedData())
128 mServices->registration()->setFixedData(data);
138 DataPtr CenterlinePointsWidget::getCurrentData()
const 152 DataPtr image = this->getCurrentData();
156 QString uid =
mServices->patient()->addLandmark();
157 Vector3D pos_r = PickerRep->getPosition();
158 Vector3D pos_d = image->get_rMd().inv().coord(pos_r);
159 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
174 DataPtr image = this->getCurrentData();
179 Vector3D pos_r = PickerRep->getPosition();
180 Vector3D pos_d = image->get_rMd().inv().coord(pos_r);
181 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
188 DataPtr image = this->getCurrentData();
199 DataPtr image = this->getCurrentData();
211 for(
int i=0; i<landmarkVector.size(); i++)
216 Vector3D pos = landmarkVector[i].getCoord();
217 pos = rMd.coord(pos);
218 points->InsertNextPoint(pos(0),pos(1),pos(2));
221 for(
int i=0; i<points->GetNumberOfPoints()-1; i++)
223 vtkIdType connection[2] = {i, i+1};
224 lines->InsertNextCell(2, connection);
227 outputPositions->SetPoints(points);
228 outputPositions->SetLines(lines);
232 filename =
"CenterlineFromPoints " + QDateTime::currentDateTime().toString(format);
236 mesh->setColor(QColor(0, 0, 255, 255));
250 bool loaded = this->getCurrentData() != 0;
257 DataPtr image = this->getCurrentData();
260 mAddLandmarkButton->setToolTip(QString(
"Add landmark to image %1").arg(image->getName()));
261 mEditLandmarkButton->setToolTip(QString(
"Resample landmark in image %1").arg(image->getName()));
271 if(!mUseRegistrationFixedPropertyInsteadOfActiveImage)
300 DataPtr image = this->getCurrentData();
304 return image->getLandmarks()->getLandmarks();
312 DataPtr image = this->getCurrentData();
314 return Transform3D::Identity();
315 return image->get_rMd();
320 DataPtr image = this->getCurrentData();
323 image->getLandmarks()->setLandmark(
Landmark(uid, p_target));
328 DataPtr image = this->getCurrentData();
331 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.