1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
|
Usage
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.
.SECTION Required OpenGL Extensins
GL_ARB_texture_non_power_of_two GL_VERSION_2_0
GL_ARB_texture_float GL_ARB_draw_buffers
GL_EXT_framebuffer_object
To create an instance of class vtkLineIntegralConvolution2D,
simply invoke its constructor as follows
obj = vtkLineIntegralConvolution2D
Methods
The class vtkLineIntegralConvolution2D has several methods
that can be used. They are listed below. Note that the
documentation is translated automatically from the VTK
sources, and may not be completely intelligible. When in
doubt, consult the VTK website. In the methods listed below,
obj is an instance of the vtkLineIntegralConvolution2D
class.
* string = obj.GetClassName ()
* int = obj.IsA (string name)
* vtkLineIntegralConvolution2D = obj.NewInstance ()
* vtkLineIntegralConvolution2D = obj.SafeDownCast (vtkObject
o)
* obj.SetEnhancedLIC (int ) - 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.
* int = obj.GetEnhancedLIC () - 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.
* obj.EnhancedLICOn () - 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.
* obj.EnhancedLICOff () - 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.
* obj.SetLICForSurface (int )
* int = obj.GetLICForSurface ()
* obj.LICForSurfaceOn ()
* obj.LICForSurfaceOff ()
* obj.SetNumberOfSteps (int ) - Number of streamline
integration steps (initial value is 1). In term of visual
quality, the greater (within some range) the better.
* int = obj.GetNumberOfSteps () - Number of streamline
integration steps (initial value is 1). In term of visual
quality, the greater (within some range) the better.
* obj.SetLICStepSize (double ) - 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.
* double = obj.GetLICStepSizeMinValue () - 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.
* double = obj.GetLICStepSizeMaxValue () - 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.
* double = obj.GetLICStepSize () - 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.
* obj.SetNoise (vtkTextureObject noise) - Set/Get the input
white noise texture (initial value is NULL).
* vtkTextureObject = obj.GetNoise () - Set/Get the input
white noise texture (initial value is NULL).
* obj.SetVectorField (vtkTextureObject vectorField) - Set/
Get the vector field (initial value is NULL).
* vtkTextureObject = obj.GetVectorField () - Set/Get the
vector field (initial value is NULL).
* obj.SetComponentIds (int , int ) - 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].
* obj.SetComponentIds (int a[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].
* int = obj. GetComponentIds () - 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].
* obj.SetGridSpacings (double , double ) - 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.
* obj.SetGridSpacings (double a[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.
* double = obj. GetGridSpacings () - 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.
* obj.SetTransformVectors (int ) - 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.
* int = obj.GetTransformVectorsMinValue () - 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.
* int = obj.GetTransformVectorsMaxValue () - 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.
* obj.TransformVectorsOn () - 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.
* obj.TransformVectorsOff () - 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.
* int = obj.GetTransformVectors () - 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.
* obj.SetMagnification (int ) - The the magnification factor
(default is 1.0).
* int = obj.GetMagnificationMinValue () - The the
magnification factor (default is 1.0).
* int = obj.GetMagnificationMaxValue () - The the
magnification factor (default is 1.0).
* int = obj.GetMagnification () - The the magnification
factor (default is 1.0).
* obj.SetVectorShiftScale (double shift, double scale) -
Returns if the context supports the required extensions.
* int = obj.Execute () - Perform the LIC and obtain the LIC
texture. Return 1 if no error.
* int = obj.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.
* int = obj.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.
* obj.SetLIC (vtkTextureObject lic) - LIC texture (initial
value is NULL) set by Execute().
* vtkTextureObject = obj.GetLIC () - LIC texture (initial
value is NULL) set by Execute().
* FreeMat_Documentation
* Visualization_Toolkit_Rendering_Classes
* Generated on Thu Jul 25 2013 17:18:35 for FreeMat by
doxygen_ 1.8.1.1
|