forked from fuag15/volumetric_visualization_tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·106 lines (89 loc) · 3.63 KB
/
main.cpp
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
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>
#include <QFileDialog>
#include <QDockWidget>
#include <QSlider>
#include <QObject>
#include "ControlWindow.h"
#include "Viewer.h"
#include "ColorMap.h"
#include "HistogramWidget.h"
#include "IsoControlWindow.h"
#include "lightControlWindow.h"
#include "SlicesControllerWidget.h"
#include "vectorWindow.h"
#include "MainWindow.h"
int main(int argc, char **argv)
{
float alphaArray[1000];
for(int i = 0; i < 1000; i++)
{
alphaArray[i] = 1;
}
QApplication app(argc, argv);
ColorMap* cmap = new ColorMap;
ColorMap* smap = new ColorMap;
ColorMap* imap = new ColorMap;
MainWindow window(&app);
Viewer *viewer = new Viewer(&window);
viewer ->setApp(&app);
viewer-> setSlicesMap(smap);
ColorMap* gmap = new ColorMap;
ColorMap* lmap = new ColorMap;
viewer-> setGlyphSlicesMap(gmap);
viewer-> setLicSlicesMap(lmap);
viewer-> setColorMap(cmap);
viewer-> setAlphaMap(alphaArray);
viewer-> setIsoMap(imap);
window.setWindowTitle("Volumetric Viewer");
window.setCentralWidget(viewer);
QDockWidget* sideDock = new QDockWidget("Slices");
SlicesControllerWidget* sliceCon = new SlicesControllerWidget(sideDock);
QSlider* isoDetail = sliceCon -> getDetailSlider();
QSlider* alphaDetail = sliceCon -> getAlphaSlider();
sliceCon->setSliceMap(smap);
QObject::connect(isoDetail, SIGNAL(valueChanged(int)), viewer, SLOT(setIsoDetail(int)));
QObject::connect(alphaDetail, SIGNAL(valueChanged(int)), viewer, SLOT(setAlphaDetail(int)));
sideDock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
sideDock->setWidget(sliceCon);
window.addDockWidget(Qt::RightDockWidgetArea, sideDock);
QMenuBar *menuBar = new QMenuBar(&window);
menuBar->addAction("Quit", &app, SLOT(quit()));
menuBar->addAction("Open File", viewer, SLOT(readFile()));
ControlWindow cwindow(0);
cwindow.setWindowTitle("Color Mapping Controls");
cwindow.setCmap(cmap);
cwindow.setSmap(smap);
cwindow.setAlphaArray(alphaArray);
vectorWindow vwindow(0);
vwindow.setWindowTitle("Vector Visualization Controls");
vwindow.setGlyphSliceMap(gmap);
vwindow.setLicSliceMap(lmap);
IsoControlWindow iwindow(0);
iwindow.setWindowTitle("Iso Surface Controls");
iwindow.setCmap(cmap);
iwindow.setImap(imap);
cwindow.setSmap(smap);
cwindow.setAlphaArray(alphaArray);
// LightControlWindow lwindow(0);
// lwindow.setWindowTitle("Light Controls");
menuBar->addAction("Color Map", &cwindow, SLOT(show()));
menuBar->addAction("Iso Surface", &iwindow, SLOT(show()));
//menuBar->addAction("Light Controls", &lwindow, SLOT(show()));
menuBar->addAction("Vector Visualization", &vwindow, SLOT(show()));
window.setMenuBar(menuBar);
QObject::connect(viewer, SIGNAL(newFileLoaded(float*, int, int, int, float)), &cwindow, SLOT(fileOpened(float*, int, int, int, float)));
QObject::connect(viewer, SIGNAL(newFileLoaded(float*, int, int, int, float)), &iwindow, SLOT(fileOpened(float*, int, int, int, float)));
QObject::connect(&cwindow, SIGNAL(maxRange(int)), viewer, SLOT(setMaxRange(int)));
QObject::connect(&cwindow, SIGNAL(needUpdate()), &cwindow, SLOT(update()));
QObject::connect(viewer, SIGNAL(killOtherGl()), &cwindow, SLOT(close()));
QObject::connect(sliceCon, SIGNAL(reloadFrag()), viewer, SLOT(reloadShaders()));
QObject::connect(sliceCon, SIGNAL(toggleSlices()), viewer, SLOT(toggleSlices()));
QObject::connect(sliceCon, SIGNAL(toggleIsos()), viewer, SLOT(toggleIsoSurfaces()));
QObject::connect(sliceCon, SIGNAL(toggleVols()), viewer, SLOT(toggleVolSurfaces()));
QObject::connect(sliceCon, SIGNAL(toggleCut()), viewer, SLOT(toggleCuts()));
window.show();
//cwindow.show();
return app.exec();
}