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

Method PerImageInitialization

Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx:1037–1085  ·  view source on GitHub ↗

This is the initialization that should be done once per image The render has been broken into several parts to support AMR volume rendering. Basically, this is done by having the AMR mapper call the PerImageInitialization once, then the PerVolumeInitialization once for each volume in the hierarchical structure. Finally, the AMR mapper divides all the volumes into subvolumes in order to render ever

Source from the content-addressed store, hash-verified

1035// volume so the multiRender flag indicates whether to do this
1036// computation here or skip it for later.
1037int vtkFixedPointVolumeRayCastMapper::PerImageInitialization(vtkRenderer* ren, vtkVolume* vol,
1038 int multiRender, double inputOrigin[3], double inputSpacing[3], int inputExtent[6])
1039{
1040 // Save this so that we can restore it if the image is cancelled
1041 this->OldImageSampleDistance = this->ImageSampleDistance;
1042 this->OldSampleDistance = this->SampleDistance;
1043
1044 // If we are automatically adjusting the size to achieve a desired frame
1045 // rate, then do that adjustment here. Base the new image sample distance
1046 // on the previous one and the previous render time. Don't let
1047 // the adjusted image sample distance be less than the minimum image sample
1048 // distance or more than the maximum image sample distance.
1049 if (this->AutoAdjustSampleDistances)
1050 {
1051 this->ImageSampleDistance =
1052 this->ComputeRequiredImageSampleDistance(vol->GetAllocatedRenderTime(), ren, vol);
1053
1054 // If this is an interactive render (faster than 1 frame per second) then we'll
1055 // increase the sample distance along the ray to improve performance
1056 if (vol->GetAllocatedRenderTime() < 1.0)
1057 {
1058 this->SampleDistance = this->InteractiveSampleDistance;
1059 }
1060 }
1061
1062 // Pass the ImageSampleDistance on the RayCastImage
1063 this->RayCastImage->SetImageSampleDistance(this->ImageSampleDistance);
1064
1065 // The full image fills the viewport. First, compute the actual viewport
1066 // size, then divide by the ImageSampleDistance to find the full image
1067 // size in pixels
1068 int width, height;
1069 ren->GetTiledSize(&width, &height);
1070 this->RayCastImage->SetImageViewportSize(static_cast<int>(width / this->ImageSampleDistance),
1071 static_cast<int>(height / this->ImageSampleDistance));
1072
1073 if (multiRender)
1074 {
1075 this->UpdateCroppingRegions();
1076 this->ComputeMatrices(inputOrigin, inputSpacing, inputExtent, ren, vol);
1077
1078 if (!this->ComputeRowBounds(ren, 1, 0, inputExtent))
1079 {
1080 return 0;
1081 }
1082 }
1083
1084 return 1;
1085}
1086
1087// This is the initialization that should be done once per volume
1088void vtkFixedPointVolumeRayCastMapper::PerVolumeInitialization(vtkRenderer* ren, vtkVolume* vol)

Callers 2

RenderMethod · 0.95
CreateCanonicalViewMethod · 0.95

Calls 6

UpdateCroppingRegionsMethod · 0.95
ComputeMatricesMethod · 0.95
ComputeRowBoundsMethod · 0.95
GetTiledSizeMethod · 0.80

Tested by

no test coverage detected