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 =========================================================================*/
59 #ifndef vtkSurfaceLICPainter_h
60 #define vtkSurfaceLICPainter_h
61 
62 #include "vtkRenderingLICModule.h" // For export macro
63 #include "vtkPainter.h"
64 
65 class vtkRenderWindow;
66 class vtkRenderer;
67 class vtkActor;
68 class vtkImageData;
69 class vtkDataObject;
70 class vtkDataArray;
72 
73 class VTKRENDERINGLIC_EXPORT vtkSurfaceLICPainter : public vtkPainter
74 {
75 public:
76  static vtkSurfaceLICPainter* New();
78  void PrintSelf(ostream& os, vtkIndent indent);
79 
85  virtual void ReleaseGraphicsResources(vtkWindow * win);
86 
93  virtual vtkDataObject* GetOutput();
94 
96 
99  void SetEnable(int val);
100  vtkGetMacro(Enable, int);
101  void SetEnableOn(){ this->SetEnable(1); }
102  void SetEnableOff(){ this->SetEnable(0); }
104 
106 
112  void SetInputArrayToProcess(int fieldAssociation, const char *name);
113  void SetInputArrayToProcess(int fieldAssociation, int fieldAttributeType);
115 
117 
120  void SetNumberOfSteps(int val);
121  vtkGetMacro(NumberOfSteps, int);
123 
125 
128  void SetStepSize(double val);
129  vtkGetMacro(StepSize, double);
131 
133 
144  void SetNormalizeVectors(int val);
145  vtkBooleanMacro(NormalizeVectors, int);
146  vtkGetMacro(NormalizeVectors, int);
148 
150 
155  void SetMaskOnSurface(int val);
156  vtkBooleanMacro(MaskOnSurface, int);
157  vtkGetMacro(MaskOnSurface, int);
159 
161 
177  void SetMaskThreshold(double val);
178  vtkGetMacro(MaskThreshold, double);
180 
182 
187  void SetMaskColor(double *val);
188  void SetMaskColor(double r, double g, double b)
189  { double rgb[3]={r,g,b}; this->SetMaskColor(rgb); }
190  vtkGetVector3Macro(MaskColor, double);
192 
194 
202  void SetMaskIntensity(double val);
203  vtkGetMacro(MaskIntensity, double);
205 
207 
212  void SetEnhancedLIC(int val);
213  vtkGetMacro(EnhancedLIC, int);
214  vtkBooleanMacro(EnhancedLIC, int);
216 
218 
251  enum {
252  ENHANCE_CONTRAST_OFF=0,
253  ENHANCE_CONTRAST_LIC=1,
254  ENHANCE_CONTRAST_COLOR=3,
255  ENHANCE_CONTRAST_BOTH=4
256  };
257  void SetEnhanceContrast(int val);
258  vtkGetMacro(EnhanceContrast, int);
260 
262 
278  vtkGetMacro(LowLICContrastEnhancementFactor, double);
279  vtkGetMacro(HighLICContrastEnhancementFactor, double);
280  void SetLowLICContrastEnhancementFactor(double val);
281  void SetHighLICContrastEnhancementFactor(double val);
282  //
283  vtkGetMacro(LowColorContrastEnhancementFactor, double);
284  vtkGetMacro(HighColorContrastEnhancementFactor, double);
285  void SetLowColorContrastEnhancementFactor(double val);
286  void SetHighColorContrastEnhancementFactor(double val);
288 
290 
296  void SetAntiAlias(int val);
297  vtkBooleanMacro(AntiAlias, int);
298  vtkGetMacro(AntiAlias, int);
300 
302 
311  enum {
312  COLOR_MODE_BLEND=0,
313  COLOR_MODE_MAP
314  };
315  void SetColorMode(int val);
316  vtkGetMacro(ColorMode, int);
318 
320 
329  void SetLICIntensity(double val);
330  vtkGetMacro(LICIntensity, double);
332 
334 
341  void SetMapModeBias(double val);
342  vtkGetMacro(MapModeBias, double);
344 
346 
351  void SetNoiseDataSet(vtkImageData *data);
352  vtkImageData *GetNoiseDataSet();
354 
356 
375  void SetGenerateNoiseTexture(int shouldGenerate);
376  vtkGetMacro(GenerateNoiseTexture, int);
378 
380 
385  enum {
386  NOISE_TYPE_UNIFORM=0,
387  NOISE_TYPE_GAUSSIAN=1,
388  NOISE_TYPE_PERLIN=2
389  };
390  void SetNoiseType(int type);
391  vtkGetMacro(NoiseType, int);
393 
395 
399  void SetNoiseTextureSize(int length);
400  vtkGetMacro(NoiseTextureSize, int);
402 
404 
408  void SetNoiseGrainSize(int val);
409  vtkGetMacro(NoiseGrainSize, int);
411 
413 
419  void SetMinNoiseValue(double val);
420  void SetMaxNoiseValue(double val);
421  vtkGetMacro(MinNoiseValue, double);
422  vtkGetMacro(MaxNoiseValue, double);
424 
426 
430  void SetNumberOfNoiseLevels(int val);
431  vtkGetMacro(NumberOfNoiseLevels, int);
433 
435 
439  void SetImpulseNoiseProbability(double val);
440  vtkGetMacro(ImpulseNoiseProbability, double);
442 
444 
447  void SetImpulseNoiseBackgroundValue(double val);
448  vtkGetMacro(ImpulseNoiseBackgroundValue, double);
450 
452 
455  void SetNoiseGeneratorSeed(int val);
456  vtkGetMacro(NoiseGeneratorSeed, int);
458 
460 
463  enum {
464  COMPOSITE_INPLACE=0,
465  COMPOSITE_INPLACE_DISJOINT=1,
466  COMPOSITE_BALANCED=2,
467  COMPOSITE_AUTO=3
468  };
469  void SetCompositeStrategy(int val);
470  vtkGetMacro(CompositeStrategy, int);
472 
477  static bool IsSupported(vtkRenderWindow *context);
478 
485  virtual void WriteTimerLog(const char *){}
486 
487 protected:
490 
496  virtual void ProcessInformation(vtkInformation* info);
497 
503  virtual void GetGlobalMinMax(vtkPainterCommunicator*, float&, float&){}
504 
511  virtual void StartTimerEvent(const char *){}
512  virtual void EndTimerEvent(const char *){}
513 
520  virtual vtkPainterCommunicator *CreateCommunicator(int);
521 
526  void CreateCommunicator();
527 
531  void GetBounds(vtkDataObject* data, double bounds[6]);
532 
536  void ReportReferences(vtkGarbageCollector *collector) VTK_OVERRIDE;
537 
541  void UpdateNoiseImage(vtkRenderWindow *renWin);
542 
550  virtual void RenderInternal(
551  vtkRenderer* renderer,
552  vtkActor* actor,
553  unsigned long typeflags,
554  bool forceCompileOnly);
555 
556 
560  void ValidateContext(vtkRenderer *renderer);
561 
563 
566  bool NeedToUpdateOutputData();
567  virtual bool NeedToUpdateCommunicator();
568  bool NeedToRenderGeometry(vtkRenderer *renderer, vtkActor *actor);
569  bool NeedToGatherVectors();
570  bool NeedToComputeLIC();
571  bool NeedToColorLIC();
572  void SetUpdateAll();
574 
576 
579  bool PrepareOutput();
580  void InitializeResources();
582 
584 
587  bool VectorsToTCoords(vtkDataObject *dataObj);
588  bool VectorsToTCoords(vtkDataSet *dataObj);
589  void ClearTCoords(vtkDataSet *data);
591 
595  bool CanRenderSurfaceLIC(vtkActor *actor, int typeflags);
596 
597 protected:
598  // Unit is a pixel length.
600  double StepSize;
602 
610 
614  double MaskColor[3];
615 
617  double LICIntensity;
618  double MapModeBias;
619 
630 
632  int Enable;
634 
636  class vtkInternals;
637  vtkInternals* Internals;
638 
639 private:
640  vtkSurfaceLICPainter(const vtkSurfaceLICPainter&) VTK_DELETE_FUNCTION;
641  void operator=(const vtkSurfaceLICPainter&) VTK_DELETE_FUNCTION;
642 };
643 
644 #endif
vtkSurfaceLICPainter::MapModeBias
double MapModeBias
Definition: vtkSurfaceLICPainter.h:618
vtkSurfaceLICPainter::MaskIntensity
double MaskIntensity
Definition: vtkSurfaceLICPainter.h:613
vtkSurfaceLICPainter::MaskThreshold
double MaskThreshold
Definition: vtkSurfaceLICPainter.h:612
vtkSurfaceLICPainter::ImpulseNoiseBackgroundValue
double ImpulseNoiseBackgroundValue
Definition: vtkSurfaceLICPainter.h:628
vtkSurfaceLICPainter
painter that performs LIC on the surface of arbitrary geometry.
Definition: vtkSurfaceLICPainter.h:73
vtkSurfaceLICPainter::ColorMode
int ColorMode
Definition: vtkSurfaceLICPainter.h:616
vtkX3D::type
Definition: vtkX3D.h:516
vtkX3D::data
Definition: vtkX3D.h:315
vtkSurfaceLICPainter::NoiseGrainSize
int NoiseGrainSize
Definition: vtkSurfaceLICPainter.h:623
vtkSurfaceLICPainter::HighColorContrastEnhancementFactor
double HighColorContrastEnhancementFactor
Definition: vtkSurfaceLICPainter.h:608
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkSurfaceLICPainter::GenerateNoiseTexture
int GenerateNoiseTexture
Definition: vtkSurfaceLICPainter.h:620
vtkSurfaceLICPainter::CompositeStrategy
int CompositeStrategy
Definition: vtkSurfaceLICPainter.h:633
vtkSurfaceLICPainter::StartTimerEvent
virtual void StartTimerEvent(const char *)
Methods used for parallel benchmarks.
Definition: vtkSurfaceLICPainter.h:511
vtkSurfaceLICPainter::Internals
vtkInternals * Internals
Definition: vtkSurfaceLICPainter.h:636
vtkSurfaceLICPainter::Output
vtkDataObject * Output
Definition: vtkSurfaceLICPainter.h:635
vtkSurfaceLICPainter::EndTimerEvent
virtual void EndTimerEvent(const char *)
Definition: vtkSurfaceLICPainter.h:512
vtkSurfaceLICPainter::SetEnableOff
void SetEnableOff()
Definition: vtkSurfaceLICPainter.h:102
vtkX3D::length
Definition: vtkX3D.h:393
vtkSurfaceLICPainter::EnhancedLIC
int EnhancedLIC
Definition: vtkSurfaceLICPainter.h:603
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkSurfaceLICPainter::SetMaskColor
void SetMaskColor(double r, double g, double b)
Definition: vtkSurfaceLICPainter.h:188
vtkPainter::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkSurfaceLICPainter::AlwaysUpdate
int AlwaysUpdate
Definition: vtkSurfaceLICPainter.h:631
vtkSurfaceLICPainter::WriteTimerLog
virtual void WriteTimerLog(const char *)
Methods used for parallel benchmarks.
Definition: vtkSurfaceLICPainter.h:485
vtkSurfaceLICPainter::ImpulseNoiseProbability
double ImpulseNoiseProbability
Definition: vtkSurfaceLICPainter.h:627
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkSurfaceLICPainter::NoiseType
int NoiseType
Definition: vtkSurfaceLICPainter.h:621
vtkSurfaceLICPainter::AntiAlias
int AntiAlias
Definition: vtkSurfaceLICPainter.h:609
vtkSurfaceLICPainter::LICIntensity
double LICIntensity
Definition: vtkSurfaceLICPainter.h:617
vtkSurfaceLICPainter::NumberOfSteps
int NumberOfSteps
Definition: vtkSurfaceLICPainter.h:599
vtkSurfaceLICPainter::NoiseGeneratorSeed
int NoiseGeneratorSeed
Definition: vtkSurfaceLICPainter.h:629
vtkPainter::RenderInternal
virtual void RenderInternal(vtkRenderer *renderer, vtkActor *actor, unsigned long typeflags, bool forceCompileOnly)
Performs the actual rendering.
vtkSurfaceLICPainter::NoiseTextureSize
int NoiseTextureSize
Definition: vtkSurfaceLICPainter.h:622
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkSurfaceLICPainter::HighLICContrastEnhancementFactor
double HighLICContrastEnhancementFactor
Definition: vtkSurfaceLICPainter.h:606
vtkPainter::ProcessInformation
virtual void ProcessInformation(vtkInformation *)
Called before RenderInternal() if the Information has been changed since the last time this method wa...
Definition: vtkPainter.h:233
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSurfaceLICPainter::MaxNoiseValue
double MaxNoiseValue
Definition: vtkSurfaceLICPainter.h:625
vtkPainter
Abstract class for drawing poly data.
Definition: vtkPainter.h:61
vtkSurfaceLICPainter::StepSize
double StepSize
Definition: vtkSurfaceLICPainter.h:600
vtkSurfaceLICPainter::MaskOnSurface
int MaskOnSurface
Definition: vtkSurfaceLICPainter.h:611
vtkSurfaceLICPainter::SetEnableOn
void SetEnableOn()
Definition: vtkSurfaceLICPainter.h:101
vtkPainter.h
vtkX3D::name
Definition: vtkX3D.h:219
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:99
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSurfaceLICPainter::NumberOfNoiseLevels
int NumberOfNoiseLevels
Definition: vtkSurfaceLICPainter.h:626
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkPainter::GetOutput
virtual vtkDataObject * GetOutput()
Get the output data object from this painter.
Definition: vtkPainter.h:174
vtkX3D::info
Definition: vtkX3D.h:376
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:30
vtkSurfaceLICPainter::NormalizeVectors
int NormalizeVectors
Definition: vtkSurfaceLICPainter.h:601
vtkSurfaceLICPainter::MinNoiseValue
double MinNoiseValue
Definition: vtkSurfaceLICPainter.h:624
vtkSurfaceLICPainter::GetGlobalMinMax
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)
Get the min/max across all ranks.
Definition: vtkSurfaceLICPainter.h:503
vtkSurfaceLICPainter::EnhanceContrast
int EnhanceContrast
Definition: vtkSurfaceLICPainter.h:604
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkPainter::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this painter.
vtkSurfaceLICPainter::LowColorContrastEnhancementFactor
double LowColorContrastEnhancementFactor
Definition: vtkSurfaceLICPainter.h:607
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:86
vtkPainter::ReportReferences
void ReportReferences(vtkGarbageCollector *collector) override
Take part in garbage collection.
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkSurfaceLICPainter::Enable
int Enable
Definition: vtkSurfaceLICPainter.h:632
vtkSurfaceLICPainter::LowLICContrastEnhancementFactor
double LowLICContrastEnhancementFactor
Definition: vtkSurfaceLICPainter.h:605