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

Function MakeVolume

Common/DataModel/Testing/Cxx/UnitTestImplicitDataSet.cxx:168–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168vtkSmartPointer<vtkImageData> MakeVolume(int dimx, int dimy, int dimz)
169{
170 vtkSmartPointer<vtkImageData> aVolume = vtkSmartPointer<vtkImageData>::New();
171 aVolume->SetDimensions(dimx, dimy, dimz);
172 aVolume->AllocateScalars(VTK_FLOAT, 1);
173 float* pixel = static_cast<float*>(aVolume->GetScalarPointer(0, 0, 0));
174 float value = 0.0;
175
176 for (int z = 0; z < dimz; z++)
177 {
178 for (int y = 0; y < dimy; y++)
179 {
180 for (int x = 0; x < dimx; x++)
181 {
182 *pixel++ = value;
183 }
184 }
185 value += 1.0;
186 }
187 return aVolume;
188}

Callers 1

UnitTestImplicitDataSetFunction · 0.70

Calls 4

GetScalarPointerMethod · 0.80
NewFunction · 0.50
SetDimensionsMethod · 0.45
AllocateScalarsMethod · 0.45

Tested by

no test coverage detected