VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkSurfaceLICPainter.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00058 #ifndef __vtkSurfaceLICPainter_h 00059 #define __vtkSurfaceLICPainter_h 00060 00061 #include "vtkRenderingLICModule.h" // For export macro 00062 #include "vtkPainter.h" 00063 00064 class vtkRenderWindow; 00065 class vtkRenderer; 00066 class vtkActor; 00067 class vtkImageData; 00068 class vtkDataObject; 00069 class vtkDataArray; 00070 class vtkPainterCommunicator; 00071 00072 class VTKRENDERINGLIC_EXPORT vtkSurfaceLICPainter : public vtkPainter 00073 { 00074 public: 00075 static vtkSurfaceLICPainter* New(); 00076 vtkTypeMacro(vtkSurfaceLICPainter, vtkPainter); 00077 void PrintSelf(ostream& os, vtkIndent indent); 00078 00082 virtual void ReleaseGraphicsResources(vtkWindow * win); 00083 00088 virtual vtkDataObject* GetOutput(); 00089 00091 00092 void SetEnable(int val); 00093 vtkGetMacro(Enable, int); 00094 void SetEnableOn(){ this->SetEnable(1); } 00095 void SetEnableOff(){ this->SetEnable(0); } 00097 00099 00103 void SetInputArrayToProcess(int fieldAssociation, const char *name); 00104 void SetInputArrayToProcess(int fieldAssociation, int fieldAttributeType); 00106 00108 00109 void SetNumberOfSteps(int val); 00110 vtkGetMacro(NumberOfSteps, int); 00112 00114 00115 void SetStepSize(double val); 00116 vtkGetMacro(StepSize, double); 00118 00120 00129 void SetNormalizeVectors(int val); 00130 vtkBooleanMacro(NormalizeVectors, int); 00131 vtkGetMacro(NormalizeVectors, int); 00133 00135 00138 void SetMaskOnSurface(int val); 00139 vtkBooleanMacro(MaskOnSurface, int); 00140 vtkGetMacro(MaskOnSurface, int); 00142 00144 00157 void SetMaskThreshold(double val); 00158 vtkGetMacro(MaskThreshold, double); 00160 00162 00165 void SetMaskColor(double *val); 00166 void SetMaskColor(double r, double g, double b) 00167 { double rgb[3]={r,g,b}; this->SetMaskColor(rgb); } 00168 vtkGetVector3Macro(MaskColor, double); 00170 00172 00176 void SetMaskIntensity(double val); 00177 vtkGetMacro(MaskIntensity, double); 00179 00181 00184 void SetEnhancedLIC(int val); 00185 vtkGetMacro(EnhancedLIC, int); 00186 vtkBooleanMacro(EnhancedLIC, int); 00188 00190 00211 enum { 00212 ENHANCE_CONTRAST_OFF=0, 00213 ENHANCE_CONTRAST_LIC=1, 00214 ENHANCE_CONTRAST_COLOR=3, 00215 ENHANCE_CONTRAST_BOTH=4 00216 }; 00217 void SetEnhanceContrast(int val); 00218 vtkGetMacro(EnhanceContrast, int); 00220 00222 00234 vtkGetMacro(LowLICContrastEnhancementFactor, double); 00235 vtkGetMacro(HighLICContrastEnhancementFactor, double); 00236 void SetLowLICContrastEnhancementFactor(double val); 00237 void SetHighLICContrastEnhancementFactor(double val); 00238 // 00239 vtkGetMacro(LowColorContrastEnhancementFactor, double); 00240 vtkGetMacro(HighColorContrastEnhancementFactor, double); 00241 void SetLowColorContrastEnhancementFactor(double val); 00242 void SetHighColorContrastEnhancementFactor(double val); 00244 00246 00250 void SetAntiAlias(int val); 00251 vtkBooleanMacro(AntiAlias, int); 00252 vtkGetMacro(AntiAlias, int); 00254 00256 00262 enum { 00263 COLOR_MODE_BLEND=0, 00264 COLOR_MODE_MAP 00265 }; 00266 void SetColorMode(int val); 00267 vtkGetMacro(ColorMode, int); 00269 00271 00276 void SetLICIntensity(double val); 00277 vtkGetMacro(LICIntensity, double); 00279 00281 00286 void SetMapModeBias(double val); 00287 vtkGetMacro(MapModeBias, double); 00289 00291 00294 void SetNoiseDataSet(vtkImageData *data); 00295 vtkImageData *GetNoiseDataSet(); 00297 00299 00315 void SetGenerateNoiseTexture(int shouldGenerate); 00316 vtkGetMacro(GenerateNoiseTexture, int); 00318 00320 00323 enum { 00324 NOISE_TYPE_UNIFORM=0, 00325 NOISE_TYPE_GAUSSIAN=1, 00326 NOISE_TYPE_PERLIN=2 00327 }; 00328 void SetNoiseType(int type); 00329 vtkGetMacro(NoiseType, int); 00331 00333 00335 void SetNoiseTextureSize(int length); 00336 vtkGetMacro(NoiseTextureSize, int); 00338 00340 00342 void SetNoiseGrainSize(int val); 00343 vtkGetMacro(NoiseGrainSize, int); 00345 00347 00351 void SetMinNoiseValue(double val); 00352 void SetMaxNoiseValue(double val); 00353 vtkGetMacro(MinNoiseValue, double); 00354 vtkGetMacro(MaxNoiseValue, double); 00356 00358 00360 void SetNumberOfNoiseLevels(int val); 00361 vtkGetMacro(NumberOfNoiseLevels, int); 00363 00365 00368 void SetImpulseNoiseProbability(double val); 00369 vtkGetMacro(ImpulseNoiseProbability, double); 00371 00373 00375 void SetImpulseNoiseBackgroundValue(double val); 00376 vtkGetMacro(ImpulseNoiseBackgroundValue, double); 00378 00380 00381 void SetNoiseGeneratorSeed(int val); 00382 vtkGetMacro(NoiseGeneratorSeed, int); 00384 00386 00387 enum { 00388 COMPOSITE_INPLACE=0, 00389 COMPOSITE_INPLACE_DISJOINT=1, 00390 COMPOSITE_BALANCED=2, 00391 COMPOSITE_AUTO=3 00392 }; 00393 void SetCompositeStrategy(int val); 00394 vtkGetMacro(CompositeStrategy, int); 00396 00399 static bool IsSupported(vtkRenderWindow *context); 00400 00405 virtual void WriteTimerLog(const char *){} 00406 00407 protected: 00408 vtkSurfaceLICPainter(); 00409 ~vtkSurfaceLICPainter(); 00410 00414 virtual void ProcessInformation(vtkInformation* info); 00415 00419 virtual void GetGlobalMinMax(vtkPainterCommunicator*, float&, float&){} 00420 00422 00426 virtual void StartTimerEvent(const char *){} 00427 virtual void EndTimerEvent(const char *){} 00429 00434 virtual vtkPainterCommunicator *CreateCommunicator(int); 00435 00438 void CreateCommunicator(); 00439 00441 void GetBounds(vtkDataObject* data, double bounds[6]); 00442 00444 virtual void ReportReferences(vtkGarbageCollector *collector); 00445 00447 void UpdateNoiseImage(vtkRenderWindow *renWin); 00448 00450 00455 virtual void RenderInternal( 00456 vtkRenderer* renderer, 00457 vtkActor* actor, 00458 unsigned long typeflags, 00459 bool forceCompileOnly); 00461 00462 00464 void ValidateContext(vtkRenderer *renderer); 00465 00467 00468 bool NeedToUpdateOutputData(); 00469 virtual bool NeedToUpdateCommunicator(); 00470 bool NeedToRenderGeometry(vtkRenderer *renderer, vtkActor *actor); 00471 bool NeedToGatherVectors(); 00472 bool NeedToComputeLIC(); 00473 bool NeedToColorLIC(); 00474 void SetUpdateAll(); 00476 00478 00479 bool PrepareOutput(); 00480 void InitializeResources(); 00482 00484 00485 bool VectorsToTCoords(vtkDataObject *dataObj); 00486 bool VectorsToTCoords(vtkDataSet *dataObj); 00487 void ClearTCoords(vtkDataSet *data); 00489 00491 bool CanRenderSurfaceLIC(vtkActor *actor, int typeflags); 00492 00493 protected: 00494 // Unit is a pixel length. 00495 int NumberOfSteps; 00496 double StepSize; 00497 int NormalizeVectors; 00498 00499 int EnhancedLIC; 00500 int EnhanceContrast; 00501 double LowLICContrastEnhancementFactor; 00502 double HighLICContrastEnhancementFactor; 00503 double LowColorContrastEnhancementFactor; 00504 double HighColorContrastEnhancementFactor; 00505 int AntiAlias; 00506 00507 int MaskOnSurface; 00508 double MaskThreshold; 00509 double MaskIntensity; 00510 double MaskColor[3]; 00511 00512 int ColorMode; 00513 double LICIntensity; 00514 double MapModeBias; 00515 00516 int GenerateNoiseTexture; 00517 int NoiseType; 00518 int NoiseTextureSize; 00519 int NoiseGrainSize; 00520 double MinNoiseValue; 00521 double MaxNoiseValue; 00522 int NumberOfNoiseLevels; 00523 double ImpulseNoiseProbability; 00524 double ImpulseNoiseBackgroundValue; 00525 int NoiseGeneratorSeed; 00526 00527 int AlwaysUpdate; 00528 int Enable; 00529 int CompositeStrategy; 00530 00531 vtkDataObject* Output; 00532 class vtkInternals; 00533 vtkInternals* Internals; 00534 00535 private: 00536 vtkSurfaceLICPainter(const vtkSurfaceLICPainter&); // Not implemented. 00537 void operator=(const vtkSurfaceLICPainter&); // Not implemented. 00538 }; 00539 00540 #endif