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
44class vtkRenderer;
46class vtkVolume;
48class vtkWindow;
49
50class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkVolumeInputHelper
51{
52public:
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
112 std::string GradientCacheName;
113
114protected:
115 void InitializeTransferFunction(vtkRenderer* ren, const int index);
116
117 void CreateTransferFunction1D(vtkRenderer* ren, const int index);
118 void CreateTransferFunction2D(vtkRenderer* ren, const int index);
119
120 void UpdateTransferFunctions(vtkRenderer* ren, const int blendMode, const float samplingDist);
121 int UpdateOpacityTransferFunction(vtkRenderer* ren, vtkVolume* vol, unsigned int component,
122 const int blendMode, const float samplingDist);
123 int UpdateColorTransferFunction(vtkRenderer* ren, vtkVolume* vol, unsigned int component);
125 vtkRenderer* ren, vtkVolume* vol, unsigned int component, const float samplingDist);
126 void UpdateTransferFunction2D(vtkRenderer* ren, unsigned int component);
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:182
The ShaderProgram uses one or more Shader objects.
Hold a reference to a vtkObjectBase instance.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
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:144
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39