[vtkusers] Bad image rendering with vtkImageToPolyDataFilter

Christophe Franco cfranco at amsatec.fr
Mon Oct 20 11:01:41 EDT 2003


Hi everybody,

I'm trying to display an image taken from a PNG file. For that, I'm 
using a vtkImageToPolyDataFilter to convert it in order to be able to 
display it with other 3D objects. Here is my C++ code fragment :


vtkPNGReader* reader = vtkPNGReader::New();
reader->SetFileName("test.png"); // File in AmsaView directory
reader->Update();

vtkImageToPolyDataFilter* filter = vtkImageToPolyDataFilter::New();
filter->SetInput(reader->GetOutput());

vtkPolyDataMapper* imageMapper = vtkPolyDataMapper::New();
imageMapper->SetInput(filter->GetOutput());

vtkActor* imageActor = vtkActor::New();
imageActor->SetMapper(imageMapper);
imageActor->SetPosition(0, 0, 0);

[...]

The result is awful : there are always black lines across the image. See 
the source file (test.png) and a screen capture of the result (result.png).

What can I do ? Is there a proper way to use a vtkImageToPolyDataFilter 
that I didn't understand ? Or maybe another way to display the image ? 
What I want to do (later) is to images as glyphs to allow users to 
customize representation of points with their images.

Thank you in advance.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 13361 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031020/d3df1bbc/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: result.png
Type: image/png
Size: 8361 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031020/d3df1bbc/attachment-0001.png>


More information about the vtkusers mailing list