VTK
vtkLineIntegralConvolution2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLineIntegralConvolution2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
92 #ifndef vtkLineIntegralConvolution2D_h
93 #define vtkLineIntegralConvolution2D_h
94 
95 #include "vtkObject.h"
96 #include "vtkWeakPointer.h" // for ren context
97 #include "vtkRenderingLICModule.h" // for export macro
98 #include <deque> // for deque
99 
100 class vtkRenderWindow;
101 class vtkTextureObject;
102 class vtkPixelExtent;
103 class vtkShaderProgram2;
106 
107 class VTKRENDERINGLIC_EXPORT vtkLineIntegralConvolution2D : public vtkObject
108 {
109 public:
112  void PrintSelf(ostream & os, vtkIndent indent);
113 
117  static bool IsSupported(vtkRenderWindow * renWin);
118 
120 
124  void SetContext(vtkRenderWindow *context);
127 
129 
134  vtkSetClampMacro(EnhancedLIC, int, 0, 1);
135  vtkGetMacro(EnhancedLIC, int);
136  vtkBooleanMacro(EnhancedLIC, int);
138 
140 
161  enum {
162  ENHANCE_CONTRAST_OFF=0,
163  ENHANCE_CONTRAST_ON=1};
164  vtkSetClampMacro(EnhanceContrast, int, 0, 2);
165  vtkGetMacro(EnhanceContrast, int);
166  vtkBooleanMacro(EnhanceContrast, int);
168 
170 
187  vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0);
188  vtkGetMacro(LowContrastEnhancementFactor, double);
189  vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0);
190  vtkGetMacro(HighContrastEnhancementFactor, double);
192 
194 
200  vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX);
201  vtkGetMacro(AntiAlias, int);
202  vtkBooleanMacro(AntiAlias, int);
204 
206 
210  vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX);
211  vtkGetMacro(NumberOfSteps, int);
213 
215 
222  vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX);
223  vtkGetMacro(StepSize, double);
225 
227 
232  void SetComponentIds(int c0, int c1);
233  void SetComponentIds(int c[2]){ this->SetComponentIds(c[0], c[1]); }
234  vtkGetVector2Macro(ComponentIds, int);
236 
238 
243  vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0);
244  vtkGetMacro(MaxNoiseValue, double);
246 
248 
254  void SetTransformVectors(int val);
255  vtkGetMacro(TransformVectors, int);
257 
279  void SetNormalizeVectors(int val);
280  vtkGetMacro(NormalizeVectors, int);
282 
284 
293  vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX);
294  vtkGetMacro(MaskThreshold, double);
296 
297 
302  vtkTextureObject *vectorTex,
303  vtkTextureObject *noiseTex);
304 
310  const int extent[4],
311  vtkTextureObject *vectorTex,
312  vtkTextureObject *noiseTex);
313 
326  const vtkPixelExtent &inputTexExtent,
327  const std::deque<vtkPixelExtent> &vectorExtent,
328  const std::deque<vtkPixelExtent> &licExtent,
329  vtkTextureObject *vectorTex,
330  vtkTextureObject *maskVectorTex,
331  vtkTextureObject *noiseTex);
332 
337  static
339 
340  static
342 
352 
357  virtual void GetGlobalMinMax(
359  float&,
360  float&) {}
361 
368  virtual void WriteTimerLog(const char *){}
369 
370 protected:
373 
382 
383  void BuildShaders();
384 
386  float computeBounds[4],
387  vtkPixelExtent computeExtent);
388 
389  vtkTextureObject *AllocateBuffer(unsigned int texSize[2]);
390 
396 
403  virtual void StartTimerEvent(const char *){}
404  virtual void EndTimerEvent(const char *){}
405 
406 protected:
408 
411 
421 
423  double StepSize;
433  int ComponentIds[2];
435 
436 private:
437  vtkLineIntegralConvolution2D(const vtkLineIntegralConvolution2D &) VTK_DELETE_FUNCTION;
438  void operator = (const vtkLineIntegralConvolution2D &) VTK_DELETE_FUNCTION;
439 };
440 
441 #endif
Interface to OpenGL framebuffer object.
a simple class to control print indentation
Definition: vtkIndent.h:40
GPU-based implementation of Line Integral Convolution (LIC)
static vtkLineIntegralConvolution2D * New()
vtkTextureObject * Execute(const vtkPixelExtent &inputTexExtent, const std::deque< vtkPixelExtent > &vectorExtent, const std::deque< vtkPixelExtent > &licExtent, vtkTextureObject *vectorTex, vtkTextureObject *maskVectorTex, vtkTextureObject *noiseTex)
Compute LIC over the desired subset of the input texture.
virtual void WriteTimerLog(const char *)
Methods used for parallel benchmarks.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetAAVShader(vtkShaderProgram2 *prog)
virtual vtkPainterCommunicator * GetCommunicator()
static void SetVectorTexParameters(vtkTextureObject *vectors)
Convenience functions to ensure that the input textures are configured correctly.
void SetLICIShader(vtkShaderProgram2 *prog)
void SetNoise2TexParameters(vtkTextureObject *noise)
Convenience functions to ensure that the input textures are configured correctly.
void SetComponentIds(int c0, int c1)
If VectorField has >= 3 components, we must choose which 2 components form the (X,...
void SetLIC0Shader(vtkShaderProgram2 *prog)
vtkWeakPointer< vtkRenderWindow > Context
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)
For parallel operation, find global min/max min/max are in/out.
virtual void StartTimerEvent(const char *)
Methods used for parallel benchmarks.
void RenderQuad(float computeBounds[4], vtkPixelExtent computeExtent)
void SetContext(vtkRenderWindow *context)
Set/Get the rendering context.
static bool IsSupported(vtkRenderWindow *renWin)
Returns if the context supports the required extensions.
void SetLICNShader(vtkShaderProgram2 *prog)
virtual void EndTimerEvent(const char *)
vtkTextureObject * AllocateBuffer(unsigned int texSize[2])
vtkRenderWindow * GetContext()
vtkTextureObject * Execute(vtkTextureObject *vectorTex, vtkTextureObject *noiseTex)
Compute the lic on the entire vector field texture.
void SetTransformVectors(int val)
This class performs LIC in the normalized image space.
void SetCEShader(vtkShaderProgram2 *prog)
void SetVTShader(vtkShaderProgram2 *prog)
vtkTextureObject * Execute(const int extent[4], vtkTextureObject *vectorTex, vtkTextureObject *noiseTex)
Compute the lic on the indicated subset of the vector field texture.
virtual void SetCommunicator(vtkPainterCommunicator *)
Set the communicator to use during parallel operation The communicator will not be duplicated or refe...
void SetEEShader(vtkShaderProgram2 *prog)
void SetAAHShader(vtkShaderProgram2 *prog)
static void SetNoiseTexParameters(vtkTextureObject *noise)
void SetNormalizeVectors(int val)
Set/Get the spacing in each dimension of the plane on which the vector field is defined.
abstract base class for most VTK objects
Definition: vtkObject.h:60
A communicator that can safely be used inside a painter.
Representation of a cartesian pixel plane and common operations on it.
create a window for renderers to draw into
abstracts an OpenGL texture object.
@ extent
Definition: vtkX3D.h:345
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_INT_MAX
Definition: vtkType.h:153
#define VTK_FLOAT_MAX
Definition: vtkType.h:161