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

Method LoadVolume

Rendering/VolumeOpenGL2/vtkVolumeTexture.cxx:68–173  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

66
67//------------------------------------------------------------------------------
68bool vtkVolumeTexture::LoadVolume(
69 vtkRenderer* ren, vtkDataSet* data, vtkDataArray* scalars, int isCell, int interpolation)
70{
71 this->ClearBlocks();
72 this->Scalars = scalars;
73 this->IsCellData = isCell;
74 this->InterpolationType = interpolation;
75 vtkImageData* imData = vtkImageData::SafeDownCast(data);
76 vtkRectilinearGrid* rGrid = vtkRectilinearGrid::SafeDownCast(data);
77 if (imData)
78 {
79 imData->GetExtent(this->FullExtent.GetData());
80 }
81 else if (rGrid)
82 {
83 rGrid->GetExtent(this->FullExtent.GetData());
84 }
85
86 // Setup partition blocks
87 if (this->Partitions[0] > 1 || this->Partitions[1] > 1 || this->Partitions[2] > 1)
88 {
89 // TODO: Partitions are only supported for image data input for now.
90 if (!imData)
91 {
92
93 vtkErrorMacro(<< "Partitioning only supported for vtkImageData input right now!");
94 return false;
95 }
96 this->SplitVolume(imData, this->Partitions);
97 }
98 else // Single block
99 {
100 if (this->IsCellData == 1)
101 {
102 this->AdjustExtentForCell(this->FullExtent);
103 }
104 if (imData)
105 {
106 vtkImageData* singleBlock = nullptr;
107 if (vtkUniformGrid* ugData = vtkUniformGrid::SafeDownCast(data))
108 {
109 singleBlock = vtkUniformGrid::New();
110 singleBlock->ShallowCopy(ugData);
111 }
112 else
113 {
114 singleBlock = vtkImageData::New();
115 singleBlock->ShallowCopy(imData);
116 }
117 singleBlock->SetExtent(this->FullExtent.GetData());
118 this->ImageDataBlocks.push_back(singleBlock);
119 }
120 else if (rGrid)
121 {
122 vtkRectilinearGrid* singleBlock = vtkRectilinearGrid::New();
123 singleBlock->ShallowCopy(rGrid);
124 // Do not update the block extent at this time.
125 // We need the full block extent in ComputeBounds later on.

Callers 4

LoadMaskMethod · 0.80
UpdateInputsMethod · 0.80

Calls 15

ClearBlocksMethod · 0.95
SplitVolumeMethod · 0.95
AdjustExtentForCellMethod · 0.95
SelectTextureFormatMethod · 0.95
CreateBlocksMethod · 0.95
LoadTextureMethod · 0.95
GetPointGhostArrayMethod · 0.80
GetCellGhostArrayMethod · 0.80
GetDefaultFormatMethod · 0.80
GetDefaultDataTypeMethod · 0.80
NewFunction · 0.50

Tested by

no test coverage detected