MCPcopy Create free account
hub / github.com/Kitware/VTK / UpdateOpacityTransferFunction

Method UpdateOpacityTransferFunction

Rendering/VolumeOpenGL2/vtkVolumeInputHelper.cxx:99–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99int vtkVolumeInputHelper::UpdateOpacityTransferFunction(
100 vtkRenderer* ren, vtkVolume* vol, unsigned int component, int blendMode, float samplingDist)
101{
102 vtkVolumeProperty* volumeProperty = vol->GetProperty();
103
104 // Use the first LUT when using dependent components
105 unsigned int lookupTableIndex = volumeProperty->GetIndependentComponents() ? component : 0;
106 vtkPiecewiseFunction* scalarOpacity = volumeProperty->GetScalarOpacity(lookupTableIndex);
107
108 auto volumeTex = this->Texture.GetPointer();
109 double componentRange[2];
110 if (scalarOpacity->GetSize() < 1 ||
111 this->ScalarOpacityRangeType == vtkGPUVolumeRayCastMapper::SCALAR)
112 {
113 for (int i = 0; i < 2; ++i)
114 {
115 componentRange[i] = volumeTex->ScalarRange[component][i];
116 }
117 }
118 else
119 {
120 scalarOpacity->GetRange(componentRange);
121 }
122
123 if (scalarOpacity->GetSize() < 1)
124 {
125 scalarOpacity->AddPoint(componentRange[0], 0.0);
126 scalarOpacity->AddPoint(componentRange[1], 0.5);
127 }
128
129 int filterVal = volumeProperty->GetInterpolationType() == VTK_LINEAR_INTERPOLATION
130 ? vtkTextureObject::Linear
131 : vtkTextureObject::Nearest;
132
133 this->OpacityTables->GetTable(lookupTableIndex)
134 ->Update(scalarOpacity, componentRange, blendMode, samplingDist,
135 volumeProperty->GetScalarOpacityUnitDistance(component),
136#ifndef GL_ES_VERSION_3_0
137 filterVal,
138#else
139 vtkTextureObject::Nearest,
140#endif
141 vtkOpenGLRenderWindow::SafeDownCast(ren->GetRenderWindow()));
142
143 return 0;
144}
145
146int vtkVolumeInputHelper::UpdateColorTransferFunction(
147 vtkRenderer* ren, vtkVolume* vol, unsigned int component)

Callers 1

Calls 10

GetScalarOpacityMethod · 0.80
GetPropertyMethod · 0.45
GetPointerMethod · 0.45
GetSizeMethod · 0.45
GetRangeMethod · 0.45
AddPointMethod · 0.45
UpdateMethod · 0.45
GetTableMethod · 0.45
GetRenderWindowMethod · 0.45

Tested by

no test coverage detected