[vtkusers] VTKPNGReader

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


Hi all:

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

When using vtkImageViewer with vtkReader it works doing:

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

vtkViewer *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