VTK
vtkSurfaceLICPainter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSurfaceLICPainter.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 =========================================================================*/
56 #ifndef vtkSurfaceLICPainter_h
57 #define vtkSurfaceLICPainter_h
58 
59 #include "vtkRenderingLICModule.h" // For export macro
60 #include "vtkPainter.h"
61 
62 class vtkRenderWindow;
63 class vtkRenderer;
64 class vtkActor;
65 class vtkImageData;
66 class vtkDataObject;
67 class vtkDataArray;
69 
70 class VTKRENDERINGLIC_EXPORT vtkSurfaceLICPainter : public vtkPainter
71 {
72 public:
73  static vtkSurfaceLICPainter* New();
75  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
76 
82  void ReleaseGraphicsResources(vtkWindow * win) VTK_OVERRIDE;
83 
90  vtkDataObject* GetOutput() VTK_OVERRIDE;
91 
93 
96  void SetEnable(int val);
97  vtkGetMacro(Enable, int);
98  void SetEnableOn(){ this->SetEnable(1); }
99  void SetEnableOff(){ this->SetEnable(0); }
101 
103 
109  void SetInputArrayToProcess(int fieldAssociation, const char *name);
110  void SetInputArrayToProcess(int fieldAssociation, int fieldAttributeType);
112 
114 
117  void SetNumberOfSteps(int val);
118  vtkGetMacro(NumberOfSteps, int);
120 
122 
125  void SetStepSize(double val);
126  vtkGetMacro(StepSize, double);
128 
130 
141  void SetNormalizeVectors(int val);
142  vtkBooleanMacro(NormalizeVectors, int);
143  vtkGetMacro(NormalizeVectors, int);
145 
147 
152  void SetMaskOnSurface(int val);
153  vtkBooleanMacro(MaskOnSurface, int);
154  vtkGetMacro(MaskOnSurface, int);
156 
158 
174  void SetMaskThreshold(double val);
175  vtkGetMacro(MaskThreshold, double);
177 
179 
184  void SetMaskColor(double *val);
185  void SetMaskColor(double r, double g, double b)
186  { double rgb[3]={r,g,b}; this->SetMaskColor(rgb); }
187  vtkGetVector3Macro(MaskColor, double);
189 
191 
199  void SetMaskIntensity(double val);
200  vtkGetMacro(MaskIntensity, double);
202 
204 
209  void SetEnhancedLIC(int val);
210  vtkGetMacro(EnhancedLIC, int);
211  vtkBooleanMacro(EnhancedLIC, int);
213 
215 
248  enum {
249  ENHANCE_CONTRAST_OFF=0,
250  ENHANCE_CONTRAST_LIC=1,
251  ENHANCE_CONTRAST_COLOR=3,
252  ENHANCE_CONTRAST_BOTH=4
253  };
254  void SetEnhanceContrast(int val);
255  vtkGetMacro(EnhanceContrast, int);
257 
259 
275  vtkGetMacro(LowLICContrastEnhancementFactor, double);
276  vtkGetMacro(HighLICContrastEnhancementFactor, double);
277  void SetLowLICContrastEnhancementFactor(double val);
278  void SetHighLICContrastEnhancementFactor(double val);
279  //
280  vtkGetMacro(LowColorContrastEnhancementFactor, double);
281  vtkGetMacro(HighColorContrastEnhancementFactor, double);
282  void SetLowColorContrastEnhancementFactor(double val);
283  void SetHighColorContrastEnhancementFactor(double val);
285 
287 
293  void SetAntiAlias(int val);
294  vtkBooleanMacro(AntiAlias, int);
295  vtkGetMacro(AntiAlias, int);
297 
299 
308  enum {
309  COLOR_MODE_BLEND=0,
310  COLOR_MODE_MAP
311  };
312  void SetColorMode(int val);
313  vtkGetMacro(ColorMode, int);
315 
317 
326  void SetLICIntensity(double val);
327  vtkGetMacro(LICIntensity, double);
329 
331 
338  void SetMapModeBias(double val);
339  vtkGetMacro(MapModeBias, double);
341 
343 
348  void SetNoiseDataSet(vtkImageData *data);
349  vtkImageData *GetNoiseDataSet();
351 
353 
372  void SetGenerateNoiseTexture(int shouldGenerate);
373  vtkGetMacro(GenerateNoiseTexture, int);
375 
377 
382  enum {
383  NOISE_TYPE_UNIFORM=0,
384  NOISE_TYPE_GAUSSIAN=1,
385  NOISE_TYPE_PERLIN=2
386  };
387  void SetNoiseType(int type);
388  vtkGetMacro(NoiseType, int);
390 
392 
396  void SetNoiseTextureSize(int length);
397  vtkGetMacro(NoiseTextureSize, int);
399 
401 
405  void SetNoiseGrainSize(int val);
406  vtkGetMacro(NoiseGrainSize, int);
408 
410 
416  void SetMinNoiseValue(double val);
417  void SetMaxNoiseValue(double val);
418  vtkGetMacro(MinNoiseValue, double);
419  vtkGetMacro(MaxNoiseValue, double);
421 
423 
427  void SetNumberOfNoiseLevels(int val);
428  vtkGetMacro(NumberOfNoiseLevels, int);
430 
432 
436  void SetImpulseNoiseProbability(double val);
437  vtkGetMacro(ImpulseNoiseProbability, double);
439 
441 
444  void SetImpulseNoiseBackgroundValue(double val);
445  vtkGetMacro(ImpulseNoiseBackgroundValue, double);
447 
449 
452  void SetNoiseGeneratorSeed(int val);
453  vtkGetMacro(NoiseGeneratorSeed, int);
455 
457 
460  enum {
461  COMPOSITE_INPLACE=0,
462  COMPOSITE_INPLACE_DISJOINT=1,
463  COMPOSITE_BALANCED=2,
464  COMPOSITE_AUTO=3
465  };
466  void SetCompositeStrategy(int val);
467  vtkGetMacro(CompositeStrategy, int);
469 
474  static bool IsSupported(vtkRenderWindow *context);
475 
482  virtual void WriteTimerLog(const char *){}
483 
484 protected:
486  ~vtkSurfaceLICPainter() VTK_OVERRIDE;
487 
493  void ProcessInformation(vtkInformation* info) VTK_OVERRIDE;
494 
500  virtual void GetGlobalMinMax(vtkPainterCommunicator*, float&, float&){}
501 
508  virtual void StartTimerEvent(const char *){}
509  virtual void EndTimerEvent(const char *){}
510 
517  virtual vtkPainterCommunicator *CreateCommunicator(int);
518 
523  void CreateCommunicator();
524 
528  void GetBounds(vtkDataObject* data, double bounds[6]);
529 
533  void ReportReferences(vtkGarbageCollector *collector) VTK_OVERRIDE;
534 
538  void UpdateNoiseImage(vtkRenderWindow *renWin);
539 
547  void RenderInternal(
548  vtkRenderer* renderer,
549  vtkActor* actor,
550  unsigned long typeflags,
551  bool forceCompileOnly) VTK_OVERRIDE;
552 
553 
557  void ValidateContext(vtkRenderer *renderer);
558 
560 
563  bool NeedToUpdateOutputData();
564  virtual bool NeedToUpdateCommunicator();
565  bool NeedToRenderGeometry(vtkRenderer *renderer, vtkActor *actor);
566  bool NeedToGatherVectors();
567  bool NeedToComputeLIC();
568  bool NeedToColorLIC();
569  void SetUpdateAll();
571 
573 
576  bool PrepareOutput();
577  void InitializeResources();
579 
581 
584  bool VectorsToTCoords(vtkDataObject *dataObj);
585  bool VectorsToTCoords(vtkDataSet *dataObj);
586  void ClearTCoords(vtkDataSet *data);
588 
592  bool CanRenderSurfaceLIC(vtkActor *actor, int typeflags);
593 
594 protected:
595  // Unit is a pixel length.
597  double StepSize;
599 
607 
611  double MaskColor[3];
612 
614  double LICIntensity;
615  double MapModeBias;
616 
627 
629  int Enable;
631 
633  class vtkInternals;
634  vtkInternals* Internals;
635 
636 private:
637  vtkSurfaceLICPainter(const vtkSurfaceLICPainter&) VTK_DELETE_FUNCTION;
638  void operator=(const vtkSurfaceLICPainter&) VTK_DELETE_FUNCTION;
639 };
640 
641 #endif
void SetMaskColor(double r, double g, double b)
The MaskColor is used on masked fragments.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
virtual void RenderInternal(vtkRenderer *renderer, vtkActor *actor, unsigned long typeflags, bool forceCompileOnly)
Performs the actual rendering.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
virtual void ProcessInformation(vtkInformation *)
Called before RenderInternal() if the Information has been changed since the last time this method wa...
Definition: vtkPainter.h:233
virtual void EndTimerEvent(const char *)
virtual vtkDataObject * GetOutput()
Get the output data object from this painter.
Definition: vtkPainter.h:174
abstract specification for renderers
Definition: vtkRenderer.h:57
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)
Get the min/max across all ranks.
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this painter.
Detect and break reference loops.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
void ReportReferences(vtkGarbageCollector *collector) override
Take part in garbage collection.
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
void SetEnableOff()
Enable/Disable this painter.
painter that performs LIC on the surface of arbitrary geometry.
create a window for renderers to draw into
Abstract class for drawing poly data.
Definition: vtkPainter.h:61
A communicator that can safely be used inside a painter.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
general representation of visualization data
Definition: vtkDataObject.h:58
virtual void WriteTimerLog(const char *)
Methods used for parallel benchmarks.
virtual void StartTimerEvent(const char *)
Methods used for parallel benchmarks.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.