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)
93 QHBoxLayout* landmarkButtonsLayout =
new QHBoxLayout;
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
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));
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)
255 PointMetricPtr point_metric = boost::static_pointer_cast<PointMetric>(it->second);
259 Vector3D pos_x = point_metric->getCoordinate();
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();