[vtkusers] Picture in VTK window

b.jag at free.fr b.jag at free.fr
Mon May 14 09:54:28 EDT 2007



Hello

I want to insert a picture(make with vtkJPEGReader) into the VTK window, but
this picture stay outside the main window. How proceed to insert the picture in
VTK window ?

    Here my code :

        vtkJPEGReader readerImage = new vtkJPEGReader();
        readerImage.SetFileName("Face.jpg");
        readerImage.Update();


        vtkImageViewer viewer = new vtkImageViewer();
        viewer.SetInputConnection(readerImage.GetOutputPort());
        viewer.SetColorWindow(255);
        viewer.SetColorLevel(128);
	viewer.SetPosition(300,400);
        viewer.Render();

        vtkRenderer ren1 = new vtkRenderer();
        vtkRenderWindow renWin = new vtkRenderWindow();
        renWin.AddRenderer(ren1);

        vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
	iren.SetRenderWindow(renWin);

        renWin.Render();
	iren.Start();


Thanks in advance

Benoit Jager



More information about the vtkusers mailing list