[vtkusers] Create Structured Point Set?

David Doria daviddoria at gmail.com
Wed Mar 4 11:43:04 EST 2009


The data in the vtp is just a set of points (vertices). I wanted to get a
surface from the points.

Here's what I've tried:


    vtkSmartPointer<vtkXMLPolyDataReader> reader =
vtkSmartPointer<vtkXMLPolyDataReader>::New();
    reader->SetFileName(InputFile.c_str());
    reader->Update();
    cout << "NumPoints: " << reader->GetOutput()->GetNumberOfPoints() <<
endl;

    vtkSmartPointer<vtkContourFilter> CF =
vtkSmartPointer<vtkContourFilter>::New();
    //CF->SetValue(0,128);
    double range[2];
    range[0] = 0;
    range[1] = 1000;
    CF->GenerateValues(0, range);
    CF->SetInputConnection(reader->GetOutputPort());
    CF->Update();

    vtkSmartPointer<vtkXMLPolyDataWriter> writer =
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
    writer->SetInputConnection(CF->GetOutputPort());
    writer->SetFileName(OutputFile.c_str());
    writer->Update() ;

but it just makes an empty file. Where have I gone wrong?

Thanks,

David


On Wed, Mar 4, 2009 at 10:00 AM, Bryn Lloyd <blloyd at vision.ee.ethz.ch>wrote:

> Is your data a surface? Is there data associated with the polydata?
>
> What do you expect marching cubes to give you? (lines?)
>
>
> You could use vtkContourFilter, it works on any kind of vtkDataSet, i.e.
> polydata...
>
> http://www.vtk.org/doc/nightly/html/classvtkContourFilter.html
>
> --Bryn
>
>
>
>
> David Doria wrote:
>
>> I am reading in a vtp file and then trying to run the vtkMarchingCubes
>> filter. It says the input is of type vtkPolyData, but a vtkImageData is
>> required.
>>
>> I tried to use vtkMarchingContourFilter and it says no data to contour.
>>
>> It makes sense that the points should be on a structured grid, but how do
>> I create one?
>>
>> Thanks,
>>
>> David
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
> -------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090304/4f5b70ae/attachment.htm>


More information about the vtkusers mailing list