Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BCC/Unimodal/3d/1B/Intensity/ShearWarp/shearWarp.h

Go to the documentation of this file.
00001 
00002 //                                                                    //
00003 // Informatikpraktikum I "Implementation of the ShearWarp Algorithm"  //
00004 // Februar - October 2002                                             //
00005 //                                                                    //
00006 // author: Sebastian Zambal                                           //
00007 //         e9826978@student.tuwien.ac.at                              //
00008 //                                                                    //
00009 // file:   shearWarp.h (BCC-grids)                                    //
00010 //                                                                    //
00012 
00014 #define VIEWING_MODE_ORTHO 0
00015 
00017 #define VIEWING_MODE_PERSPECTIVE 1
00018 
00020 #define XDIR 0
00021 
00022 #define YDIR 1
00023 
00024 #define ZDIR 2
00025 
00026 #define WDIR 3
00027 
00029 
00033 #define THRESHOLD_RUNLENGTH 0.05
00034 
00037 
00042 #define MIN_TRANSPARENCY_MAKING_INTERMEDIATE 0.05
00043 
00044 
00046 #define OPENGL_PLANE_SIZE 140
00047 
00048 //The zoom factor
00049 #define ZOOM_FACTOR 250
00050 
00051 #ifndef _VUVOLUMEBCCUNIMODAL3D1B1VALSHEARWARP_H_
00052 #define _VUVOLUMEBCCUNIMODAL3D1B1VALSHEARWARP_H_
00053 
00054 #include "../intensity.h"
00055 #include "glos.h"
00056 #include <GL/gl.h>
00057 #include <GL/glu.h>
00058 #include "vuSimpleTypes.h"
00059 #include "vuNormalTable.h"
00060 #include "vuVector.h"
00061 #include "vuMatrix.h"
00062 
00064 
00068 struct RLEvoxel_bcc {
00070     byte value;
00072     float red;
00074     float green;
00076     float blue;
00078     float red_shaded;
00080     float green_shaded;
00082     float blue_shaded;
00084     float opacity;
00086     float opacity_corr;
00088     vuVector normal;
00089 };
00090 
00092 
00097 struct RLEslice_bcc {
00099     float dim1_pos,dim2_pos;
00101     dword size;
00103     float scale;
00105     byte *runlength;
00107     RLEvoxel_bcc *voxel;
00108 };
00109 
00111 
00114 struct intermediatePixel_bcc {
00116     float red;
00118     float green;
00120     float blue;
00122     float trans;
00124     dword offset;
00125 };
00126 
00128 class vu1512119;
00129 typedef vu1512119 vuVolumeBccUnimodal3d1B1ValShearWarp;
00130 
00132 
00141 class vu1512119 : public vu151211
00142 {
00143 public:
00144 
00146 
00153     vu1512119();
00154 
00156 
00160     virtual ~vu1512119();
00161 
00162 public:
00164 
00171     void setCanvasSize(int width, int height);
00172 
00174 
00181     void setOrthogonalWarpOpenGL(int useOpenGL);
00182 
00184 
00190     void runlengthEncode();
00191 
00193 
00196     void removeRunlengthEncoding();
00197 
00199 
00205     void setSpecular(int spec);
00206 
00208 
00215     void setViewing(int mode);
00216 
00218 
00224     int getFastClassification();
00225 
00227 
00231     void setViewVectors(const vuVector& view,const vuVector& up,const vuVector& right);
00232 
00234     void getDimensions(int &x, int &y, int &z);
00236     int getMaxSize(void);
00237 
00239 
00242     void zoom(float zoomValue);
00243  
00245 
00248     void initOpenGL(void);
00249 
00251 
00255     void render(void);
00256 
00258     virtual bool read(void);
00259     
00261     virtual bool readRaw(void);
00262 
00264     float getMinEyeDistance(void);
00265 
00267 
00270     void setEyeDistance(float distance);
00271 
00272 private:
00274     void computeMaxSize(void);
00275 
00277     void computeNormals(void);
00278 
00280     void computeMainViewingDirection(void);
00281 
00283     void computePermutationMatrix(void);
00284 
00286     void computeViewMatrix(void);
00287 
00289     void computeEyePoint(void);
00290 
00292     void computeRunlengthSizes(void);
00293 
00295     void computeShearAndWarpFactorsOrtho(void);
00296 
00298     void shearOrtho(void);
00299 
00301 
00304     float computeZNormalizedViewingVectorLength(void);
00305 
00307     void computeInvWarpOrtho(void);
00308 
00310     void warpOrthoInv(float x, float y, float &x_result, float &y_result);
00311 
00313     void warpOrtho();
00314 
00316     void makeIntermediateImageOrtho(void);
00317 
00319     void changeFormatIntermediate(void);
00320 
00322     void drawWarpOpenGL(void);
00323 
00325     byte getSample(dword x, dword y, dword z);
00326 
00328     void computeShearPerspective(void);
00329 
00331     void computeWarpPerspective(void);
00332 
00334 
00340     void computeSlicePositionScale(float &pos_i, float &pos_j, float &scale, int slice);
00341 
00343     void shearPerspective(void);
00344 
00346 
00354     void warpPerspectiveInv(float x, float y, float &x_result, float &y_result);
00355 
00357     void warpPerspective(void);
00358 
00360     void makeIntermediateImagePerspective(void);
00361 
00363     void drawOpenGL(void);
00364 
00366     void createGLImage(void);
00367     
00368 
00369 private:
00371     float*       m_Normals;
00372 
00374     vuVector     m_View;
00375 
00377     vuVector     m_Up;
00378 
00380     vuVector     m_Right;
00381 
00383 
00388     vuMatrix     viewMatrix;
00389 
00391 
00396     vuMatrix     permMatrix;
00397 
00399 
00403     vuMatrix     worldMatrix;
00404 
00406 
00410     vuMatrix     shearMatrix;
00411 
00413 
00417     vuMatrix     warpMatrix;
00418 
00420 
00426     vuMatrix     invWarpMatrix;
00427 
00430 
00433     vuMatrix     projMatrix;
00434 
00436 
00439     vuMatrix     invWorldMatrix;
00440 
00442     float invWarpOrtho00;
00444     float invWarpOrtho01;
00446     float invWarpOrtho10;
00448     float invWarpOrtho11;
00449 
00451     vuVector eye_o;
00453     vuVector eye_s;
00454 
00456     int mainViewingDir;
00457 
00459 
00463     int canvasWidth;
00465 
00469     int canvasHeight;
00470 
00472     GLuint m_GLShearWarp;
00473 
00475     int viewingMode;
00477     int specular;
00479     int orthoWarpOpenGL;
00480 
00482     RLEslice_bcc* dataX;
00484     RLEslice_bcc* dataY;
00486     RLEslice_bcc* dataZ;
00487 
00489 
00493     RLEslice_bcc* curr;
00494 
00496 
00501     byte direction;
00502 
00504 
00507     dword maxSize;
00508 
00510 
00513     dword volumeDepth;
00515 
00518     dword volumeWidth;
00520 
00523     dword volumeHeight;
00524 
00526 
00530     double si;
00532 
00536     double sj;
00537 
00540     float ti;
00543     float tj;
00544 
00546 
00548     intermediatePixel_bcc* intermediate;
00549 
00550     //Distance between eye point and projection plane (only for perspective)
00551     float eye_distance;
00552 
00554     int left;
00555     int right;
00556     int up;
00557     int down;
00558 
00560 
00563     float scale_total;
00564 
00566     float zoomValue;
00567 
00569     GLubyte *glImage;
00570 
00572     int glImageWidth;
00574     int glImageHeight;
00575 };
00576 
00577 #endif
00578 
00579 
00580 
00581 
00582 
00583 
00584 
00585 
00586 
00587 
00588 
00589 
00590 
00591 

Generated on Wed Dec 15 21:20:31 2004 for vuVolume by  doxygen 1.3.9.1