VTK
vtkVolumeInputHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVolumeInputHelper.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 =========================================================================*/
30 #ifndef vtkVolumeInputHelper_h
31 #define vtkVolumeInputHelper_h
32 #ifndef __VTK_WRAP__
33 #include <map>
34 
35 #include "vtkSmartPointer.h" // For SmartPointer
36 #include "vtkTimeStamp.h" // For TimeStamp
37 
38 
43 class vtkRenderer;
44 class vtkShaderProgram;
45 class vtkVolume;
46 class vtkVolumeTexture;
47 class vtkWindow;
48 
50 {
51 public:
52  vtkVolumeInputHelper() = default;
54 
55  void RefreshTransferFunction(vtkRenderer* ren, const int uniformIndex,
56  const int blendMode, const float samplingDist);
57  void ForceTransferInit();
58 
59  void ActivateTransferFunction(vtkShaderProgram* prog, const int blendMode);
60  void DeactivateTransferFunction(const int blendMode);
61 
62  void ReleaseGraphicsResources(vtkWindow* window);
63 
65  vtkVolume* Volume = nullptr;
66 
72  INVALID = 0,
74  LA = 2,
75  RGBA = 4
76  };
78 
86 
90  std::map<int, std::string> RGBTablesMap;
91  std::map<int, std::string> OpacityTablesMap;
92  std::map<int, std::string> GradientOpacityTablesMap;
93  std::map<int, std::string> TransferFunctions2DMap;
94 
100  int ColorRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
101  int ScalarOpacityRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
102  int GradientOpacityRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
103 
109 
110 protected:
111  void InitializeTransferFunction(vtkRenderer* ren, const int index);
112 
113  void CreateTransferFunction1D(vtkRenderer* ren, const int index);
114  void CreateTransferFunction2D(vtkRenderer* ren, const int index);
115 
116  void UpdateTransferFunctions(vtkRenderer* ren, const int blendMode,
117  const float samplingDist);
119  unsigned int component, const int blendMode, const float samplingDist);
121  unsigned int component);
123  unsigned int component, const float samplingDist);
124  void UpdateTransferFunction2D(vtkRenderer* ren, unsigned int component);
125 
126  void ReleaseGraphicsTransfer1D(vtkWindow* window);
127  void ReleaseGraphicsTransfer2D(vtkWindow* window);
128 
130  bool InitializeTransfer = true;
131 };
132 
133 #endif
134 #endif // vtkVolumeInputHelper_h
135 // VTK-HeaderTest-Exclude: vtkVolumeInputHelper.h
vtkVolumeInputHelper::GradientOpacityRangeType
int GradientOpacityRangeType
Definition: vtkVolumeInputHelper.h:102
vtkOpenGLVolumeGradientOpacityTables
Definition: vtkOpenGLVolumeGradientOpacityTable.h:216
vtkOpenGLVolumeRGBTables
Definition: vtkOpenGLVolumeRGBTable.h:215
vtkX3D::component
Definition: vtkX3D.h:175
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
vtkVolumeInputHelper::ColorRangeType
int ColorRangeType
These values currently stored in vtkGPUVolumeRCMapper but should be moved into vtkVolumeProperty in o...
Definition: vtkVolumeInputHelper.h:100
vtkTimeStamp.h
vtkVolumeInputHelper::OpacityTablesMap
std::map< int, std::string > OpacityTablesMap
Definition: vtkVolumeInputHelper.h:91
vtkVolumeInputHelper::INVALID
Definition: vtkVolumeInputHelper.h:72
vtkVolumeInputHelper::GradientCacheName
std::string GradientCacheName
Stores the uniform variable name where the gradient will be stored for this input in the fragment sha...
Definition: vtkVolumeInputHelper.h:108
vtkVolumeInputHelper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *window)
vtkVolumeInputHelper::UpdateTransferFunctions
void UpdateTransferFunctions(vtkRenderer *ren, const int blendMode, const float samplingDist)
vtkVolumeInputHelper::TransferFunctions2D
vtkSmartPointer< vtkOpenGLTransferFunctions2D > TransferFunctions2D
Definition: vtkVolumeInputHelper.h:85
vtkVolumeInputHelper::RefreshTransferFunction
void RefreshTransferFunction(vtkRenderer *ren, const int uniformIndex, const int blendMode, const float samplingDist)
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkVolumeInputHelper::Texture
vtkSmartPointer< vtkVolumeTexture > Texture
Definition: vtkVolumeInputHelper.h:64
vtkVolumeInputHelper::GradientOpacityTables
vtkSmartPointer< vtkOpenGLVolumeGradientOpacityTables > GradientOpacityTables
Transfer function internal structures and helpers.
Definition: vtkVolumeInputHelper.h:82
vtkSmartPointer< vtkVolumeTexture >
vtkVolumeInputHelper::ReleaseGraphicsTransfer1D
void ReleaseGraphicsTransfer1D(vtkWindow *window)
vtkVolumeInputHelper::RGBTablesMap
std::map< int, std::string > RGBTablesMap
Maps uniform texture variable names to its corresponding texture unit.
Definition: vtkVolumeInputHelper.h:90
vtkVolumeInputHelper::LA
Definition: vtkVolumeInputHelper.h:74
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkVolumeInputHelper::Volume
vtkVolume * Volume
Definition: vtkVolumeInputHelper.h:65
vtkVolumeInputHelper::UpdateColorTransferFunction
int UpdateColorTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component)
vtkVolumeInputHelper::LutInit
vtkTimeStamp LutInit
Definition: vtkVolumeInputHelper.h:129
vtkVolumeInputHelper::UpdateGradientOpacityTransferFunction
int UpdateGradientOpacityTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component, const float samplingDist)
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:47
vtkVolumeInputHelper::ReleaseGraphicsTransfer2D
void ReleaseGraphicsTransfer2D(vtkWindow *window)
vtkSmartPointer.h
vtkVolumeInputHelper::INDEPENDENT
Definition: vtkVolumeInputHelper.h:73
vtkVolumeInputHelper::InitializeTransfer
bool InitializeTransfer
Definition: vtkVolumeInputHelper.h:130
vtkVolumeInputHelper::ActivateTransferFunction
void ActivateTransferFunction(vtkShaderProgram *prog, const int blendMode)
vtkVolumeInputHelper::UpdateOpacityTransferFunction
int UpdateOpacityTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component, const int blendMode, const float samplingDist)
vtkVolumeInputHelper::CreateTransferFunction1D
void CreateTransferFunction1D(vtkRenderer *ren, const int index)
vtkVolumeInputHelper::TransferFunctions2DMap
std::map< int, std::string > TransferFunctions2DMap
Definition: vtkVolumeInputHelper.h:93
vtkVolumeTexture
Creates and manages the volume texture rendered by vtkOpenGLGPUVolumeRayCastMapper.
Definition: vtkVolumeTexture.h:87
vtkX3D::string
Definition: vtkX3D.h:490
vtkVolumeInputHelper::UpdateTransferFunction2D
void UpdateTransferFunction2D(vtkRenderer *ren, unsigned int component)
vtkVolumeInputHelper::RGBTables
vtkSmartPointer< vtkOpenGLVolumeRGBTables > RGBTables
Definition: vtkVolumeInputHelper.h:84
vtkVolumeInputHelper
Convenience container for internal structures specific to a volume input.
Definition: vtkVolumeInputHelper.h:49
vtkVolumeInputHelper::CreateTransferFunction2D
void CreateTransferFunction2D(vtkRenderer *ren, const int index)
vtkVolumeInputHelper::ComponentMode
ComponentMode
Defines the various component modes supported by vtkGPUVolumeRayCastMapper.
Definition: vtkVolumeInputHelper.h:71
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkOpenGLVolumeOpacityTables
Definition: vtkOpenGLVolumeOpacityTable.h:263
vtkVolumeInputHelper::DeactivateTransferFunction
void DeactivateTransferFunction(const int blendMode)
vtkVolumeInputHelper::GradientOpacityTablesMap
std::map< int, std::string > GradientOpacityTablesMap
Definition: vtkVolumeInputHelper.h:92
vtkVolumeInputHelper::OpacityTables
vtkSmartPointer< vtkOpenGLVolumeOpacityTables > OpacityTables
Definition: vtkVolumeInputHelper.h:83
vtkVolumeInputHelper::InitializeTransferFunction
void InitializeTransferFunction(vtkRenderer *ren, const int index)
vtkVolumeInputHelper::ForceTransferInit
void ForceTransferInit()
vtkX3D::index
Definition: vtkX3D.h:246
vtkOpenGLTransferFunctions2D
Container for a set of TransferFunction2D instances.
Definition: vtkOpenGLTransferFunction2D.h:214
vtkVolumeInputHelper::RGBA
Definition: vtkVolumeInputHelper.h:75
vtkVolumeInputHelper::vtkVolumeInputHelper
vtkVolumeInputHelper()=default
vtkVolumeInputHelper::ScalarOpacityRangeType
int ScalarOpacityRangeType
Definition: vtkVolumeInputHelper.h:101