00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include <QtGui>
00045
00046 #include "vrglwidget.h"
00047 #include "window.h"
00048
00049 Window::Window()
00050 {
00051 xSlider = createSlider();
00052 ySlider = createSlider();
00053 zSlider = createSlider();
00054
00055 QGroupBox *vrGroup = new QGroupBox(this);
00056 vrGroup->setTitle("Volume rendering");
00057
00058 QGroupBox *pcGroup = new QGroupBox(this);
00059 pcGroup->setTitle("Multi-scale parallel coordinates");
00060
00061 QGroupBox *tfGroup = new QGroupBox(this);
00062 tfGroup->setTitle("Transfer functions");
00063
00064 QHBoxLayout *mainLayout = new QHBoxLayout(this);
00065 mainLayout->addWidget(vrGroup);
00066 mainLayout->addWidget(pcGroup);
00067 mainLayout->addWidget(tfGroup);
00068
00069 QVBoxLayout *vrGroupLayout = new QVBoxLayout(vrGroup);
00070 m_vrGLWidget = new vrGLWidget(vrGroup);
00071 vrGroupLayout->addWidget(m_vrGLWidget);
00072
00073
00074 QGroupBox *sliceGroup = new QGroupBox(vrGroup);
00075 sliceGroup->setTitle("Slice view");
00076 vrGroupLayout->addWidget(sliceGroup);
00077
00078 QHBoxLayout *vrsliceLayout = new QHBoxLayout(sliceGroup);
00079 m_sliceWidget1 = new sliceWidget1(vrGroup);
00080 vrsliceLayout->addWidget(m_sliceWidget1);
00081 m_sliceWidget2 = new sliceWidget2(vrGroup);
00082 vrsliceLayout->addWidget(m_sliceWidget2);
00083
00084 QGroupBox *defaultDataGroup = new QGroupBox(vrGroup);
00085 defaultDataGroup->setTitle("Default data");
00086 vrGroupLayout->addWidget(defaultDataGroup);
00087
00088 QHBoxLayout *defaultDataGroupLayout = new QHBoxLayout(defaultDataGroup);
00089 load_button1 = new QPushButton("Dataset 1");
00090 defaultDataGroupLayout->addWidget(load_button1);
00091 load_button2 = new QPushButton("Dataset 2");
00092 defaultDataGroupLayout->addWidget(load_button2);
00093
00094 QVBoxLayout *pcGroupLayout = new QVBoxLayout(pcGroup);
00095 m_pcWidget = new pcWidget(pcGroup);
00096 pcGroupLayout->addWidget(m_pcWidget);
00097
00098 QHBoxLayout *tfGroupLayout = new QHBoxLayout(tfGroup);
00099 tf_editor = new GradientWidget(this);
00100 tf_editor1 = new GradientWidget(this);
00101 tf_editor2 = new GradientWidget(this);
00102 tf_editor3 = new GradientWidget(this);
00103
00104 tabWidget = new QTabWidget;
00105
00106 tfGroupLayout->addWidget(tabWidget);
00107 tabWidget->addTab(tf_editor, tr("Scale 0"));
00108 tabWidget->addTab(tf_editor1, tr("Scale 1"));
00109 tabWidget->addTab(tf_editor2, tr("Scale 2"));
00110 tabWidget->addTab(tf_editor3, tr("Scale 3"));
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 connect(xSlider, SIGNAL(valueChanged(int)), m_vrGLWidget, SLOT(setXRotation(int)));
00132 connect(m_vrGLWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
00133 connect(ySlider, SIGNAL(valueChanged(int)), m_vrGLWidget, SLOT(setYRotation(int)));
00134 connect(m_vrGLWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
00135 connect(zSlider, SIGNAL(valueChanged(int)), m_vrGLWidget, SLOT(setZRotation(int)));
00136 connect(m_vrGLWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));
00137
00138 connect(load_button1, SIGNAL(clicked()), this, SLOT(setdefaultVB1()));
00139 connect(load_button2, SIGNAL(clicked()), this, SLOT(setdefaultVB2()));
00140
00141
00142 connect(this, SIGNAL(vbchanged(VolumeBuffer*)),m_vrGLWidget, SLOT(vr_load_data1(VolumeBuffer*)));
00143 connect(this, SIGNAL(vbchanged(VolumeBuffer*)),m_pcWidget, SLOT(set_pc_data(VolumeBuffer*)));
00144
00145 connect(this, SIGNAL(sb1changed(VolumeBuffer*)),m_sliceWidget1, SLOT(vr_load_data2(VolumeBuffer*)));
00146 connect(this, SIGNAL(sb2changed(VolumeBuffer*)),m_sliceWidget2, SLOT(vr_load_data3(VolumeBuffer*)));
00147
00148
00149 connect(tf_editor, SIGNAL(tfready(QImage &)), m_vrGLWidget, SLOT(setTFtexture(QImage &)));
00150 connect(tf_editor1, SIGNAL(tfready(QImage &)), m_vrGLWidget, SLOT(setTFtexture1(QImage &)));
00151 connect(tf_editor2, SIGNAL(tfready(QImage &)), m_vrGLWidget, SLOT(setTFtexture2(QImage &)));
00152 connect(tf_editor3, SIGNAL(tfready(QImage &)), m_vrGLWidget, SLOT(setTFtexture3(QImage &)));
00153
00154 connect(tf_editor, SIGNAL(tfready(QImage &)), m_sliceWidget2, SLOT(setTFtexture(QImage &)));
00155 connect(tf_editor1, SIGNAL(tfready(QImage &)), m_sliceWidget2, SLOT(setTFtexture1(QImage &)));
00156 connect(tf_editor2, SIGNAL(tfready(QImage &)), m_sliceWidget2, SLOT(setTFtexture2(QImage &)));
00157 connect(tf_editor3, SIGNAL(tfready(QImage &)), m_sliceWidget2, SLOT(setTFtexture3(QImage &)));
00158
00159
00160 connect(tf_editor, SIGNAL(tfready(QImage &)), m_pcWidget, SLOT(setTFtexture(QImage &)));
00161 connect(tf_editor1, SIGNAL(tfready(QImage &)), m_pcWidget, SLOT(setTFtexture1(QImage &)));
00162 connect(tf_editor2, SIGNAL(tfready(QImage &)), m_pcWidget, SLOT(setTFtexture2(QImage &)));
00163 connect(tf_editor3, SIGNAL(tfready(QImage &)), m_pcWidget, SLOT(setTFtexture3(QImage &)));
00164
00165 connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(changeScale(int)));
00166
00167 connect(m_sliceWidget1, SIGNAL(sliceChanged(int)), m_sliceWidget2, SLOT(setSlice(int)));
00168 connect(m_sliceWidget1, SIGNAL(sliceChanged(int)), m_pcWidget, SLOT(setSlice(int)));
00169
00170 connect(m_sliceWidget1, SIGNAL(selectionChanged(QPair<QPointF,QPointF> &)), m_pcWidget, SLOT(sedSelectionQuad(QPair<QPointF,QPointF> &)));
00171
00172 setLayout(mainLayout);
00173
00174 setWindowTitle(tr("rcube 0.1"));
00175
00176 m_vb = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 3);
00177 m_sb1 = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 0);
00178 m_sb2 = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 0);
00179
00180 m_scale = 0;
00181 }
00182
00183 Window::~Window()
00184 {
00185 }
00186
00187 QSlider *Window::createSlider()
00188 {
00189 QSlider *slider = new QSlider(Qt::Vertical);
00190 slider->setRange(0, 360 * 16);
00191 slider->setSingleStep(16);
00192 slider->setPageStep(15 * 16);
00193 slider->setTickInterval(15 * 16);
00194 slider->setTickPosition(QSlider::TicksRight);
00195 return slider;
00196 }
00197
00198 void Window::setdefaultVB(int dataset)
00199 {
00200 switch (dataset){
00201 case 1:
00202 m_vb = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 3);
00203 m_vb->readRawFile("C:/data/head.raw");
00204 m_vb->readScale1File("C:/data/head36x36x19.raw");
00205 m_vb->readScale2File("C:/data/head64x64x19.raw");
00206 m_vb->readScale3File("C:/data/head99x99x19.raw");
00207 emit vbchanged(m_vb);
00208
00209 m_sb1 = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 0);
00210 m_sb1->readRawFile("C:/data/head.raw");
00211 emit sb1changed(m_sb1);
00212
00213 m_sb2 = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 3);
00214 m_sb2->readRawFile("C:/data/head.raw");
00215 m_sb2->readScale1File("C:/data/head36x36x19.raw");
00216 m_sb2->readScale2File("C:/data/head64x64x19.raw");
00217 m_sb2->readScale3File("C:/data/head99x99x19.raw");
00218 emit sb2changed(m_sb2);
00219 break;
00220 case 2:
00221 m_vb = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 3);
00222 m_vb->readRawFile("C:/data/aj.raw");
00223 m_vb->readScale1File("C:/data/aj36x36x19.raw");
00224 m_vb->readScale2File("C:/data/aj64x64x19.raw");
00225 m_vb->readScale3File("C:/data/aj99x99x19.raw");
00226 emit vbchanged(m_vb);
00227
00228 m_sb1 = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 0);
00229 m_sb1->readRawFile("C:/data/aj.raw");
00230 emit sb1changed(m_sb1);
00231
00232 m_sb2 = new VolumeBuffer(GL_UNSIGNED_BYTE, 256, 256, 256, 3);
00233 m_sb2->readRawFile("C:/data/aj.raw");
00234 m_sb2->readRawFile("C:/data/aj.raw");
00235 m_sb2->readScale1File("C:/data/aj36x36x19.raw");
00236 m_sb2->readScale2File("C:/data/aj64x64x19.raw");
00237 m_sb2->readScale3File("C:/data/aj99x99x19.raw");
00238 emit sb2changed(m_sb2);
00239 break;
00240 }
00241 }
00242
00243 void Window::changeScale(int scale)
00244 {
00245 std::cout << "scale:" << scale << "\n";
00246 }
00247