15 #include <QVBoxLayout> 16 #include <QPushButton> 17 #include <QTableWidget> 18 #include <QTableWidgetItem> 19 #include <QHeaderView> 23 #include <vtkDoubleArray.h> 24 #include <vtkImageData.h> 45 ImageLandmarksWidget::ImageLandmarksWidget(
RegServicesPtr services, QWidget* parent,
46 QString objectName, QString windowTitle,
47 bool useRegistrationFixedPropertyInsteadOfActiveImage) :
49 mUseRegistrationFixedPropertyInsteadOfActiveImage(useRegistrationFixedPropertyInsteadOfActiveImage),
50 mLandmarksShowAdvancedSettingsString(
"Landmarks/ShowAdvanced")
52 if(mUseRegistrationFixedPropertyInsteadOfActiveImage)
66 mAddLandmarkButton->setToolTip(
"Add landmark");
67 mAddLandmarkButton->setDisabled(
true);
93 QHBoxLayout* landmarkButtonsLayout =
new QHBoxLayout;
94 landmarkButtonsLayout->addWidget(mAddLandmarkButton);
99 QIcon(
":/icons/open_icon_library/system-run-5.png"),
100 "Advanced",
"Toggle advanced options",
102 landmarkButtonsLayout);
105 QHBoxLayout* landmarkAdvancedButtonsLayout =
new QHBoxLayout;
106 landmarkAdvancedButtonsLayout =
new QHBoxLayout;
114 this->showOrHideDetails();
128 if (data && !
mServices->registration()->getFixedData())
129 mServices->registration()->setFixedData(data);
136 bool newShowAdvancedValue = !
settings()->
value(mLandmarksShowAdvancedSettingsString,
"true").toBool();
137 settings()->
setValue(mLandmarksShowAdvancedSettingsString, newShowAdvancedValue);
138 this->showOrHideDetails();
141 void ImageLandmarksWidget::showOrHideDetails()
143 bool showAdvanced =
settings()->
value(mLandmarksShowAdvancedSettingsString).toBool();
152 DataPtr ImageLandmarksWidget::getCurrentData()
const 173 Vector3D pos_r = PickerRep->getPosition();
179 DataPtr image = this->getCurrentData();
182 QString uid =
mServices->patient()->addLandmark();
183 Vector3D pos_d = image->get_rMd().inv().coord(p_r);
184 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
198 Vector3D pos_r = PickerRep->getPosition();
204 DataPtr image = this->getCurrentData();
208 Vector3D pos_d = image->get_rMd().inv().coord(p_r);
209 image->getLandmarks()->setLandmark(
Landmark(uid, pos_d));
216 DataPtr image = this->getCurrentData();
227 DataPtr image = this->getCurrentData();
231 image->getLandmarks()->clear();
238 DataPtr image = this->getCurrentData();
243 std::map<QString, DataPtr>::iterator it = point_metrics.begin();
246 int number_of_landmarks =
mServices->patient()->getLandmarkProperties().size();
247 int number_of_metrics = point_metrics.size();
248 for(
int i=number_of_landmarks; i<number_of_metrics; ++i)
250 QString uid =
mServices->patient()->addLandmark();
253 for(; it != point_metrics.end(); ++it)
262 QString point_metric_name = point_metric->getName();
263 image->getLandmarks()->setLandmark(
Landmark(point_metric_name, pos_x));
277 bool loaded = this->getCurrentData() != 0;
285 DataPtr image = this->getCurrentData();
288 mAddLandmarkButton->setToolTip(QString(
"Add landmark to image %1").arg(image->getName()));
289 mEditLandmarkButton->setToolTip(QString(
"Resample landmark in image %1").arg(image->getName()));
298 if(!mUseRegistrationFixedPropertyInsteadOfActiveImage)
323 this->showOrHideDetails();
328 DataPtr image = this->getCurrentData();
332 return image->getLandmarks()->getLandmarks();
340 DataPtr image = this->getCurrentData();
342 return Transform3D::Identity();
343 return image->get_rMd();
348 DataPtr image = this->getCurrentData();
351 image->getLandmarks()->setLandmark(
Landmark(uid, p_target));
356 DataPtr image = this->getCurrentData();
359 return image->getName();
void reportError(QString msg)
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
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void setValue(const QString &key, const QVariant &value)
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class PickerRep > PickerRepPtr
Picking of points in an image.
Vector3D getCoordinate() const
boost::shared_ptr< class RegServices > RegServicesPtr
Settings * settings()
Shortcut for accessing the settings instance.
void changed()
emit when the underlying data value is changed: The user interface will be updated.
Data class that represents a single point.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
std::map< QString, class Landmark > LandmarkMap
static QString getTypeName()
Namespace for all CustusX production code.
boost::shared_ptr< class PointMetric > PointMetricPtr