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

Method RequestData

Common/ExecutionModel/vtkImageToStructuredGrid.cxx:48–85  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

46
47//------------------------------------------------------------------------------
48int vtkImageToStructuredGrid::RequestData(vtkInformation* vtkNotUsed(request),
49 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
50{
51 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
52 vtkInformation* outInfo = outputVector->GetInformationObject(0);
53 assert(inInfo != nullptr);
54 assert(outInfo != nullptr);
55
56 vtkImageData* img = vtkImageData::SafeDownCast(inInfo->Get(vtkImageData::DATA_OBJECT()));
57 assert(img != nullptr);
58
59 vtkStructuredGrid* grid =
60 vtkStructuredGrid::SafeDownCast(outInfo->Get(vtkStructuredGrid::DATA_OBJECT()));
61 assert(grid != nullptr);
62
63 int dims[3];
64 img->GetDimensions(dims);
65
66 vtkPoints* gridPoints = vtkPoints::New();
67 assert(gridPoints != nullptr);
68 gridPoints->SetDataTypeToDouble();
69 gridPoints->SetNumberOfPoints(img->GetNumberOfPoints());
70
71 double pnt[3];
72 for (int i = 0; i < img->GetNumberOfPoints(); ++i)
73 {
74 img->GetPoint(i, pnt);
75 gridPoints->SetPoint(i, pnt);
76 }
77 grid->SetDimensions(dims);
78 grid->SetPoints(gridPoints);
79 gridPoints->Delete();
80
81 this->CopyPointData(img, grid);
82 this->CopyCellData(img, grid);
83
84 return 1;
85}
86
87//------------------------------------------------------------------------------
88void vtkImageToStructuredGrid::CopyPointData(vtkImageData* img, vtkStructuredGrid* sgrid)

Callers

nothing calls this directly

Calls 14

CopyPointDataMethod · 0.95
CopyCellDataMethod · 0.95
GetInformationObjectMethod · 0.80
DeleteMethod · 0.65
assertFunction · 0.50
NewFunction · 0.50
GetMethod · 0.45
GetDimensionsMethod · 0.45
SetNumberOfPointsMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetPointMethod · 0.45
SetPointMethod · 0.45

Tested by

no test coverage detected