[vtkusers] vtkPNGReader

David Macias Verde david.maciasverde at gobiernodecanarias.org
Mon Jan 12 05:40:13 EST 2004


Hi all:

How could I use an vtkImageViewer to put a PNG image?

When using vtkImageViewer with vtkReader it works doing:

vtkImageReader *reader = vtkImageReader::New();
  reader->SetFileName("blabla");

vtkImageViewer *viewer = vtkImageViewer::New();
  viewer->SetInput(reader->GetOutput());

When doing the same with vtkPNGReader it does not work  in the same
manner. I have to use this code instead:

vtkPNGReader *pngreader = vtkPNGReader::New();
  pngreader->SetFileName("blabla");

vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
  mapper->SetInput ((vtkPolyData *) pngreader->GetOutput());

vtkActor *iactor = vtkActor::New();
  iactor->SetMapper(mapper);

vtkRenderWindow *renwin = vtkRenderWindow::New();
  renwin->AddRenderer(aRenderer);

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renwin);

iren->Initialize();
ren->Start();

May anyone tell me how to visualize it into a vtkImageViewer?

Thanks,

David Macias-Verde



Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ 




More information about the vtkusers mailing list