[vtkusers] Problem conversion vtkStructuredPoints to mesh/Polydata
David E DeMarle
dave.demarle at kitware.com
Wed Mar 28 07:45:19 EDT 2012
You have a syntax error:
geometryFilter->SetInput(reader->GetOutput);
should be:
geometryFilter->SetInput(reader->GetOutput());
Also, I recommend against using SetInput and GetOutput since they are
going away in vtk6. Do this instead:
geometryFilter->SetInputConnection(reader->GetOutputPort());
David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
On Tue, Mar 27, 2012 at 3:39 PM, agatte <agatakrason at gmail.com> wrote:
> But I have to write it in *.vtk file .
>
>
>
>
> W dniu 27 marca 2012 21:36 użytkownik Agata Krasoń <[hidden email]> napisał:
>>
>> I received an error : ???
>>
>> Error 1 error C3867: 'vtkStructuredPointsReader::GetOutput': function call
>> missing argument list; use '&vtkStructuredPointsReader::GetOutput' to create
>> a pointer to member d:\SegmentacjaOtsu\VTKConverter\sources\ConverterVTK.cxx
>> 109 ConverterVTK
>>
>>
>> W dniu 27 marca 2012 21:34 użytkownik David Doria-2-3 [via VTK] <[hidden
>> email]> napisał:
>>>
>>> On Tue, Mar 27, 2012 at 3:30 PM, agatte <[hidden email]> wrote:
>>>
>>> > Hi ;)
>>> >
>>> > I am just begining my adventure with vtk.
>>> > I have a *.vtk file STRUCTURED_POINTS. I want to convert it to
>>> > POLYDATA and
>>> > save as *.vtk file.
>>> >
>>> > Could anyone help me please ?
>>> >
>>> >
>>> > I would appreciate for any help.
>>> >
>>> >
>>> > I am trying with this code : but I received an error :
>>> >
>>> > int main()
>>> > {
>>> >
>>> > try
>>> > {
>>> > vtkSmartPointer<vtkStructuredPointsReader> reader =
>>> > vtkSmartPointer<vtkStructuredPointsReader>::New();
>>> > reader->SetFileName("Points.vtk");
>>> > reader->Update();
>>> >
>>> > vtkSmartPointer<vtkGeometryFilter> geometryFilter =
>>> > vtkSmartPointer<vtkGeometryFilter>::New();
>>> > geometryFilter->SetInput(reader->GetOutput);
>>> > geometryFilter->Update();
>>> >
>>> >
>>> > /*vtkContourFilter * contour = vtkContourFilter::New();
>>> > contour->SetInput( reader->GetOutput() );
>>> > contour->SetValue(0, 128); */
>>> >
>>> > // Save mesh as vtk Poly Data
>>> > vtkPolyDataWriter * writerMesh = vtkPolyDataWriter::New();
>>> > writerMesh->SetFileName("MeshVTK.vtk");
>>> > writerMesh->SetInput(geometryFilter->GetOutput());
>>> > writerMesh->Write();
>>> >
>>> > // contour->Delete();
>>> > writerMesh->Delete();
>>> >
>>> > }
>>> > catch (itk::ExceptionObject &ex)
>>> > {
>>> > std::cout << ex << std::endl;
>>> > return EXIT_FAILURE;
>>> > }
>>> >
>>> >
>>> > }
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > # vtk DataFile Version 2.0
>>> > Comment goes here
>>> > ASCII
>>> >
>>> > DATASET STRUCTURED_POINTS
>>> > DIMENSIONS 3 201 1
>>> >
>>> > ORIGIN 0.000 0.000 0.000
>>> > SPACING 1.000 1.000 1.000
>>> >
>>> > POINT_DATA 603
>>> > SCALARS scalars double
>>> > LOOKUP_TABLE default
>>> >
>>> > 108 186 26
>>> > 1.081485e+002 1.858573e+002 26
>>> > 1.083255e+002 1.855720e+002 26
>>> > 1.085282e+002 1.851580e+002 26
>>> > 1.087540e+002 1.846294e+002 26
>>> > 109 184 26
>>> > 1.092600e+002 1.832852e+002 26
>>> > 1.095138e+002 1.825058e+002 26
>>> > 1.097375e+002 1.816838e+002 26
>>> > 1.099075e+002 1.808411e+002 26
>>> > 110 180 26
>>> > 1.100035e+002 1.791777e+002 26
>>> > 1.099555e+002 1.783727e+002 26
>>> > 1.099057e+002 1.775789e+002 26
>>> > 1.099040e+002 1.767900e+002 26
>>> > 110 176 26
>>> > 1.102301e+002 1.752040e+002 26
>>> > 1.105764e+002 1.744034e+002 26
>>> What is the error you receive? Also, you should use
>>> vtkXMLPolyDataWriter to write a .vtp file instead of using
>>> vtkPolyDataWriter to write a .vtk file.
>>>
>>> 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
>>>
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://vtk.1045678.n5.nabble.com/Problem-conversion-vtkStructuredPoints-to-mesh-Polydata-tp5598716p5598722.html
>>> To unsubscribe from Problem conversion vtkStructuredPoints to
>>> mesh/Polydata, click here.
>>> NAML
>>
>>
>
>
> ________________________________
> View this message in context: Re: Problem conversion vtkStructuredPoints to
> mesh/Polydata
> Sent from the VTK - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
>
More information about the vtkusers
mailing list