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

Method UpdateColorTransferFunction

Rendering/VolumeOpenGL2/vtkVolumeInputHelper.cxx:146–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146int vtkVolumeInputHelper::UpdateColorTransferFunction(
147 vtkRenderer* ren, vtkVolume* vol, unsigned int component)
148{
149 vtkVolumeProperty* volumeProperty = vol->GetProperty();
150
151 // Build the colormap in a 1D texture. 1D RGB-texture-mapping from scalar
152 // values to color values build the table.
153 vtkColorTransferFunction* colorTransferFunction =
154 volumeProperty->GetRGBTransferFunction(component);
155
156 auto volumeTex = this->Texture.GetPointer();
157 double componentRange[2];
158 if (colorTransferFunction->GetSize() < 1 ||
159 this->ColorRangeType == vtkGPUVolumeRayCastMapper::SCALAR)
160 {
161 for (int i = 0; i < 2; ++i)
162 {
163 componentRange[i] = volumeTex->ScalarRange[component][i];
164 }
165 }
166 else
167 {
168 colorTransferFunction->GetRange(componentRange);
169 }
170
171 // Add points only if its not being added before
172 if (colorTransferFunction->GetSize() < 1)
173 {
174 colorTransferFunction->AddRGBPoint(componentRange[0], 0.0, 0.0, 0.0);
175 colorTransferFunction->AddRGBPoint(componentRange[1], 1.0, 1.0, 1.0);
176 }
177
178 int filterVal = volumeProperty->GetInterpolationType() == VTK_LINEAR_INTERPOLATION
179 ? vtkTextureObject::Linear
180 : vtkTextureObject::Nearest;
181
182 this->RGBTables->GetTable(component)->Update(volumeProperty->GetRGBTransferFunction(component),
183 componentRange, 0, 0, 0,
184#ifndef GL_ES_VERSION_3_0
185 filterVal,
186#else
187 vtkTextureObject::Nearest,
188#endif
189 vtkOpenGLRenderWindow::SafeDownCast(ren->GetRenderWindow()));
190
191 return 0;
192}
193
194int vtkVolumeInputHelper::UpdateGradientOpacityTransferFunction(
195 vtkRenderer* ren, vtkVolume* vol, unsigned int component, float samplingDist)

Callers 1

Calls 9

AddRGBPointMethod · 0.80
GetPropertyMethod · 0.45
GetPointerMethod · 0.45
GetSizeMethod · 0.45
GetRangeMethod · 0.45
UpdateMethod · 0.45
GetTableMethod · 0.45
GetRenderWindowMethod · 0.45

Tested by

no test coverage detected