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

Method CreateTransferFunction1D

Rendering/VolumeOpenGL2/vtkVolumeInputHelper.cxx:337–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void vtkVolumeInputHelper::CreateTransferFunction1D(vtkRenderer* ren, int index)
338{
339 this->ReleaseGraphicsTransfer1D(ren->GetRenderWindow());
340
341 int const numActiveLuts =
342 this->ComponentMode == INDEPENDENT ? Texture->GetLoadedScalars()->GetNumberOfComponents() : 1;
343
344 // Create RGB and opacity (scalar and gradient) lookup tables. Up to four
345 // components are supported in single-input independentComponents mode.
346 this->RGBTables = vtkSmartPointer<vtkOpenGLVolumeLookupTables<vtkOpenGLVolumeRGBTable>>::New();
347 this->RGBTables->Create(numActiveLuts);
348 this->OpacityTables =
349 vtkSmartPointer<vtkOpenGLVolumeLookupTables<vtkOpenGLVolumeOpacityTable>>::New();
350 this->OpacityTables->Create(numActiveLuts);
351 this->GradientOpacityTables =
352 vtkSmartPointer<vtkOpenGLVolumeLookupTables<vtkOpenGLVolumeGradientOpacityTable>>::New();
353 this->GradientOpacityTables->Create(numActiveLuts);
354
355 this->OpacityTablesMap.clear();
356 this->RGBTablesMap.clear();
357 this->GradientOpacityTablesMap.clear();
358
359 std::ostringstream idx;
360 idx << index;
361
362 this->GradientCacheName = "g_gradients_" + idx.str();
363
364 for (int i = 0; i < numActiveLuts; ++i)
365 {
366 std::ostringstream comp;
367 comp << "[" << i << "]";
368
369 this->OpacityTablesMap[i] = "in_opacityTransferFunc_" + idx.str() + comp.str();
370 this->RGBTablesMap[i] = "in_colorTransferFunc_" + idx.str() + comp.str();
371
372 // Unlike color and scalar-op, graident-op is optional (some inputs may
373 // or may not have gradient-op active).
374 if (this->Volume->GetProperty()->HasGradientOpacity())
375 {
376 this->GradientOpacityTablesMap[i] = "in_gradientTransferFunc_" + idx.str() + comp.str();
377 }
378 }
379
380 this->LutInit.Modified();
381}
382
383void vtkVolumeInputHelper::CreateTransferFunction2D(vtkRenderer* ren, int index)
384{

Callers 1

Calls 10

GetLoadedScalarsMethod · 0.80
NewFunction · 0.50
GetRenderWindowMethod · 0.45
GetNumberOfComponentsMethod · 0.45
CreateMethod · 0.45
clearMethod · 0.45
strMethod · 0.45
GetPropertyMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected