42 #ifndef vtkUnstructuredGridPartialPreIntegration_h 43 #define vtkUnstructuredGridPartialPreIntegration_h 45 #include "vtkRenderingVolumeModule.h" 49 class vtkPartialPreIntegrationTransferFunction;
65 float color[4])
override;
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,
91 static float Psi(
float taufD,
float taubD);
92 static float *GetPsiTable(
int &
size);
93 static void BuildPsiTable();
106 enum {PSI_TABLE_SIZE = 512};
108 static float PsiTable[PSI_TABLE_SIZE*PSI_TABLE_SIZE];
119 float gammaf = taufD/(taufD+1);
120 float gammab = taubD/(taubD+1);
123 return PsiTable[gammafi*PSI_TABLE_SIZE + gammabi];
128 size = PSI_TABLE_SIZE;
134 double intensity_front,
135 double attenuation_front,
136 double intensity_back,
137 double attenuation_back,
140 float taufD = length*attenuation_front;
141 float taubD = length*attenuation_back;
143 float zeta =
static_cast<float>(exp(-0.5*(taufD+taubD)));
144 float alpha = 1-zeta;
146 float newintensity = (1-color[3])*( intensity_front*(1-Psi)
147 + intensity_back*(Psi-zeta) );
149 color[0] += newintensity;
150 color[1] += newintensity;
151 color[2] += newintensity;
152 color[3] += (1-color[3])*alpha;
157 const double color_front[3],
158 double attenuation_front,
159 const double color_back[3],
160 double attenuation_back,
163 float taufD = length*attenuation_front;
164 float taubD = length*attenuation_back;
166 float zeta =
static_cast<float>(exp(-0.5*(taufD+taubD)));
167 float alpha = 1-zeta;
169 color[0] += (1-color[3])*(color_front[0]*(1-Psi) + color_back[0]*(Psi-zeta));
170 color[1] += (1-color[3])*(color_front[1]*(1-Psi) + color_back[1]*(Psi-zeta));
171 color[2] += (1-color[3])*(color_front[2]*(1-Psi) + color_back[2]*(Psi-zeta));
172 color[3] += (1-color[3])*alpha;
175 #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
Set up the integrator with the given properties and scalars.
record modification and/or execution time
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])
Integrates a single ray segment.
a simple class to control print indentation
static int Floor(double x)
Rounds a double to the nearest integer not greater than itself.
abstract superclass for arrays of numeric data
int NumIndependentComponents
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
represents the common properties for rendering a volume.
vtkVolumeProperty * Property
static float * GetPsiTable(int &size)
Looks up Psi (as defined by Moreland and Angel, "A Fast High Accuracy Volume Renderer for Unstructure...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
static float Psi(float taufD, float taubD)
Looks up Psi (as defined by Moreland and Angel, "A Fast High Accuracy Volume Renderer for Unstructure...
virtual void Integrate(vtkDoubleArray *intersectionLengths, vtkDataArray *nearIntersections, vtkDataArray *farIntersections, float color[4])=0
Given a set of intersections (defined by the three arrays), compute the piecewise integration of the ...