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
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
void DeactivateTransferFunction(const int blendMode)
std::map< int, std::string > GradientOpacityTablesMap
Container for a set of TransferFunction2D instances.
vtkVolumeInputHelper()=default
vtkSmartPointer< vtkOpenGLVolumeGradientOpacityTables > GradientOpacityTables
Transfer function internal structures and helpers.
Creates and manages the volume texture rendered by vtkOpenGLGPUVolumeRayCastMapper.
Convenience container for internal structures specific to a volume input.
std::map< int, std::string > OpacityTablesMap
record modification and/or execution time
Definition: vtkTimeStamp.h:35
abstract specification for renderers
Definition: vtkRenderer.h:63
void ReleaseGraphicsTransfer2D(vtkWindow *window)
int ColorRangeType
These values currently stored in vtkGPUVolumeRCMapper but should be moved into vtkVolumeProperty in o...
vtkSmartPointer< vtkOpenGLTransferFunctions2D > TransferFunctions2D
void RefreshTransferFunction(vtkRenderer *ren, const int uniformIndex, const int blendMode, const float samplingDist)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
void ActivateTransferFunction(vtkShaderProgram *prog, const int blendMode)
ComponentMode
Defines the various component modes supported by vtkGPUVolumeRayCastMapper.
void CreateTransferFunction1D(vtkRenderer *ren, const int index)
std::map< int, std::string > RGBTablesMap
Maps uniform texture variable names to its corresponding texture unit.
vtkSmartPointer< vtkOpenGLVolumeOpacityTables > OpacityTables
void CreateTransferFunction2D(vtkRenderer *ren, const int index)
int UpdateColorTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component)
int UpdateGradientOpacityTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component, const float samplingDist)
vtkSmartPointer< vtkOpenGLVolumeRGBTables > RGBTables
vtkSmartPointer< vtkVolumeTexture > Texture
void UpdateTransferFunction2D(vtkRenderer *ren, unsigned int component)
void ReleaseGraphicsTransfer1D(vtkWindow *window)
void UpdateTransferFunctions(vtkRenderer *ren, const int blendMode, const float samplingDist)
void InitializeTransferFunction(vtkRenderer *ren, const int index)
std::string GradientCacheName
Stores the uniform variable name where the gradient will be stored for this input in the fragment sha...
void ReleaseGraphicsResources(vtkWindow *window)
int UpdateOpacityTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component, const int blendMode, const float samplingDist)
The ShaderProgram uses one or more Shader objects.
std::map< int, std::string > TransferFunctions2DMap