00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkOoCVolumeRendererRayCasting_h
00012 #define __mitkOoCVolumeRendererRayCasting_h
00013
00014 #include "mitkVolumeRenderer.h"
00015 #include "mitkRCPtr.h"
00016 #include "mitkVolumeRayCastFunction.h"
00017 #include "mitkEncodedGradientEstimator.h"
00018 #include "mitkEncodedGradientShader.h"
00019
00020 class mitkMatrix;
00021
00030 class MITK_VISUALIZATION_API mitkOoCVolumeRendererRayCasting : public mitkVolumeRenderer
00031 {
00032 public:
00033 MITK_TYPE(mitkOoCVolumeRendererRayCasting, mitkVolumeRenderer)
00034
00035 virtual void PrintSelf(ostream &os);
00036
00040 mitkOoCVolumeRendererRayCasting();
00041
00045 virtual int Render(mitkScene *scene, mitkVolumeModel *vol);
00046
00051 void SetGradientEstimator(mitkEncodedGradientEstimator *gradest);
00052
00057 mitkEncodedGradientEstimator* GetGradientEstimator(){return m_GradientEstimator;};
00058
00059
00060
00061 protected:
00062 virtual ~mitkOoCVolumeRendererRayCasting();
00063
00064 void _deleteCastingRays();
00065 void _clearCastingRays();
00066 int _newCastingRays();
00067 int _initCastingRays(mitkScene *scene, mitkVolumeModel *vol);
00068
00069 int _computeClippingPlanes(int planeCount, mitkVector *planeEqus, mitkScene *scene);
00070 int _computeRowBounds(mitkScene *scene, mitkVolumeModel *vol);
00071 int _clipRayAgainstVolume(mitkVector &rayStart, mitkVector &rayEnd, float bounds[6]);
00072 int _clipRayAgainstClippingPlanes(mitkVector &rayStart, mitkVector &rayEnd, int planeCount, mitkVector *planeEqus);
00073
00074 int _updateShadingTables(mitkScene *scene, mitkVolumeModel *vol);
00075
00076 void _renderTexture(mitkScene *scene, mitkVolumeModel *vol);
00077
00078
00079
00080
00081 float _getZBufferValue(int x, int y);
00082
00083 mitkRCPtr<mitkVolumeRayCastFunction> m_VolumeRayCastFunction;
00084 mitkRCPtr<mitkEncodedGradientEstimator> m_GradientEstimator;
00085 mitkRCPtr<mitkEncodedGradientShader> m_GradientShader;
00086
00087 mitkRay *m_Ray;
00088 mitkVector *m_RayCurPos;
00089
00090 mitkVector *m_RayCastStep;
00091 int *m_RayStepsLeft;
00092 int *m_RayStatus;
00093
00094 mitkMatrix *m_WorldToViewMatrix;
00095 mitkMatrix *m_ViewToWorldMatrix;
00096 mitkMatrix *m_ViewToVoxelsMatrix;
00097 mitkMatrix *m_VoxelsToViewMatrix;
00098 mitkMatrix *m_WorldToVoxelsMatrix;
00099 mitkMatrix *m_VoxelsToWorldMatrix;
00100
00101
00102 int m_ImageViewportSize[2];
00103
00104
00105
00106
00107
00108 int m_ImageMemorySize[2];
00109
00110
00111
00112
00113
00114 int m_ImageInUseSize[2];
00115
00116
00117
00118 int m_ImageOrigin[2];
00119
00120
00121 unsigned char *m_Image;
00122 float *m_AccumColors;
00123
00124 int *m_RowBounds;
00125 int *m_OldRowBounds;
00126
00127 float m_MinimumViewDistance;
00128
00129
00130 float m_SampleDistance;
00131
00132 float *m_ZBuffer;
00133 int m_ZBufferSize[2];
00134 int m_ZBufferOrigin[2];
00135
00136 float m_ImageSampleDistance;
00137 float m_MinimumImageSampleDistance;
00138 float m_MaximumImageSampleDistance;
00139
00140 int m_SlicePtrNum;
00141 void const **m_Slices;
00142 unsigned short const **m_EncodedNormalSlices;
00143 unsigned char const **m_GradientMagnitudeSlices;
00144
00145 mitkVolume *m_EncodedNormalsVol;
00146 mitkVolume *m_GradientMagnitudesVol;
00147
00148 bool m_AutoAdjustSampleDistances;
00149 bool m_IntermixIntersectingGeometry;
00150 bool m_HasForwardRay;
00151 bool m_HasReverseRay;
00152
00153
00154 bool m_DepthTest;
00155 bool *m_Clips;
00156 bool m_AutoReslice;
00157
00158 private:
00159 mitkOoCVolumeRendererRayCasting(const mitkOoCVolumeRendererRayCasting&);
00160 void operator = (const mitkOoCVolumeRendererRayCasting&);
00161
00162 };
00163
00164
00165
00166
00167
00168
00169 #endif
00170