45 #ifndef vtkUnstructuredGridPartialPreIntegration_h
46 #define vtkUnstructuredGridPartialPreIntegration_h
48 #include "vtkRenderingVolumeModule.h"
52 class vtkPartialPreIntegrationTransferFunction;
75 static void IntegrateRay(
double length,
76 double intensity_front,
double attenuation_front,
77 double intensity_back,
double attenuation_back,
79 static void IntegrateRay(
double length,
80 const double color_front[3],
81 double attenuation_front,
82 const double color_back[3],
83 double attenuation_back,
94 static float Psi(
float taufD,
float taubD);
95 static float *GetPsiTable(
int &
size);
96 static void BuildPsiTable();
109 enum {PSI_TABLE_SIZE = 512};
111 static float PsiTable[PSI_TABLE_SIZE*PSI_TABLE_SIZE];
122 float gammaf = taufD/(taufD+1);
123 float gammab = taubD/(taubD+1);
126 return PsiTable[gammafi*PSI_TABLE_SIZE + gammabi];
131 size = PSI_TABLE_SIZE;
137 double intensity_front,
138 double attenuation_front,
139 double intensity_back,
140 double attenuation_back,
143 float taufD = length*attenuation_front;
144 float taubD = length*attenuation_back;
146 float zeta =
static_cast<float>(exp(-0.5*(taufD+taubD)));
147 float alpha = 1-zeta;
149 float newintensity = (1-color[3])*( intensity_front*(1-Psi)
150 + intensity_back*(Psi-zeta) );
152 color[0] += newintensity;
153 color[1] += newintensity;
154 color[2] += newintensity;
155 color[3] += (1-color[3])*alpha;
160 const double color_front[3],
161 double attenuation_front,
162 const double color_back[3],
163 double attenuation_back,
166 float taufD = length*attenuation_front;
167 float taubD = length*attenuation_back;
169 float zeta =
static_cast<float>(exp(-0.5*(taufD+taubD)));
170 float alpha = 1-zeta;
172 color[0] += (1-color[3])*(color_front[0]*(1-Psi) + color_back[0]*(Psi-zeta));
173 color[1] += (1-color[3])*(color_front[1]*(1-Psi) + color_back[1]*(Psi-zeta));
174 color[2] += (1-color[3])*(color_front[2]*(1-Psi) + color_back[2]*(Psi-zeta));
175 color[3] += (1-color[3])*alpha;
178 #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 peicewise integration of the ...