[vtkusers] Marching Cubes with Polydata

Joel Schaerer joelthelion at laposte.net
Mon May 4 10:23:03 EDT 2009


Hi,

The marching cubes algorithm takes a binary mask and creates a surface mesh
out of it, that's not what you're trying to do.

What you're trying to do, if I understand well, is to create a surface from
a disconnected set of points. This is an ill-posed problem in the general
case, however there are solutions in specific case. In the case of your
example, if the points are sampled well enough, a vtkDelaunay3D and a
vtkGeometryFilter would probably give you the correct solution.

joel



daviddoria wrote:
> 
> I asked about this a while back, but was never able to get it to work -
> Here
> is an attempt at a simple example:
> 
> Input data: polydata, points on a sphere
> http://rpi.edu/~doriad/SpherePoints.vtp
> 
> required output: the surface of the sphere
> 
>     vtkSmartPointer<vtkXMLPolyDataReader> reader =
> vtkSmartPointer<vtkXMLPolyDataReader>::New();
>     reader->SetFileName(Filename.c_str());
>     reader->Update();
> 
>     vtkPolyData* InputPolydata = reader->GetOutput();
> 
>     vtkSmartPointer<vtkContourFilter> CF =
> vtkSmartPointer<vtkContourFilter>::New();
>     CF->SetInput(InputPolydata);
>     CF->Update();
> 
>     vtkMarchingCubes* MC = vtkMarchingCubes::New();
>     MC->SetInput(CF->GetOutput()); //ERROR: cannot do this, because the
> input is vtkPolyData, not vtkImageData
>     MC->Update();
> 
>     vtkPolyData* Output = MC->GetOutput();
> 
>     //write
>     vtkSmartPointer<vtkXMLPolyDataWriter> writer =
> vtkSmartPointer<vtkXMLPolyDataWriter>::New();
>     writer->SetFileName(Filename.c_str());
>     writer->SetInput(Output);
>     writer->Write();
> 
> 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.
> 
> There have been several questions about this, but I haven't seen any
> resolutions. Has anyone gotten it to work?
> 
> Thanks,
> Dave
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 

-- 
View this message in context: http://www.nabble.com/Marching-Cubes-with-Polydata-tp23345719p23369192.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list