I had some code whose input and output was like this:<br><br>Scanner->SetScene(vtkPolyData*);<br>vtkPolyData* output = Scanner->GetOutputPolyData();<br><br>I changed my class to inherit from public vtkPolyDataAlgorithm, and I added this function (the "information" bits were stolen from vtkTransformPolyDataFilter)<br>
<br>int vtkLidarScanner::RequestData(vtkInformation *vtkNotUsed(request),<br> vtkInformationVector **inputVector,<br> vtkInformationVector *outputVector)<br>{<br> // get the info objects<br> vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);<br>
vtkInformation *outInfo = outputVector->GetInformationObject(0);<br><br> // get the input and ouptut<br> vtkPolyData *input = vtkPolyData::SafeDownCast(<br> inInfo->Get(vtkDataObject::DATA_OBJECT()));<br>
vtkPolyData *output = vtkPolyData::SafeDownCast(<br> outInfo->Get(vtkDataObject::DATA_OBJECT()));<br><br> this->SetScene(input);<br> std::cout << *input << std::endl;<br> <br> this->PerformScan();<br>
<br> output = this->GetOutputPolyData();<br><br> return 1;<br>}<br><br>The cout of the input seems that it was received correctly, and the cout of the output seems that it was built correctly. I am then trying to use the class with:<br>
<br> Scanner->SetInput(reader->GetOutput());<br> vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();<br> writer->SetFileName(OutputFilename.c_str());<br>
writer->SetInput(Scanner->GetOutput());<br> writer->Write();<br><br>But the file that is written is empty. Is there anything else I have to do to get this to work as an algorithm filter?<br><br clear="all">
Thanks,<br><br>David<br>