00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00014 #define ALL_TRANSPARENT 0
00015
00017 #define ALL_NON_TRANSPARENT 1
00018
00020 #define COMBINATION 2
00021
00023 #define XDIR 0
00024
00025 #define YDIR 1
00026
00027 #define ZDIR 2
00028
00029 #define WDIR 3
00030
00031 #include "../intensity.h"
00032 #include "glos.h"
00033 #include <GL/gl.h>
00034 #include <GL/glu.h>
00035 #include "vuSimpleTypes.h"
00036 #include "vuNormalTable.h"
00037 #include "vuVector.h"
00038 #include "vuMatrix.h"
00039
00041
00045 struct Node {
00047 byte min;
00049 byte max;
00051 int maxX;
00053 int maxY;
00055 int maxZ;
00057 int minX;
00059 int minY;
00061 int minZ;
00063
00068 byte classification;
00070 Node *children[8] ;
00072 int noChildren;
00073 };
00074
00075
00076
00077 class Octree;
00078 class SummedAreaTable;
00079 class FastClassification;
00080
00082
00087 class Octree
00088 {
00089 public:
00091
00097 Octree(byte *volumeData, int maxX, int maxY, int maxZ);
00098
00100
00103 ~Octree();
00104
00106
00111 void remove(Node *tree);
00112
00114
00124 Node *build(int minX, int minY, int minZ,
00125 int maxX, int maxY, int maxZ,
00126 int count);
00127
00129
00136 byte getData(int x, int y, int z);
00137
00139
00144 void classify(SummedAreaTable *sat);
00145
00147
00153 void classify(SummedAreaTable *sat, Node *tree);
00154
00156
00167 int skip(int x, int y, int z, int mainViewingDir);
00168
00170
00179 int skip(int x, int y, int z, int mainViewingDir, Node *tree);
00180
00181 private:
00183 Node *root;
00184
00186 byte *data;
00187
00189 int width;
00191 int height;
00193 int depth;
00194
00196
00199 int step_dim3;
00200 };
00201
00203
00209 class SummedAreaTable
00210 {
00211 public:
00213
00216 SummedAreaTable(void);
00217
00219
00222 ~SummedAreaTable();
00223
00225
00233 void build(float *transferFunction, float threshold_runlength);
00234
00236
00245 int transparent(byte min, byte max);
00246
00247 private:
00249
00252 int *table;
00253 };
00254
00256
00261 class FastClassification
00262 {
00263 public:
00265
00271 FastClassification(byte *volumeData,
00272 int dim1Size,
00273 int dim2Size,
00274 int dim3Size);
00275
00277 ~FastClassification(void);
00278
00280
00285 void buildSummedAreaTable(float *transferFunction,
00286 float threshold_runlength);
00287
00289 void classify(void);
00290
00292
00298 int skip(int x, int y, int z, int mainViewingDirection);
00299
00300 private:
00301
00303 Octree *octree;
00304
00306 SummedAreaTable *sTable;
00307
00309 byte *data;
00310
00312 int width;
00314 int height;
00316 int depth;
00317
00319 float *TFunc;
00320 };
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333