[vtkusers] Converting vtkPolyData to vtkStructuredPoints

Bryn Lloyd blloyd at vision.ee.ethz.ch
Fri Jul 17 04:27:59 EDT 2009


Hi,

vtkDataSetToDataSetFilter is abstract, so you cannot create an instance 
of it:
http://www.vtk.org/doc/nightly/html/classvtkDataSetToDataSetFilter.html

Anyway, converting polydata to an image or similar is something that has 
been posted dozens of times on the mailing list. Is the polydata a 
surface? Is the surface closed? Usually you need to detect inside from 
outside (and distance) and sample your image/structured points like 
this. Search the archives...

/Bryn






Dimitris Perperidis wrote:
> Hi,
> 
> I am very new with VTK. I want to convert vtkPolyData to 
> vtkStructurePoints. I have written the following code (which I am not 
> sure will do the trick).
> vtkPolyData* input;
> vtkPolyDataReader* reader;
> vtkStructuredPoints* output_sd;
> vtkDataSetToDataSetFilter* filter;
> 
> input = vtkPolyData::New();
> reader = vtkPolyDataReader::New();
> filter = vtkDataSetToDataSetFilter::New();
> 
> reader->SetFileName(argv[1]);
> reader->Modified();
> 
> 
> input = reader->GetOutput();
> input->Modified();
> input->Update();
> 
> filter->SetInput(input);
> 
> filter->Modified();
> filter->Update();
> 
> output_sd = filter->GetStructuredPointsOutput();
> output_sd->Modified()
> 
> <http://davis.lbl.gov/Manuals/VTK-4.5/classvtkDataSetToDataSetFilter.html#a5>i 
> get the following compiling error:
> 44: error: invalid conversion from ‘vtkAlgorithm*’ to 
> ‘vtkDataSetToDataSetFilter*’ in the statement filter = 
> vtkDataSetToDataSetFilter::New();
> 
> 
> Any hints on the error and if I am in the right path will be greatly 
> appreciated.
> _______________________________________________
> 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
> 


-- 
-------------------------------------------------
Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 26668
Fax: +41 44 63 21199
-------------------------------------------------



More information about the vtkusers mailing list