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

Method PerVolumeInitialization

Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx:1088–1162  ·  view source on GitHub ↗

This is the initialization that should be done once per volume

Source from the content-addressed store, hash-verified

1086
1087// This is the initialization that should be done once per volume
1088void vtkFixedPointVolumeRayCastMapper::PerVolumeInitialization(vtkRenderer* ren, vtkVolume* vol)
1089{
1090 // This is the input of this mapper
1091 vtkImageData* input = vtkImageData::SafeDownCast(this->GetInput());
1092 this->PreviousScalars = this->CurrentScalars;
1093
1094 // make sure that we have scalar input and update the scalar input
1095 if (input == nullptr)
1096 {
1097 vtkErrorMacro(<< "No Input!");
1098 return;
1099 }
1100 else
1101 {
1102 vtkAlgorithm* inAlg = this->GetInputAlgorithm();
1103 inAlg->UpdateWholeExtent();
1104 }
1105
1106 int usingCellColors;
1107 this->CurrentScalars = vtkFixedPointVolumeRayCastMapper::GetScalars(input, this->ScalarMode,
1108 this->ArrayAccessMode, this->ArrayId, this->ArrayName, usingCellColors);
1109
1110 if (usingCellColors)
1111 {
1112 vtkErrorMacro("Cell Scalars not supported");
1113 return;
1114 }
1115
1116 // Compute some matrices from voxels to view and vice versa based
1117 // on the whole input
1118 double inputSpacing[3];
1119 double inputOrigin[3];
1120 int inputExtent[6];
1121 input->GetSpacing(inputSpacing);
1122 input->GetOrigin(inputOrigin);
1123 input->GetExtent(inputExtent);
1124
1125 this->ComputeMatrices(inputOrigin, inputSpacing, inputExtent, ren, vol);
1126
1127 this->RenderWindow = ren->GetRenderWindow();
1128 this->Volume = vol;
1129
1130 // Adjust the sample spacing if necessary
1131 if (this->LockSampleDistanceToInputSpacing)
1132 {
1133 double const dist = this->SpacingAdjustedSampleDistance(inputSpacing, inputExtent);
1134
1135 // Need to treat interactive renders differently, because if
1136 // AutoAdjustSampleDistances is on, then we doubled the sample
1137 // distance
1138 if (this->AutoAdjustSampleDistances && vol->GetAllocatedRenderTime() < 1.0)
1139 {
1140 if (this->SampleDistance / (dist * 2) < 0.999 || this->SampleDistance / (dist * 2) > 1.001)
1141 {
1142 this->OldSampleDistance = dist;
1143 this->SampleDistance = dist * 2;
1144 this->InteractiveSampleDistance = dist * 2;
1145 }

Callers 2

RenderMethod · 0.95
CreateCanonicalViewMethod · 0.95

Calls 15

ComputeMatricesMethod · 0.95
UpdateColorTableMethod · 0.95
UpdateGradientsMethod · 0.95
UpdateShadingTableMethod · 0.95
UpdateMinMaxVolumeMethod · 0.95
GetScalarsClass · 0.50
GetInputMethod · 0.45
GetInputAlgorithmMethod · 0.45
UpdateWholeExtentMethod · 0.45
GetSpacingMethod · 0.45

Tested by

no test coverage detected