36 #include <QVBoxLayout>
37 #include <QPushButton>
38 #include <QTableWidget>
39 #include <QTableWidgetItem>
40 #include <QHeaderView>
43 #include <vtkDoubleArray.h>
44 #include <vtkImageData.h>
63 ImageLandmarksWidget::ImageLandmarksWidget(
RegServicesPtr services, QWidget* parent,
64 QString objectName, QString windowTitle,
bool useRegistrationFixedPropertyInsteadOfActiveImage) :
66 mUseRegistrationFixedPropertyInsteadOfActiveImage(useRegistrationFixedPropertyInsteadOfActiveImage)
68 if(mUseRegistrationFixedPropertyInsteadOfActiveImage)
82 mAddLandmarkButton->setToolTip(
"Add landmark");
83 mAddLandmarkButton->setDisabled(
true);
101 QHBoxLayout* landmarkButtonsLayout =
new QHBoxLayout;
102 landmarkButtonsLayout->addWidget(mAddLandmarkButton);
119 if (data && !
mServices->registration()->getFixedData())
120 mServices->registration()->setFixedData(data);
130 DataPtr ImageLandmarksWidget::getCurrentData()
const
140 reportError(
"Could not find a rep to add the landmark to.");
144 DataPtr image = this->getCurrentData();
148 QString uid =
mServices->patient()->addLandmark();
149 Vector3D pos_r = PickerRep->getPosition();
150 Vector3D pos_d = image->get_rMd().inv().coord(pos_r);
151 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
162 reportError(
"Could not find a rep to edit the landmark for.");
166 DataPtr image = this->getCurrentData();
171 Vector3D pos_r = PickerRep->getPosition();
172 Vector3D pos_d = image->get_rMd().inv().coord(pos_r);
173 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
180 DataPtr image = this->getCurrentData();
198 bool loaded = this->getCurrentData() != 0;
204 DataPtr image = this->getCurrentData();
207 mAddLandmarkButton->setToolTip(QString(
"Add landmark to image %1").arg(image->getName()));
208 mEditLandmarkButton->setToolTip(QString(
"Resample landmark in image %1").arg(image->getName()));
218 if(!mUseRegistrationFixedPropertyInsteadOfActiveImage)
247 DataPtr image = this->getCurrentData();
251 return image->getLandmarks()->getLandmarks();
259 DataPtr image = this->getCurrentData();
261 return Transform3D::Identity();
262 return image->get_rMd();
267 DataPtr image = this->getCurrentData();
270 image->getLandmarks()->setLandmark(
Landmark(uid, p_target));
275 DataPtr image = this->getCurrentData();
278 return image->getName();
void reportError(QString msg)
boost::shared_ptr< class RegServices > RegServicesPtr
One landmark, or fiducial, coordinate.
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
static StringPropertySelectDataPtr New(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
boost::shared_ptr< class Image > ImagePtr
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 changed()
emit when the underlying data value is changed: The user interface will be updated.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
std::map< QString, class Landmark > LandmarkMap