[vtkusers] how to convert vtkImageData to vtkpolyData??

David Doria daviddoria at gmail.com
Tue Aug 30 15:58:59 EDT 2011


On Tue, Aug 30, 2011 at 3:56 PM,  <lindeval at dmat.ufrr.br> wrote:
> I turn my raw file in a file wavefront(.obj)
>
> In this example,
>
>
> vtkSmartPointer <vtkSphereSource> sphereSource =
>  vtkSmartPointer <vtkSphereSource>:: New ();
>
>   vtkSmartPointer <vtkOBJWriter> writer =
>   vtkSmartPointer <vtkOBJWriter>:: New ();
>   writer-> SetInputConnection (sphereSource-> GetOutputPort ());
>   writer-> SetFileName (outputFilename.c_str ());
>   writer-> Update ();
>
> I go with the object ball and get a wavefront file (. obj).
>
> I wanted to do the same with my raw file, (phantom voxels)
>
>  reader = vtkSmartPointer <vtkImageReader>:: New ();
>  reader-> SetFileDimensionality (3);
>  reader-> SetDataByteOrderToLittleEndian ();
>  reader-> SetFileName (nameFile.toStdString (). c_str ());
>  reader-> SetNumberOfScalarComponents (1);
>  reader-> SetDataScalarTypeToUnsignedChar ();
>  reader-> SetDataExtent (0,441,0,255,0,1353);
>  reader-> SetDataSpacing (1.0,1.0,1.0);
>  reader-> SetDataOrigin (0.0,0.0,0.0);
>  reader-> Update ();
>
> .....
>
> Is that clear?

Please keep your replies on the mailing list so everyone can help and learn.

So you are just trying to write a vtkImageData? If so, you can use
vtkXMLImageDataWriter to write a VTI file (which can be read in
Paraview) or you can use the vtkMetaImageWriter:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/MetaImageWriter

David



More information about the vtkusers mailing list