[vtkusers] How to convert the vtkPolyData to vtkImageData

David Doria daviddoria+vtk at gmail.com
Sun Aug 22 08:59:40 EDT 2010


On Sun, Aug 22, 2010 at 1:46 AM, XuXing <cool2201 at sina.com> wrote:

> Hi all
>
> I want to convert the vtkPolyData to vtkImageData, I have used the
> vtkPolydataToImageStencil to do the job, but it didn’t work, maybe there is
> some error in my code
>
> My purpose is to draw a line on the top of an image, so I used
> vtkImageBlend and vtkImageCanvasSource2D to finish it. Any advice will be
> appreciated, thanks.
>
>
>
>
>
> XuXing
>
>
>
I don't understand what converting a polydata to an imagedata has to do with
drawing on an image? If you want to do that, you'll have to snap the points
to a grid first:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/QuantizePolyDataPoints

You can draw on an image like this:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/ImageTracerWidget
<http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/ImageTracerWidget>(ignore
the picture of sphere - I'll update it later today)

Good luck,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100822/23a020eb/attachment.htm>


More information about the vtkusers mailing list