Eigene Dateien/Vis/src/QVolRendCanvas.h

Go to the documentation of this file.
00001 #ifndef QVOLRENDCANVAS_H_
00002 #define QVOLRENDCANVAS_H_
00003 
00004 #include <Qt/qobject.h>
00005 
00006 #include <QtGui/QWidget>
00007 #include <QtOpenGL/QGLWidget>
00008 #include <QtGui/QKeyEvent>
00009 #include <QtGui/QMouseEvent>
00010 
00011 #include "VEvent.h"
00012 #include "VVolume.h"
00013 #include "VSliceRenderer.h"
00014 #include "VVolumeRenderer.h"
00015 #include "VTransferFunction.h"
00016 #include "VTransferFunction2D.h"
00017 #include "VImage.h"
00018 
00022 class VFramebufferObject;
00023 
00027 enum MouseState
00028 {
00029         NO_DRAGGING = 0,                
00030         ROTATE,                                 
00031         ZOOM,                                   
00032         PAN,                                    
00033 };
00034 
00035 
00039 class QVolRendCanvas : public QObject, public QGLWidget
00040 {
00041         Q_OBJECT
00042 
00043 public:
00044 
00049         QVolRendCanvas(QWidget* parent = 0);
00050         
00054         virtual ~QVolRendCanvas();
00055 
00060         void setObjectName(const QString &name);
00061 
00067     virtual void resizeGL( int w, int h );
00068 
00073         virtual void paintEvent( QPaintEvent *e );
00074 
00079         virtual void mousePressEvent ( QMouseEvent * e );
00080 
00085         virtual void mouseReleaseEvent ( QMouseEvent * e );
00086 
00091         virtual void mouseMoveEvent ( QMouseEvent * e );
00092 
00093 
00098         virtual void mouseDoubleClickEvent ( QMouseEvent * e );
00099 
00100 
00105         virtual void keyPressEvent ( QKeyEvent * e );
00106 
00107 
00112         virtual void keyReleaseEvent ( QKeyEvent * e );
00113 
00119         const VMouseEvent getMouseEvent (QMouseEvent *e);
00120 
00126         const VKeyboardEvent getKeyboardEvent (QKeyEvent *e);
00127 
00131         virtual void redraw();
00132 
00136         virtual void activate_sliceview();
00137 
00141         virtual void activate_volview();
00142 
00143 
00148         void setActiveSaggitalSlice(int s);
00149 
00150 
00155         void setActiveCorronalSlice(int s);
00156 
00157 
00162         void setActiveTransversalSlice(int s);
00163 
00168         void setApplyTFInSV(int v);
00169 
00174         void setApplyTFInVV(int v);
00175 
00180         void setBackColorPtr(VVector *v);
00181 
00186         void rendermode_changed(int i);
00187 
00192         void lightmode_changed(int i);
00193 
00198         bool getLoaded(){return data_loaded;};
00199 
00204         void setTransferFunctionPtr(VTransferFunction * transfunc);
00205 
00210         void setTransferFunction2DPtr(VTransferFunction2D * transfunc);
00211         
00215         void flipX();
00216 
00220         void flipY();
00221 
00225         void flipZ();
00226 
00231         void modifyLight(bool val);
00232 
00237         void setContourMode(bool val);
00238 
00243         void setShadowMode(bool val);
00244 
00250         void setClipPlane(PlanePosition plane, float value)
00251         {
00252                 m_VolumeRenderer.setClipPlane(plane, value);
00253         }
00254 
00261         virtual bool load_data(QString filename, int *volsize);
00262 
00267         bool save_data(std::string filename);
00268 
00273         virtual void saveImage(std::string filename);
00274 
00279         void setOrthoProjection(bool m_orth);
00280 
00285         std::vector<int> * getDataHistogram();
00286         
00291         unsigned char * getData2DHistogram();
00292 
00293         VVolume m_Volume;                                                       
00294         VSliceRenderer m_SliceRenderer;                         
00295         VVolumeRenderer m_VolumeRenderer;                       
00296         VTransferFunction * m_TransferFunction;         
00297         VTransferFunction2D * m_TransferFunction2D;     
00299         float m_bgColor[4];                                                     
00301         VVector up;                                                                     
00302         VVector view;                                                           
00303         VVector side;                                                           
00305         VVector lup;                                                            
00306         VVector lview;                                                          
00307         VVector lside;                                                          
00309         VVector m_lightDir;                                                     
00310         bool m_modifyLight;                                                     
00312         VImage testImage;                                                       
00314 protected:
00315 
00319         virtual void initializeGL();
00320 
00324         virtual void paintGL();
00325 
00326 
00327 private:
00328 
00334         VVector getSphereProjection(float x, float y);
00335 
00341         VVector getPlaneProjection(float x, float y);
00342 
00343 
00344         bool sliceview_active;                                  
00345         bool data_loaded;                                               
00346         int apply_tf_in_sv;                                             
00347         int apply_tf_in_vv;                                             
00348         VFramebufferObject * m_FramebufferObject;       
00349         VVector *m_BackgroundColor;                             
00350         VVector m_MouseLastPos;                                 
00352         MouseState m_MouseState;                                
00353         RenderMode m_RenderMode;                                
00354         LightMode m_LightMode;                                  
00356         VVector m_CamDat;                                               
00357         VVector m_LookAtPoint;                                  
00359         VVector m_Position;                                             
00360         VVector m_LookAt;                                               
00361         float m_Distance;                                               
00362         VVector m_vecPosition;                                  
00363         VVector m_PanOffset;                                    
00365         VVector m_Rotation;                                             
00366         float m_fAngle;                                                 
00369 };
00370 #endif

Generated on Wed Dec 5 05:15:09 2007 for VolRendering by  doxygen 1.5.4