34 #include <QHBoxLayout>
35 #include <QVBoxLayout>
39 #include <QGridLayout>
61 mVerticalLayout(new QVBoxLayout(this)),
62 mControlsEnabled(false),
63 mStorage(new
PatientStorage(services->session(),
"VirtualBronchoscopy"))
65 this->setObjectName(
"Virtual Bronchoscopy Widget");
66 this->setWindowTitle(
"Virtual Bronchoscopy");
67 this->setWhatsThis(this->defaultWhatsThis());
69 this->setFocusPolicy(Qt::StrongFocus);
72 mRouteToTarget->setValueName(
"Route to target path: ");
73 mStorage->storeVariable(
"routeToTarget",
78 QVBoxLayout *inputVbox =
new QVBoxLayout;
79 inputVbox->addWidget(
new DataSelectWidget(services->view(), services->patient(),
this,mRouteToTarget));
80 QGroupBox *inputBox =
new QGroupBox(tr(
"Input"));
81 inputBox->setLayout(inputVbox);
82 mVerticalLayout->addWidget(inputBox);
85 QHBoxLayout *playbackHBox =
new QHBoxLayout;
86 QGroupBox *playbackBox =
new QGroupBox(tr(
"Playback"));
87 mPlaybackSlider =
new QSlider(Qt::Horizontal);
88 QLabel *labelStart =
new QLabel(tr(
"Start "));
89 QLabel *labelTarget =
new QLabel(tr(
" Target"));
90 playbackHBox->addWidget(labelStart);
91 playbackHBox->addWidget(mPlaybackSlider);
92 playbackHBox->addWidget(labelTarget);
93 playbackBox->setLayout(playbackHBox);
94 mVerticalLayout->addWidget(playbackBox);
95 mPlaybackSlider->setMinimum(0);
96 mPlaybackSlider->setMaximum(100);
99 QGroupBox *endoscopeBox =
new QGroupBox(tr(
"Endoscope"));
100 QGridLayout *endoscopeControlLayout =
new QGridLayout;
101 QLabel *labelRot =
new QLabel(tr(
"Rotate"));
102 QLabel *labelView =
new QLabel(tr(
"Left/right (30 deg)"));
103 mRotateDial =
new QDial;
104 mRotateDial->setMinimum(-180);
105 mRotateDial->setMaximum(180);
106 mViewSlider =
new QDial;
107 mViewSlider->setMinimum(-30);
108 mViewSlider->setMaximum(30);
111 endoscopeControlLayout->addWidget(labelRot,0,0,Qt::AlignHCenter);
112 endoscopeControlLayout->addWidget(labelView,0,2,Qt::AlignHCenter);
113 endoscopeControlLayout->addWidget(mRotateDial,1,0);
114 endoscopeControlLayout->addWidget(mViewSlider,1,2);
115 endoscopeBox->setLayout(endoscopeControlLayout);
116 mVerticalLayout->addWidget(endoscopeBox);
118 this->setLayout(mVerticalLayout);
121 this->enableControls(
false);
123 mCameraPath =
new CXVBcameraPath(services->tracking(), services->patient(), services->view());
126 this, &VBWidget::inputChangedSlot);
132 mVerticalLayout->addStretch();
141 mRouteToTarget->setValue(uid);
142 mPlaybackSlider->setValue(5);
145 void VBWidget::enableControls(
bool enable)
147 mPlaybackSlider->setEnabled(enable);
148 mRotateDial->setEnabled(enable);
149 mViewSlider->setEnabled(enable);
150 mControlsEnabled = enable;
153 void VBWidget::inputChangedSlot()
155 this->enableControls(
true);
159 void VBWidget::keyPressEvent(QKeyEvent* event)
162 if (event->key()==Qt::Key_Up)
164 if(mControlsEnabled) {
165 int currentPos = mPlaybackSlider->value();
166 mPlaybackSlider->setValue(currentPos+1);
171 if (event->key()==Qt::Key_Down)
173 if(mControlsEnabled) {
174 int currentPos = mPlaybackSlider->value();
175 mPlaybackSlider->setValue(currentPos-1);
180 if (event->key()==Qt::Key_Right)
182 if(mControlsEnabled) {
183 int currentPos = mViewSlider->value();
184 mViewSlider->setValue(currentPos+1);
189 if (event->key()==Qt::Key_Left)
191 if(mControlsEnabled) {
192 int currentPos = mViewSlider->value();
193 mViewSlider->setValue(currentPos-1);
199 QWidget::keyPressEvent(event);
202 QString VBWidget::defaultWhatsThis()
const
205 "<h3>Virtual Bronchoscopy.</h3>"
206 "<p>GUI for visualizing a route-to-target path</p>"
void cameraRawPointsSlot(MeshPtr mesh)
boost::shared_ptr< class VisServices > VisServicesPtr
Helper class for storing variables in the patient file.
void dataChanged(QString)
void cameraRotateAngleSlot(int angle)
virtual QString getValue() const
get the data value.
void cameraViewAngleSlot(int angle)
void cameraPathPositionSlot(int pos)
static StringPropertySelectMeshPtr New(PatientModelServicePtr patientModelService)
virtual bool setValue(const QString &value)
set the data value.