44 #ifndef vtkUnstructuredGridPartialPreIntegration_h
45 #define vtkUnstructuredGridPartialPreIntegration_h
51 class vtkPartialPreIntegrationTransferFunction;
72 static void IntegrateRay(
double length,
73 double intensity_front,
double attenuation_front,
74 double intensity_back,
double attenuation_back,
76 static void IntegrateRay(
double length,
77 const double color_front[3],
78 double attenuation_front,
79 const double color_back[3],
80 double attenuation_back,
89 static float Psi(
float taufD,
float taubD);
90 static float *GetPsiTable(
int &
size);
91 static void BuildPsiTable();
105 enum {PSI_TABLE_SIZE = 512};
107 static float PsiTable[PSI_TABLE_SIZE*PSI_TABLE_SIZE];
118 float gammaf = taufD/(taufD+1);
119 float gammab = taubD/(taubD+1);
122 return PsiTable[gammafi*PSI_TABLE_SIZE + gammabi];
133 double intensity_front,
134 double attenuation_front,
135 double intensity_back,
136 double attenuation_back,
139 float taufD = length*attenuation_front;
140 float taubD = length*attenuation_back;
142 float zeta =
static_cast<float>(exp(-0.5*(taufD+taubD)));
143 float alpha = 1-zeta;
145 float newintensity = (1-color[3])*( intensity_front*(1-Psi)
146 + intensity_back*(Psi-zeta) );
148 color[0] += newintensity;
149 color[1] += newintensity;
150 color[2] += newintensity;
151 color[3] += (1-color[3])*alpha;
156 const double color_front[3],
157 double attenuation_front,
158 const double color_back[3],
159 double attenuation_back,
162 float taufD = length*attenuation_front;
163 float taubD = length*attenuation_back;
165 float zeta =
static_cast<float>(exp(-0.5*(taufD+taubD)));
166 float alpha = 1-zeta;
168 color[0] += (1-color[3])*(color_front[0]*(1-Psi) + color_back[0]*(Psi-zeta));
169 color[1] += (1-color[3])*(color_front[1]*(1-Psi) + color_back[1]*(Psi-zeta));
170 color[2] += (1-color[3])*(color_front[2]*(1-Psi) + color_back[2]*(Psi-zeta));
171 color[3] += (1-color[3])*alpha;
174 #endif //vtkUnstructuredGridPartialPreIntegration_h
represents a volume (data & properties) in a rendered scene
vtkTimeStamp TransferFunctionsModified
performs piecewise linear ray integration.
virtual void Initialize(vtkVolume *volume, vtkDataArray *scalars)=0
#define VTKRENDERINGVOLUME_EXPORT
record modification and/or execution time
static float PsiTable[PSI_TABLE_SIZE *PSI_TABLE_SIZE]
vtkPartialPreIntegrationTransferFunction * TransferFunctions
dynamic, self-adjusting array of double
a superclass for volume ray integration functions
static void IntegrateRay(double length, double intensity_front, double attenuation_front, double intensity_back, double attenuation_back, float color[4])
a simple class to control print indentation
static int Floor(double x)
abstract superclass for arrays of numeric data
int NumIndependentComponents
represents the common properties for rendering a volume.
vtkVolumeProperty * Property
virtual void PrintSelf(ostream &os, vtkIndent indent)
static float * GetPsiTable(int &size)
static float Psi(float taufD, float taubD)
virtual void Integrate(vtkDoubleArray *intersectionLengths, vtkDataArray *nearIntersections, vtkDataArray *farIntersections, float color[4])=0