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

Method SavePixelListFrame

Rendering/Volume/vtkUnstructuredGridVolumeZSweepMapper.cxx:3324–3386  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3322
3323//------------------------------------------------------------------------------
3324void vtkUnstructuredGridVolumeZSweepMapper::SavePixelListFrame()
3325{
3326 vtkPolyData* dataset = vtkPolyData::New();
3327
3328 vtkIdType height = this->ImageInUseSize[1];
3329 vtkIdType width = this->ImageInUseSize[0];
3330 vtkPixelListEntry* current;
3331 vtkIdType i;
3332
3333 vtkPoints* pts = vtkPoints::New();
3334 pts->SetDataTypeToDouble();
3335
3336 vtkDoubleArray* dataArray = vtkDoubleArray::New();
3337 vtkCellArray* vertices = vtkCellArray::New();
3338 vtkIdType pointId = 0;
3339
3340 // height=151;
3341 // width=151;
3342
3343 vtkIdType y = 0; // 150;
3344 while (y < height)
3345 {
3346 vtkIdType x = 0; // 150;
3347 while (x < width)
3348 {
3349 i = y * this->ImageInUseSize[0] + x;
3350 current = this->PixelListFrame->GetFirst(i);
3351 while (current != nullptr)
3352 {
3353 double* values = current->GetValues();
3354
3355 double point[3];
3356 point[0] = x;
3357 point[1] = y;
3358 point[2] = values[2]; // zWorld
3359
3360 pts->InsertNextPoint(point);
3361 dataArray->InsertNextValue(values[3]);
3362 vertices->InsertNextCell(1, &pointId);
3363 current = current->GetNext();
3364 ++pointId;
3365 }
3366 ++x;
3367 }
3368 ++y;
3369 }
3370 dataset->SetPoints(pts);
3371 pts->Delete();
3372 dataset->SetVerts(vertices);
3373 vertices->Delete();
3374 dataset->GetPointData()->SetScalars(dataArray);
3375 dataArray->Delete();
3376
3377 /*
3378 vtkXMLPolyDataWriter *writer=vtkXMLPolyDataWriter::New();
3379 writer->SetFileName("pixellistframe.vtp");
3380 writer->SetInputData(dataset);
3381 writer->SetIdTypeToInt32();

Callers

nothing calls this directly

Calls 12

SetVertsMethod · 0.80
SetScalarsMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetFirstMethod · 0.45
GetValuesMethod · 0.45
InsertNextPointMethod · 0.45
InsertNextValueMethod · 0.45
InsertNextCellMethod · 0.45
GetNextMethod · 0.45
SetPointsMethod · 0.45
GetPointDataMethod · 0.45

Tested by

no test coverage detected