[vtkusers] Converting PolyData into ImageData

David Gobbi dgobbi at irus.rri.ca
Thu Apr 25 14:16:49 EDT 2002


Hi Micheal,

There are quite a few ways to convert PolyData to ImageData and vice
versa, and they lead to very different results.  So the question of
'how to convert PolyData to ImageData' is a bit too vague.

The most common way is probably just to render the PolyData and then
get a window screenshot via vtkWindowToImageFilter.  Is this what you
want?

Or, if the PolyData forms a closed surface the vtkPolyDataToImageStencil
can be used to make a stencil that can then be used to make the voxels
inside the PolyData one color and the voxels outside the PolyData another
color.

Or, if you want to create an image by interpolating the Scalars
associated with the vertices or cells in the PolyData you can use
vtkProbeFilter.


Going on from here, if you want to generate images of the contours of
your vtkPolyData, then you can use vtkCutter to get cross sections of
the data, render each cross-section, and then save the image that is
rendered as a TIFF.   The image will contain a thin line corresponding to
the surface of the mesh.  If the cross-section is a convex polygon then
it can be filled in with vtkDelaunay2D.

If you want to generate images that are e.g. white inside the mesh
and black outside then you can use vtkPolyDataToImageStencil and
vtkImageStencil to create a 3D image volume from the mesh, and then
save the image volume as a set of TIFF slices via vtkTIFFWriter.

 - David

--
  David Gobbi, MSc                       dgobbi at irus.rri.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Thu, 25 Apr 2002, Michael Györffy wrote:

> Hello:
>
> I have Polydata. Can save it using PolyDataWriter.
>
> I would like to save it with PNMWriter, but I think I have to convert my
> PolyData into ImageData. How do I do this?
>
> Also, along a similar vein, I would like slice up my PolyData and save the
> sections as TIFFs. I understand how to use ImageReslice, but it requires
> ImageData which I don't have.
>
> Any help or clues would be much appreciated.
>
> Thank you,
>
> Mike
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list