VMTK
vmtkRender3D.h
1 #ifndef VMTKRENDER3D_H
2 #define VMTKRENDER3D_H
3 
4 #include "vmtkFrameBufferObject.h"
5 #include "importDicom.h"
6 #include "shaders.h"
7 #include "vmath.h"
8 #include "transferFunction.h"
9 #include "equalize.h"
10 
11 #include<fstream>
12 
14 {
15  public:
16 
20  vmtkRender3D();
30  void initialize(int width, int height);
34  void render();
39  void preRender(vmath::Matrix4f mvp);
45  void resize(int width, int height);
50  void setRotation(float ax, float ay, float az);
55  void setThreshold(int threshold);
60  void setBlender(float blender);
66  void itlDrawColorCube(vmath::Matrix4f mvp);
67 
71  void initDrawCube();
72 
77  bool readMatrix(const char *s);
78 
83  void setClipLeftX(float left_x);
84 
88  int getMaxSliceLeft();
89 
90  private:
91 
92  int m_maxSliceLeft;
93  vmath::Matrix4f m_registration_matrix, m_registration_matrix_inv;
94  float m_refThreshold, m_blender;
95  unsigned int *m_mapRef, *m_mapFloat;
96  Import::ImgFormat *m_RefData, *m_FloatData;
97  GLuint m_refTexture;
98  GLuint m_floatTexture;
99  GLuint m_refTF;
100  GLuint m_floatTF;
101  GLuint m_ColorShader;
102  GLuint m_RaytraceShader;
104  GLuint vaosCube,
105  vboCube,
106  eboCube,
107  vaosRenderPlane,
108  vboRenderPlane,
109  eboRenderPlane,
110  vaosResultPlane,
111  vboResultPlane,
112  eboResultPlane; ;
113 
117  struct VertexDataCube
118  {
119  vmath::Vector3f position;
120  };
121 
125  struct VertexData
126  {
127  vmath::Vector2f position;
128  vmath::Vector2f texCoord;
129  };
133  vmath::Vector2f v1, v2, v3, v4;
137  vmath::Vector2f vt1, vt2, vt3, vt4;
141  vmath::Vector3f vc1, vc2, vc3, vc4, vc5, vc6, vc7, vc8, vc9, vc10, vc11, vc12,
142  vc13, vc14, vc15, vc16, vc17, vc18, vc19, vc20, vc21, vc22, vc23, vc24;
143 
144  float m_fClipXLeft;
145  float m_fClipXRight;
146  float m_fClipYTop;
147  float m_fClipYBottom;
148  float m_fClipZBack;
149  float m_fClipZFront;
151  int m_iHeight;
152  int m_iWidth;
154  vmath::Matrix4f m_projectionMatrix;
155  vmath::Matrix4f m_modelViewMatrix;
156  vmath::Matrix4f m_rotationMatrix;
157  vmath::Matrix4f m_scalationMatrix;
158  vmath::Matrix4f m_translationMatrix;
160  float m_refScaleFactors[4];
161  float m_floatScaleFactors[4];
162  float m_refPhyDimensions[4];
163  float m_floatPhyDimensions[4];
164 
165  vmtkFrameBufferObject *m_FrontFBO;
166  vmtkFrameBufferObject *m_BackFBO;
167  vmtkFrameBufferObject *m_RayTracedFBO;
169  bool m_bInitialized;
174  void createVectorPlanes();
175 
179  void loadVolumetoTexture();
183  void loadTransferFtoTexture();
184 
188  void createBuffers();
189 
193  void initRenderPlane();
197  void drawCube();
201  void raycasting();
202 
206  void drawPlaneRayTraced();
207 };
208 
209 #endif // VMTKRENDER3D_H
void render()
renders the data with the specified redering mode.
void preRender(vmath::Matrix4f mvp)
renders the color cube in the fbos.
void initialize(int width, int height)
initializes 3D volume rendering
void initDrawCube()
initializes the geometry of a cube to be rendered for getting back and front depth maps...
vmtkRender3D()
vmtkRenderer3D constructor
Definition: vmtkRender3D.cpp:3
void itlDrawColorCube(vmath::Matrix4f mvp)
draws a unit cube to get the front and the back depth maps of the volume cube, after updating the cli...
void resize(int width, int height)
resizes the dimensions of the display
void setThreshold(int threshold)
sets the threshold.
void setBlender(float blender)
sets the blender factor.
void setClipLeftX(float left_x)
sets the clipping plane.
bool readMatrix(const char *s)
reads the co-register matrix.
void setRotation(float ax, float ay, float az)
sets the rotation matrix.
int getMaxSliceLeft()
gets the maximum number of the slices from the axis X.
void setAcquisition(Import::ImgFormat *acq1, Import::ImgFormat *acq2)
sets the volumes to be registered