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

Method RequestData

Filters/General/vtkImageDataToPointSet.cxx:42–87  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

40
41//------------------------------------------------------------------------------
42int vtkImageDataToPointSet::RequestData(vtkInformation* vtkNotUsed(request),
43 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
44{
45 // Retrieve input and output
46 vtkImageData* inData = vtkImageData::GetData(inputVector[0]);
47 vtkStructuredGrid* outData = vtkStructuredGrid::GetData(outputVector);
48
49 if (inData == nullptr)
50 {
51 vtkErrorMacro(<< "Input data is nullptr.");
52 return 0;
53 }
54 if (outData == nullptr)
55 {
56 vtkErrorMacro(<< "Output data is nullptr.");
57 return 0;
58 }
59
60 // Copy input point and cell data to output
61 outData->GetPointData()->PassData(inData->GetPointData());
62 outData->GetCellData()->PassData(inData->GetCellData());
63
64 // Extract points coordinates from the image
65 vtkIdType nbPoints = inData->GetNumberOfPoints();
66 vtkNew<vtkPoints> points;
67 points->SetDataTypeToDouble();
68 points->SetNumberOfPoints(nbPoints);
69 for (vtkIdType i = 0; i < nbPoints; i++)
70 {
71 if (this->CheckAbort())
72 {
73 break;
74 }
75 double p[3];
76 inData->GetPoint(i, p);
77 points->SetPoint(i, p);
78 }
79 outData->SetPoints(points);
80
81 // Copy Extent
82 int extent[6];
83 inData->GetExtent(extent);
84 outData->SetExtent(extent);
85
86 return 1;
87}
88VTK_ABI_NAMESPACE_END

Callers

nothing calls this directly

Calls 12

CheckAbortMethod · 0.80
GetDataFunction · 0.50
PassDataMethod · 0.45
GetPointDataMethod · 0.45
GetCellDataMethod · 0.45
GetNumberOfPointsMethod · 0.45
SetNumberOfPointsMethod · 0.45
GetPointMethod · 0.45
SetPointMethod · 0.45
SetPointsMethod · 0.45
GetExtentMethod · 0.45
SetExtentMethod · 0.45

Tested by

no test coverage detected