I asked about this a while back, but was never able to get it to work - Here is an attempt at a simple example:<br><br>Input data: polydata, points on a sphere<br><a href="http://rpi.edu/~doriad/SpherePoints.vtp">http://rpi.edu/~doriad/SpherePoints.vtp</a><br>
<br>required output: the surface of the sphere<br><br> vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();<br> reader->SetFileName(Filename.c_str());<br> reader->Update();<br>
<br> vtkPolyData* InputPolydata = reader->GetOutput();<br> <br> vtkSmartPointer<vtkContourFilter> CF = vtkSmartPointer<vtkContourFilter>::New();<br> CF->SetInput(InputPolydata);<br> CF->Update();<br>
<br> vtkMarchingCubes* MC = vtkMarchingCubes::New();<br> MC->SetInput(CF->GetOutput()); //ERROR: cannot do this, because the input is vtkPolyData, not vtkImageData<br> MC->Update();<br> <br> vtkPolyData* Output = MC->GetOutput();<br>
<br> //write<br> vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();<br> writer->SetFileName(Filename.c_str());<br> writer->SetInput(Output);<br> writer->Write();<br>
<br>I thought the ContourFilter was supposed to do this polydata to imagedata conversion? A while back Bryn had recommended creating an empty image data and manually binning the points, but I feel like there should be a filter that does this? Also recommended was Deluanay triangulation. I've had bad luck with this in the past with the type of surfaces I'm trying to reconstruct, so I would like to compare it to marching cubes.<br>
<br>There have been several questions about this, but I haven't seen any resolutions. Has anyone gotten it to work?<br><br>Thanks,<br>Dave<br>