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