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

Method RequestData

Filters/Hybrid/vtkImageToPolyDataFilter.cxx:53–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51//
52
53int vtkImageToPolyDataFilter::RequestData(vtkInformation* vtkNotUsed(request),
54 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
55{
56 // get the info objects
57 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
58 vtkInformation* outInfo = outputVector->GetInformationObject(0);
59
60 // get the input and output
61 vtkImageData* input = vtkImageData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
62 vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
63
64 vtkPolyData* tmpOutput;
65 vtkPolyData* tmpInput;
66 vtkAppendPolyData* append;
67 vtkPolyData* appendOutput;
68 vtkDataArray* inScalars = input->GetPointData()->GetScalars();
69 vtkIdType numPixels = input->GetNumberOfPoints();
70 int dims[3], numComp;
71 double origin[3], spacing[3];
72 vtkUnsignedCharArray* pixels;
73 int type;
74 int numPieces[2], extent[4];
75 int i, j, newDims[3], totalPieces, pieceNum, abortExecute = 0;
76 double newOrigin[3];
77
78 // Check input and initialize
79 vtkDebugMacro(<< "Vectorizing image...");
80
81 if (inScalars == nullptr || numPixels < 1)
82 {
83 vtkDebugMacro(<< "Not enough input to create output");
84 return 1;
85 }
86
87 append = vtkAppendPolyData::New();
88 tmpOutput = vtkPolyData::New();
89 tmpInput = vtkPolyData::New();
90 numComp = inScalars->GetNumberOfComponents();
91 type = inScalars->GetDataType();
92
93 appendOutput = append->GetOutput();
94
95 input->GetDimensions(dims);
96 input->GetOrigin(origin);
97 input->GetSpacing(spacing);
98
99 // Figure out how many pieces to break the image into (the image
100 // might be too big to process). The filter does a series of appends
101 // to join the pieces together.
102 numPieces[0] = ((dims[0] - 2) / this->SubImageSize) + 1;
103 numPieces[1] = ((dims[1] - 2) / this->SubImageSize) + 1;
104 totalPieces = numPieces[0] * numPieces[1];
105
106 appendOutput->Initialize(); // empty the output
107 append->AddInputData(tmpOutput); // output of piece
108 append->AddInputData(tmpInput); // output of previoius append
109
110 // Loop over this many pieces

Callers

nothing calls this directly

Calls 15

QuantizeImageMethod · 0.95
PixelizeImageMethod · 0.95
RunLengthImageMethod · 0.95
PolygonalizeImageMethod · 0.95
GetInformationObjectMethod · 0.80
CheckAbortMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetMethod · 0.45
GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected