-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathview_options_dialog.cc
172 lines (141 loc) · 4.86 KB
/
view_options_dialog.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/**
* Copyright (c) 2015, Lehigh University
* All rights reserved.
* See COPYING for license.
*
* This file implements the view options dialog for SOAX.
*/
#include "./view_options_dialog.h"
#include <QtGui>
namespace soax {
ViewOptionsDialog::ViewOptionsDialog(QWidget *parent) : QDialog(parent) {
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(this->CreateSlicePlanesGroup());
layout->addWidget(this->CreateMIPGroup());
layout->addWidget(this->CreateClipGroup());
layout->addWidget(this->CreateColorOrientationGroup());
button_box_ = new QDialogButtonBox(QDialogButtonBox::Ok |
QDialogButtonBox::Cancel);
layout->addWidget(button_box_);
setLayout(layout);
setWindowTitle(tr("View Options"));
connect(button_box_, SIGNAL(accepted()), this, SLOT(accept()));
connect(button_box_, SIGNAL(rejected()), this, SLOT(reject()));
}
QGroupBox * ViewOptionsDialog::CreateSlicePlanesGroup() {
QGroupBox *gb = new QGroupBox(tr("Window/Level for Slice Planes"));
window_edit_ = new QLineEdit("0");
level_edit_ = new QLineEdit("0");
connect(window_edit_, SIGNAL(textChanged(const QString &)),
this, SLOT(EnableOKButton()));
connect(level_edit_, SIGNAL(textChanged(const QString &)),
this, SLOT(EnableOKButton()));
QLabel *window_label = new QLabel(tr("Win"));
QLabel *level_label = new QLabel(tr("Lev"));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(window_label);
layout->addWidget(window_edit_);
layout->addWidget(level_label);
layout->addWidget(level_edit_);
gb->setLayout(layout);
return gb;
}
QGroupBox * ViewOptionsDialog::CreateMIPGroup() {
QGroupBox *gb = new QGroupBox(tr("Intensity Range for MIP Rendering"));
min_intensity_edit_ = new QLineEdit("0");
max_intensity_edit_ = new QLineEdit("0");
connect(min_intensity_edit_, SIGNAL(textChanged(const QString &)),
this, SLOT(EnableOKButton()));
connect(max_intensity_edit_, SIGNAL(textChanged(const QString &)),
this, SLOT(EnableOKButton()));
QLabel *min_intensity_label = new QLabel(tr("Min"));
QLabel *max_intensity_label = new QLabel(tr("Max"));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(min_intensity_label);
layout->addWidget(min_intensity_edit_);
layout->addWidget(max_intensity_label);
layout->addWidget(max_intensity_edit_);
gb->setLayout(layout);
return gb;
}
QGroupBox * ViewOptionsDialog::CreateClipGroup() {
QGroupBox *gb = new QGroupBox(tr("Show Snake Locally"));
clip_span_edit_ = new QLineEdit("0.0");
connect(clip_span_edit_, SIGNAL(textChanged(const QString &)),
this, SLOT(EnableOKButton()));
QLabel *label = new QLabel(tr("Interval"));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(label);
layout->addWidget(clip_span_edit_);
layout->addStretch();
gb->setLayout(layout);
return gb;
}
QGroupBox *ViewOptionsDialog::CreateColorOrientationGroup() {
QGroupBox *gb = new QGroupBox(tr("Color Snake Orientation"));
color_segment_step_edit_ = new QLineEdit("0");
connect(color_segment_step_edit_, SIGNAL(textChanged(const QString &)),
this, SLOT(EnableOKButton()));
QLabel *label = new QLabel(tr("Segment size"));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(label);
layout->addWidget(color_segment_step_edit_);
layout->addStretch();
gb->setLayout(layout);
return gb;
}
void ViewOptionsDialog::EnableOKButton() {
button_box_->button(QDialogButtonBox::Ok)->setEnabled(true);
}
void ViewOptionsDialog::DisableOKButton() {
button_box_->button(QDialogButtonBox::Ok)->setEnabled(false);
}
double ViewOptionsDialog::GetWindow() const {
return window_edit_->text().toDouble();
}
double ViewOptionsDialog::GetLevel() const {
return level_edit_->text().toDouble();
}
void ViewOptionsDialog::SetWindow(double window) {
QString s;
s.setNum(window);
window_edit_->setText(s);
}
void ViewOptionsDialog::SetLevel(double level) {
QString s;
s.setNum(level);
level_edit_->setText(s);
}
double ViewOptionsDialog::GetMinIntensity() const {
return min_intensity_edit_->text().toDouble();
}
double ViewOptionsDialog::GetMaxIntensity() const {
return max_intensity_edit_->text().toDouble();
}
void ViewOptionsDialog::SetMinIntensity(double min) {
QString s;
s.setNum(min);
min_intensity_edit_->setText(s);
}
void ViewOptionsDialog::SetMaxIntensity(double max) {
QString s;
s.setNum(max);
max_intensity_edit_->setText(s);
}
double ViewOptionsDialog::GetClipSpan() const {
return clip_span_edit_->text().toDouble();
}
void ViewOptionsDialog::SetClipSpan(double span) {
QString s;
s.setNum(span);
clip_span_edit_->setText(s);
}
unsigned ViewOptionsDialog::GetColorSegmentStep() const {
return color_segment_step_edit_->text().toUInt();
}
void ViewOptionsDialog::SetColorSegmentStep(unsigned step) {
QString s;
s.setNum(step);
color_segment_step_edit_->setText(s);
}
} // namespace soax