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

Method GetReductionRatio

Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx:4010–4043  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

4008
4009//------------------------------------------------------------------------------
4010void vtkOpenGLGPUVolumeRayCastMapper::GetReductionRatio(double* ratio)
4011{
4012 ratio[0] = ratio[1] = ratio[2] = 1.0; // default
4013
4014 vtkImageData* input = vtkImageData::SafeDownCast(this->GetInput());
4015 if (!input)
4016 {
4017 return;
4018 }
4019
4020 const int* dims = input->GetDimensions();
4021 const int dimCount = input->GetDataDimension();
4022 const size_t scalarSize = static_cast<size_t>(input->GetScalarSize());
4023 const size_t currentSize = static_cast<size_t>(dims[0]) * dims[1] * dims[2] * scalarSize;
4024 const size_t maxSize = static_cast<size_t>(
4025 this->GetMaxMemoryInBytes() * static_cast<double>(this->GetMaxMemoryFraction()));
4026
4027 if (currentSize > maxSize)
4028 {
4029 const double totalRatio = static_cast<double>(maxSize) / currentSize;
4030
4031 ratio[0] = 1.0 - ((1.0 - totalRatio) / dimCount);
4032
4033 if (dims[1] != 1)
4034 {
4035 ratio[1] = ratio[0];
4036 }
4037
4038 if (dims[2] != 1)
4039 {
4040 ratio[2] = ratio[0];
4041 }
4042 }
4043}
4044
4045//------------------------------------------------------------------------------
4046vtkMTimeType vtkOpenGLGPUVolumeRayCastMapper::GetRenderPassStageMTime(vtkVolume* vol)

Callers 1

ComputeRenderModeMethod · 0.80

Calls 4

GetScalarSizeMethod · 0.80
GetInputMethod · 0.45
GetDimensionsMethod · 0.45
GetDataDimensionMethod · 0.45

Tested by

no test coverage detected