#include <vtkLineIntegralConvolution2D.h>
This class resorts to GLSL to implement GPU-based Line Integral Convolution (LIC) for visualizing a 2D vector field that may be obtained by projecting an original 3D vector field onto a surface (such that the resulting 2D vector at each grid point on the surface is tangential to the local normal, as done in vtkSurfaceLICPainter).
As an image-based technique, 2D LIC works by (1) integrating a bidirectional streamline from the center of each pixel (of the LIC output image), (2) locating the pixels along / hit by this streamline as the correlated pixels of the starting pixel (seed point / pixel), (3) indexing a (usually white) noise texture (another input to LIC, in addition to the 2D vector field, usually with the same size as that of the 2D vetor field) to determine the values (colors) of these pixels (the starting and the correlated pixels), typically through bi-linear interpolation, and (4) performing convolution (weighted averaging) on these values, by adopting a low-pass filter (such as box, ramp, and Hanning kernels), to obtain the result value (color) that is then assigned to the seed pixel.
The GLSL-based GPU implementation herein maps the aforementioned pipeline to fragment shaders and a box kernel is employed. Both the white noise and the vector field are provided to the GPU as texture objects (supported by the multi-texturing capability). In addition, there are four texture objects (color buffers) allocated to constitute two pairs that work in a ping-pong fashion, with one as the read buffers and the other as the write / render targets. Maintained by a frame buffer object (GL_EXT_framebuffer_object), each pair employs one buffer to store the current (dynamically updated) position (by means of the texture coordinate that keeps being warped by the underlying vector) of the (virtual) particle initially released from each fragment while using the bother buffer to store the current (dynamically updated too) accumulated texture value that each seed fragment (before the 'mesh' is warped) collects. Given NumberOfSteps integration steps in each direction, there are a total of (2 * NumberOfSteps + 1) fragments (including the seed fragment) are convolved and each contributes 1 / (2 * NumberOfSteps + 1) of the associated texture value to fulfill the box filter.
One pass of LIC (basic LIC) tends to produce low-contrast / blurred images and vtkLineIntegralConvolution2D provides an option for creating enhanced LIC images. Enhanced LIC improves image quality by increasing inter-streamline contrast while suppressing artifacts. It performs two passes of LIC, with a 3x3 Laplacian high-pass filter in between that processes the output of pass #1 LIC and forwards the result as the input 'noise' to pass #2 LIC. Enhanced LIC automatically degenerates to basic LIC during user interaction.
vtkLineIntegralConvolution2D applies masking to zero-vector fragments so that un-filtered white noise areas are made totally transparent by class vtkSurfaceLICPainter to show the underlying geometry surface.
Definition at line 86 of file vtkLineIntegralConvolution2D.h.
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
int | Execute () |
virtual void | SetEnhancedLIC (int) |
virtual int | GetEnhancedLIC () |
virtual void | EnhancedLICOn () |
virtual void | EnhancedLICOff () |
virtual void | SetLICForSurface (int) |
virtual int | GetLICForSurface () |
virtual void | LICForSurfaceOn () |
virtual void | LICForSurfaceOff () |
virtual void | SetNumberOfSteps (int) |
virtual int | GetNumberOfSteps () |
virtual void | SetLICStepSize (double) |
virtual double | GetLICStepSize () |
void | SetNoise (vtkTextureObject *noise) |
virtual vtkTextureObject * | GetNoise () |
void | SetVectorField (vtkTextureObject *vectorField) |
virtual vtkTextureObject * | GetVectorField () |
virtual void | SetComponentIds (int, int) |
void | SetComponentIds (int[2]) |
virtual int * | GetComponentIds () |
virtual void | GetComponentIds (int &, int &) |
virtual void | GetComponentIds (int[2]) |
virtual void | SetGridSpacings (double, double) |
void | SetGridSpacings (double[2]) |
virtual double * | GetGridSpacings () |
virtual void | GetGridSpacings (double &, double &) |
virtual void | GetGridSpacings (double[2]) |
virtual void | SetTransformVectors (int) |
virtual void | TransformVectorsOn () |
virtual void | TransformVectorsOff () |
virtual int | GetTransformVectors () |
virtual void | SetMagnification (int) |
virtual int | GetMagnification () |
void | SetVectorShiftScale (double shift, double scale) |
int | Execute (unsigned int extent[4]) |
int | Execute (int extent[4]) |
void | SetLIC (vtkTextureObject *lic) |
virtual vtkTextureObject * | GetLIC () |
Static Public Member Functions | |
static vtkLineIntegralConvolution2D * | New () |
static int | IsTypeOf (const char *type) |
static vtkLineIntegralConvolution2D * | SafeDownCast (vtkObject *o) |
static bool | IsSupported (vtkRenderWindow *renWin) |
Protected Member Functions | |
vtkLineIntegralConvolution2D () | |
~vtkLineIntegralConvolution2D () | |
Protected Attributes | |
int | Magnification |
int | NumberOfSteps |
int | LICForSurface |
int | EnhancedLIC |
double | LICStepSize |
double | VectorShift |
double | VectorScale |
int | TransformVectors |
int | ComponentIds [2] |
double | GridSpacings [2] |
vtkTextureObject * | VectorField |
vtkTextureObject * | Noise |
vtkTextureObject * | LIC |
vtkLineIntegralConvolution2D::vtkLineIntegralConvolution2D | ( | ) | [protected] |
vtkLineIntegralConvolution2D::~vtkLineIntegralConvolution2D | ( | ) | [protected] |
static vtkLineIntegralConvolution2D* vtkLineIntegralConvolution2D::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
virtual const char* vtkLineIntegralConvolution2D::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkObject.
static int vtkLineIntegralConvolution2D::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
virtual int vtkLineIntegralConvolution2D::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
static vtkLineIntegralConvolution2D* vtkLineIntegralConvolution2D::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkObject.
void vtkLineIntegralConvolution2D::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
virtual void vtkLineIntegralConvolution2D::SetEnhancedLIC | ( | int | ) | [virtual] |
Enable/Disable enhanced LIC that improves image quality by increasing inter-streamline contrast while suppressing artifacts. Enhanced LIC performs two passes of LIC, with a 3x3 Laplacian high-pass filter in between that processes the output of pass #1 LIC and forwards the result as the input 'noise' to pass #2 LIC. This flag is automatically turned off during user interaction.
virtual int vtkLineIntegralConvolution2D::GetEnhancedLIC | ( | ) | [virtual] |
Enable/Disable enhanced LIC that improves image quality by increasing inter-streamline contrast while suppressing artifacts. Enhanced LIC performs two passes of LIC, with a 3x3 Laplacian high-pass filter in between that processes the output of pass #1 LIC and forwards the result as the input 'noise' to pass #2 LIC. This flag is automatically turned off during user interaction.
virtual void vtkLineIntegralConvolution2D::EnhancedLICOn | ( | ) | [virtual] |
Enable/Disable enhanced LIC that improves image quality by increasing inter-streamline contrast while suppressing artifacts. Enhanced LIC performs two passes of LIC, with a 3x3 Laplacian high-pass filter in between that processes the output of pass #1 LIC and forwards the result as the input 'noise' to pass #2 LIC. This flag is automatically turned off during user interaction.
virtual void vtkLineIntegralConvolution2D::EnhancedLICOff | ( | ) | [virtual] |
Enable/Disable enhanced LIC that improves image quality by increasing inter-streamline contrast while suppressing artifacts. Enhanced LIC performs two passes of LIC, with a 3x3 Laplacian high-pass filter in between that processes the output of pass #1 LIC and forwards the result as the input 'noise' to pass #2 LIC. This flag is automatically turned off during user interaction.
virtual void vtkLineIntegralConvolution2D::SetLICForSurface | ( | int | ) | [virtual] |
Enable/Disable LICForSurface, for which the LIC texture is composited with the underlying geometry.
virtual int vtkLineIntegralConvolution2D::GetLICForSurface | ( | ) | [virtual] |
Enable/Disable LICForSurface, for which the LIC texture is composited with the underlying geometry.
virtual void vtkLineIntegralConvolution2D::LICForSurfaceOn | ( | ) | [virtual] |
Enable/Disable LICForSurface, for which the LIC texture is composited with the underlying geometry.
virtual void vtkLineIntegralConvolution2D::LICForSurfaceOff | ( | ) | [virtual] |
Enable/Disable LICForSurface, for which the LIC texture is composited with the underlying geometry.
virtual void vtkLineIntegralConvolution2D::SetNumberOfSteps | ( | int | ) | [virtual] |
Number of streamline integration steps (initial value is 1). In term of visual quality, the greater (within some range) the better.
virtual int vtkLineIntegralConvolution2D::GetNumberOfSteps | ( | ) | [virtual] |
Number of streamline integration steps (initial value is 1). In term of visual quality, the greater (within some range) the better.
virtual void vtkLineIntegralConvolution2D::SetLICStepSize | ( | double | ) | [virtual] |
Get/Set the streamline integration step size (0.01 by default). This is the length of each step in normalized image space i.e. in range [0, 1]. In term of visual quality, the smaller the better. The type for the interface is double as VTK interface is, but GPU only supports float. Thus it will be converted to float in the execution of the algorithm.
virtual double vtkLineIntegralConvolution2D::GetLICStepSize | ( | ) | [virtual] |
Get/Set the streamline integration step size (0.01 by default). This is the length of each step in normalized image space i.e. in range [0, 1]. In term of visual quality, the smaller the better. The type for the interface is double as VTK interface is, but GPU only supports float. Thus it will be converted to float in the execution of the algorithm.
void vtkLineIntegralConvolution2D::SetNoise | ( | vtkTextureObject * | noise | ) |
Set/Get the input white noise texture (initial value is NULL).
virtual vtkTextureObject* vtkLineIntegralConvolution2D::GetNoise | ( | ) | [virtual] |
Set/Get the input white noise texture (initial value is NULL).
void vtkLineIntegralConvolution2D::SetVectorField | ( | vtkTextureObject * | vectorField | ) |
Set/Get the vector field (initial value is NULL).
virtual vtkTextureObject* vtkLineIntegralConvolution2D::GetVectorField | ( | ) | [virtual] |
Set/Get the vector field (initial value is NULL).
virtual void vtkLineIntegralConvolution2D::SetComponentIds | ( | int | , | |
int | ||||
) | [virtual] |
If VectorField has >= 3 components, we must choose which 2 components form the (X, Y) components for the vector field. Must be in the range [0, 3].
void vtkLineIntegralConvolution2D::SetComponentIds | ( | int | [2] | ) |
If VectorField has >= 3 components, we must choose which 2 components form the (X, Y) components for the vector field. Must be in the range [0, 3].
virtual int* vtkLineIntegralConvolution2D::GetComponentIds | ( | ) | [virtual] |
If VectorField has >= 3 components, we must choose which 2 components form the (X, Y) components for the vector field. Must be in the range [0, 3].
virtual void vtkLineIntegralConvolution2D::GetComponentIds | ( | int & | , | |
int & | ||||
) | [virtual] |
If VectorField has >= 3 components, we must choose which 2 components form the (X, Y) components for the vector field. Must be in the range [0, 3].
virtual void vtkLineIntegralConvolution2D::GetComponentIds | ( | int | [2] | ) | [virtual] |
If VectorField has >= 3 components, we must choose which 2 components form the (X, Y) components for the vector field. Must be in the range [0, 3].
virtual void vtkLineIntegralConvolution2D::SetGridSpacings | ( | double | , | |
double | ||||
) | [virtual] |
Set/Get the spacing in each dimension of the plane on which the vector field is defined. This class performs LIC in the normalized image space and hence generally it needs to transform the input vector field (given in physical space) to the normalized image space. The Spacing is needed to determine the tranform. Default is (1.0, 1.0). It is possible to disable vector transformation by setting TransformVectors to 0.
void vtkLineIntegralConvolution2D::SetGridSpacings | ( | double | [2] | ) |
Set/Get the spacing in each dimension of the plane on which the vector field is defined. This class performs LIC in the normalized image space and hence generally it needs to transform the input vector field (given in physical space) to the normalized image space. The Spacing is needed to determine the tranform. Default is (1.0, 1.0). It is possible to disable vector transformation by setting TransformVectors to 0.
virtual double* vtkLineIntegralConvolution2D::GetGridSpacings | ( | ) | [virtual] |
Set/Get the spacing in each dimension of the plane on which the vector field is defined. This class performs LIC in the normalized image space and hence generally it needs to transform the input vector field (given in physical space) to the normalized image space. The Spacing is needed to determine the tranform. Default is (1.0, 1.0). It is possible to disable vector transformation by setting TransformVectors to 0.
virtual void vtkLineIntegralConvolution2D::GetGridSpacings | ( | double & | , | |
double & | ||||
) | [virtual] |
Set/Get the spacing in each dimension of the plane on which the vector field is defined. This class performs LIC in the normalized image space and hence generally it needs to transform the input vector field (given in physical space) to the normalized image space. The Spacing is needed to determine the tranform. Default is (1.0, 1.0). It is possible to disable vector transformation by setting TransformVectors to 0.
virtual void vtkLineIntegralConvolution2D::GetGridSpacings | ( | double | [2] | ) | [virtual] |
Set/Get the spacing in each dimension of the plane on which the vector field is defined. This class performs LIC in the normalized image space and hence generally it needs to transform the input vector field (given in physical space) to the normalized image space. The Spacing is needed to determine the tranform. Default is (1.0, 1.0). It is possible to disable vector transformation by setting TransformVectors to 0.
virtual void vtkLineIntegralConvolution2D::SetTransformVectors | ( | int | ) | [virtual] |
This class performs LIC in the normalized image space. Hence, by default it transforms the input vectors to the normalized image space (using the GridSpacings and input vector field dimensions). Set this to 0 to disable tranformation if the vectors are already tranformed.
virtual void vtkLineIntegralConvolution2D::TransformVectorsOn | ( | ) | [virtual] |
This class performs LIC in the normalized image space. Hence, by default it transforms the input vectors to the normalized image space (using the GridSpacings and input vector field dimensions). Set this to 0 to disable tranformation if the vectors are already tranformed.
virtual void vtkLineIntegralConvolution2D::TransformVectorsOff | ( | ) | [virtual] |
This class performs LIC in the normalized image space. Hence, by default it transforms the input vectors to the normalized image space (using the GridSpacings and input vector field dimensions). Set this to 0 to disable tranformation if the vectors are already tranformed.
virtual int vtkLineIntegralConvolution2D::GetTransformVectors | ( | ) | [virtual] |
This class performs LIC in the normalized image space. Hence, by default it transforms the input vectors to the normalized image space (using the GridSpacings and input vector field dimensions). Set this to 0 to disable tranformation if the vectors are already tranformed.
virtual void vtkLineIntegralConvolution2D::SetMagnification | ( | int | ) | [virtual] |
The the magnification factor (default is 1.0).
virtual int vtkLineIntegralConvolution2D::GetMagnification | ( | ) | [virtual] |
The the magnification factor (default is 1.0).
void vtkLineIntegralConvolution2D::SetVectorShiftScale | ( | double | shift, | |
double | scale | |||
) | [inline] |
On machines where the vector field texture is clamped between [0,1], one can specify the shift/scale factor used to convert the original vector field to lie in the clamped range. Default is (0.0, 1.0);
Definition at line 184 of file vtkLineIntegralConvolution2D.h.
static bool vtkLineIntegralConvolution2D::IsSupported | ( | vtkRenderWindow * | renWin | ) | [static] |
Returns if the context supports the required extensions.
int vtkLineIntegralConvolution2D::Execute | ( | ) |
Perform the LIC and obtain the LIC texture. Return 1 if no error.
int vtkLineIntegralConvolution2D::Execute | ( | unsigned int | extent[4] | ) |
Same as Execute() except that the LIC operation is performed only on a window (given by the extent
) in the input VectorField. The extent
is relative to the input VectorField. The output LIC image will be of the size specified by extent.
int vtkLineIntegralConvolution2D::Execute | ( | int | extent[4] | ) |
Same as Execute() except that the LIC operation is performed only on a window (given by the extent
) in the input VectorField. The extent
is relative to the input VectorField. The output LIC image will be of the size specified by extent.
void vtkLineIntegralConvolution2D::SetLIC | ( | vtkTextureObject * | lic | ) |
LIC texture (initial value is NULL) set by Execute().
virtual vtkTextureObject* vtkLineIntegralConvolution2D::GetLIC | ( | ) | [virtual] |
LIC texture (initial value is NULL) set by Execute().
int vtkLineIntegralConvolution2D::Magnification [protected] |
Definition at line 217 of file vtkLineIntegralConvolution2D.h.
int vtkLineIntegralConvolution2D::NumberOfSteps [protected] |
Definition at line 218 of file vtkLineIntegralConvolution2D.h.
int vtkLineIntegralConvolution2D::LICForSurface [protected] |
Definition at line 219 of file vtkLineIntegralConvolution2D.h.
int vtkLineIntegralConvolution2D::EnhancedLIC [protected] |
Definition at line 220 of file vtkLineIntegralConvolution2D.h.
double vtkLineIntegralConvolution2D::LICStepSize [protected] |
Definition at line 221 of file vtkLineIntegralConvolution2D.h.
double vtkLineIntegralConvolution2D::VectorShift [protected] |
Definition at line 222 of file vtkLineIntegralConvolution2D.h.
double vtkLineIntegralConvolution2D::VectorScale [protected] |
Definition at line 223 of file vtkLineIntegralConvolution2D.h.
int vtkLineIntegralConvolution2D::TransformVectors [protected] |
Definition at line 225 of file vtkLineIntegralConvolution2D.h.
int vtkLineIntegralConvolution2D::ComponentIds[2] [protected] |
Definition at line 226 of file vtkLineIntegralConvolution2D.h.
double vtkLineIntegralConvolution2D::GridSpacings[2] [protected] |
Definition at line 227 of file vtkLineIntegralConvolution2D.h.
Definition at line 229 of file vtkLineIntegralConvolution2D.h.
vtkTextureObject* vtkLineIntegralConvolution2D::Noise [protected] |
Definition at line 230 of file vtkLineIntegralConvolution2D.h.
vtkTextureObject* vtkLineIntegralConvolution2D::LIC [protected] |
Definition at line 231 of file vtkLineIntegralConvolution2D.h.