NorMIT-nav  22.09
An IGT application
cxICPWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #include "cxICPWidget.h"
12 
13 #include <QPushButton>
14 #include <QLabel>
15 #include <QSpinBox>
16 #include <QCheckBox>
17 #include <QGroupBox>
18 #include <vtkCellArray.h>
19 #include "cxTypeConversions.h"
20 #include "cxLogger.h"
21 #include "cxTimedAlgorithm.h"
25 #include "cxMesh.h"
26 #include "cxView.h"
27 #include "cxGeometricRep.h"
28 #include "cxGraphicalPrimitives.h"
29 #include "cxRegistrationService.h"
30 #include "cxViewService.h"
31 #include "cxPatientModelService.h"
32 #include "cxHelperWidgets.h"
33 
34 namespace cx
35 {
36 
37 ICPWidget::ICPWidget(QWidget* parent) :
38  BaseWidget(parent, "ICPWidget", "ICPWidget")
39 {
40  QHBoxLayout * buttonLayout = new QHBoxLayout;
41 
42  mRegisterButton = new QPushButton("Register");
43  mRegisterButton->setEnabled(false);
44  connect(mRegisterButton, &QPushButton::clicked, this, &ICPWidget::requestRegister);
45  buttonLayout->addWidget(mRegisterButton, 1, 0);
46 
47  mMetricValue = new QLineEdit(this);
48  mMetricValue->setReadOnly(true);
49  mMetricValue->setToolTip("Current RMS deviation between data sets");
50  buttonLayout->addWidget(mMetricValue);
51 
52  mVesselRegOptionsButton = this->createAction2(this,
53  QIcon(":/icons/open_icon_library/system-run-5.png"),
54  "Options",
55  "Options for controlling ICP algorithm",
56  buttonLayout);
57  mVesselRegOptionsButton->setCheckable(true);
58 
59 
60  mOptionsWidget = new QWidget(this);
61  mVesselRegOptionsWidget = this->wrapInGroupBox(mOptionsWidget, "ICP options");
62  connect(mVesselRegOptionsButton, &QAction::toggled, mVesselRegOptionsWidget, &QWidget::setVisible);
63 
64  QVBoxLayout* layout = new QVBoxLayout(this);
65  layout->addLayout(buttonLayout);
66  layout->addWidget(mVesselRegOptionsWidget);
67 
68  this->enableRegistration(false);
69 }
70 
72 {
73 }
74 
75 void ICPWidget::setSettings(std::vector<PropertyPtr> properties)
76 {
77  QGridLayout* layout = new QGridLayout(mOptionsWidget);
78 
79  int row=0;
80  for (unsigned i=0; i< properties.size(); ++i)
81  sscCreateDataWidget(this, properties[i], layout, i);
82 }
83 
85 {
86  mRegisterButton->setEnabled(on);
87  mVesselRegOptionsButton->setEnabled(true);
88  mVesselRegOptionsWidget->setVisible(mVesselRegOptionsButton->isChecked());
89 // mVesselRegOptionsButton->setEnabled(on);
90 // mVesselRegOptionsWidget->setVisible(mVesselRegOptionsButton->isChecked() && on);
91 }
92 
93 void ICPWidget::setRMS(double val)
94 {
95  mMetricValue->setText(QString("%1mm").arg(val, 0, 'f', 3));
96 }
97 
98 }//namespace cx
cxLogger.h
cx::ICPWidget::setSettings
void setSettings(std::vector< PropertyPtr > properties)
Definition: cxICPWidget.cpp:75
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ICPWidget::ICPWidget
ICPWidget(QWidget *parent)
Definition: cxICPWidget.cpp:37
cx::BaseWidget
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
cx::ICPWidget::requestRegister
void requestRegister()
cxLabeledComboBoxWidget.h
cxGraphicalPrimitives.h
cxGeometricRep.h
cxHelperWidgets.h
SeansVesselReg.hxx
cx::BaseWidget::createAction2
QAction * createAction2(QObject *parent, QIcon iconName, QString text, QString tip, QLayout *layout=NULL, QToolButton *button=new QToolButton())
Definition: cxBaseWidget.h:108
cxICPWidget.h
cx::BaseWidget::wrapInGroupBox
QGroupBox * wrapInGroupBox(QWidget *base, QString name)
Definition: cxBaseWidget.cpp:82
cxViewService.h
cxTypeConversions.h
cxView.h
cxPatientModelService.h
cx::ICPWidget::enableRegistration
void enableRegistration(bool on)
Definition: cxICPWidget.cpp:84
cx::ICPWidget::~ICPWidget
virtual ~ICPWidget()
Definition: cxICPWidget.cpp:71
cx::ICPWidget::setRMS
void setRMS(double val)
Definition: cxICPWidget.cpp:93
cxRegistrationProperties.h
cx::sscCreateDataWidget
QWidget * sscCreateDataWidget(QWidget *parent, PropertyPtr data, QGridLayout *gridLayout, int row)
Create a widget capable of displaying the input data.
Definition: cxHelperWidgets.cpp:59
cxRegistrationService.h
cxMesh.h
cxTimedAlgorithm.h