Visualisierung 2
Comparison of Hue Preserving Rendering to Alpha Composing
Volume.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <vector>
10 #include <string>
11 #include <iostream>
12 
13 #include <QProgressBar>
14 
15 #include <QOpenGLTexture>
16 
17 
18 //-------------------------------------------------------------------------------------------------
19 // Voxel
20 //-------------------------------------------------------------------------------------------------
21 
25 class Voxel
26 {
27  public:
28 
29  Voxel();
30  Voxel(const Voxel &other);
31  Voxel(const float value);
32 
33  ~Voxel();
34 
35 
36  // VOXEL VALUE
37 
38  void setValue(const float value);
39  const float getValue() const;
40 
41 
42  // OPERATORS
43 
44  const bool operator==(const Voxel &other) const;
45  const bool operator!=(const Voxel &other) const;
46  const bool operator>(const Voxel &other) const;
47  const bool operator>=(const Voxel &other) const;
48  const bool operator<(const Voxel &other) const;
49  const bool operator<=(const Voxel &other) const;
50 
51  const Voxel operator+(const Voxel &other) const;
52  const Voxel operator-(const Voxel &other) const;
53  const Voxel operator*(const float &value) const;
54  const Voxel operator/(const float &value) const;
55 
56  const Voxel& operator+=(const Voxel &other);
57  const Voxel& operator-=(const Voxel &other);
58  const Voxel& operator*=(const float &value);
59  const Voxel& operator/=(const float &value);
60 
61 
62  private:
63 
64  float m_Value;
65 
66 };
67 
68 
69 //-------------------------------------------------------------------------------------------------
70 // Volume
71 //-------------------------------------------------------------------------------------------------
72 
76 class Volume
77 {
78 
79  public:
80 
81  Volume();
82  ~Volume();
83 
84 
85  // VOLUME DATA
86 
87  const Voxel& voxel(const int i) const;
88  const Voxel& voxel(const int x, const int y, const int z) const;
89  const Voxel* voxels() const;
90 
91  const int width() const;
92  const int height() const;
93  const int depth() const;
94 
95  const int size() const;
96 
97  bool loadFromFile(QString filename, QProgressBar* progressBar);
98 
104  QOpenGLTexture* generate3DTex();
105 
106  private:
107 
108  std::vector<Voxel> m_Voxels;
109 
110  int m_Width;
111  int m_Height;
112  int m_Depth;
113 
114  int m_Size;
115 
116 };
const bool operator>=(const Voxel &other) const
Definition: Volume.cpp:61
const Voxel & operator*=(const float &value)
Definition: Volume.cpp:88
Voxel()
Definition: Volume.cpp:17
const Voxel & voxel(const int i) const
Definition: Volume.cpp:147
Modified volume loader class from Vis 1.
Definition: Volume.h:76
const Voxel operator+(const Voxel &other) const
Definition: Volume.cpp:100
const bool operator<(const Voxel &other) const
Definition: Volume.cpp:66
const Voxel operator*(const float &value) const
Definition: Volume.cpp:114
~Volume()
Definition: Volume.cpp:138
const int size() const
Definition: Volume.cpp:172
const bool operator<=(const Voxel &other) const
Definition: Volume.cpp:71
void setValue(const float value)
Definition: Volume.cpp:36
QOpenGLTexture * generate3DTex()
generate3DTex transforms the loaded volume data set into a 3D texture which can be sampled in the gls...
Definition: Volume.cpp:257
const Voxel & operator+=(const Voxel &other)
Definition: Volume.cpp:76
const int depth() const
Definition: Volume.cpp:167
const Voxel operator/(const float &value) const
Definition: Volume.cpp:121
const Voxel & operator-=(const Voxel &other)
Definition: Volume.cpp:82
const Voxel * voxels() const
Definition: Volume.cpp:152
const bool operator!=(const Voxel &other) const
Definition: Volume.cpp:51
const Voxel operator-(const Voxel &other) const
Definition: Volume.cpp:107
Helper class for Voxels with basic operators.
Definition: Volume.h:25
const float getValue() const
Definition: Volume.cpp:41
bool loadFromFile(QString filename, QProgressBar *progressBar)
Definition: Volume.cpp:182
~Voxel()
Definition: Volume.cpp:32
const bool operator==(const Voxel &other) const
Definition: Volume.cpp:46
const bool operator>(const Voxel &other) const
Definition: Volume.cpp:56
const int height() const
Definition: Volume.cpp:162
const Voxel & operator/=(const float &value)
Definition: Volume.cpp:94
Volume()
Definition: Volume.cpp:133
const int width() const
Definition: Volume.cpp:157