VTK  9.2.6
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 #include <map>
33 
35 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
36 #include "vtkSmartPointer.h" // For SmartPointer
37 #include "vtkTimeStamp.h" // For TimeStamp
38 
43 class vtkRenderer;
44 class vtkShaderProgram;
45 class vtkVolume;
46 class vtkVolumeTexture;
47 class vtkWindow;
48 
49 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkVolumeInputHelper
50 {
51 public:
52  vtkVolumeInputHelper() = default;
54 
55  void RefreshTransferFunction(
56  vtkRenderer* ren, const int uniformIndex, 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  {
73  INVALID = 0,
74  INDEPENDENT = 1,
75  LA = 2,
76  RGBA = 4
77  };
78  int ComponentMode = INDEPENDENT;
79 
89 
93  std::map<int, std::string> RGBTablesMap;
94  std::map<int, std::string> OpacityTablesMap;
95  std::map<int, std::string> GradientOpacityTablesMap;
96  std::map<int, std::string> TransferFunctions2DMap;
97 
103  int ColorRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
104  int ScalarOpacityRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
105  int GradientOpacityRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
106 
112 
113 protected:
114  void InitializeTransferFunction(vtkRenderer* ren, const int index);
115 
116  void CreateTransferFunction1D(vtkRenderer* ren, const int index);
117  void CreateTransferFunction2D(vtkRenderer* ren, const int index);
118 
119  void UpdateTransferFunctions(vtkRenderer* ren, const int blendMode, const float samplingDist);
120  int UpdateOpacityTransferFunction(vtkRenderer* ren, vtkVolume* vol, unsigned int component,
121  const int blendMode, const float samplingDist);
122  int UpdateColorTransferFunction(vtkRenderer* ren, vtkVolume* vol, unsigned int component);
123  int UpdateGradientOpacityTransferFunction(
124  vtkRenderer* ren, vtkVolume* vol, unsigned int component, const float samplingDist);
125  void UpdateTransferFunction2D(vtkRenderer* ren, unsigned int component);
126 
127  void ReleaseGraphicsTransfer1D(vtkWindow* window);
128  void ReleaseGraphicsTransfer2D(vtkWindow* window);
129 
131  bool InitializeTransfer = true;
132 };
133 
134 #endif // vtkVolumeInputHelper_h
135 // VTK-HeaderTest-Exclude: vtkVolumeInputHelper.h
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
std::map< int, std::string > GradientOpacityTablesMap
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeGradientOpacityTable > > GradientOpacityTables
Transfer function internal structures and helpers.
Creates and manages the volume texture rendered by vtkOpenGLGPUVolumeRayCastMapper.
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeRGBTable > > RGBTables
Convenience container for internal structures specific to a volume input.
std::map< int, std::string > OpacityTablesMap
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeTransferFunction2D > > TransferFunctions2D
record modification and/or execution time
Definition: vtkTimeStamp.h:35
abstract specification for renderers
Definition: vtkRenderer.h:72
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
ComponentMode
Defines the various component modes supported by vtkGPUVolumeRayCastMapper.
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeOpacityTable > > OpacityTables
std::map< int, std::string > RGBTablesMap
Maps uniform texture variable names to its corresponding texture unit.
vtkSmartPointer< vtkVolumeTexture > Texture
std::string GradientCacheName
Stores the uniform variable name where the gradient will be stored for this input in the fragment sha...
The ShaderProgram uses one or more Shader objects.
std::map< int, std::string > TransferFunctions2DMap