[vtkusers] fit vtkRenderWindow with polydata image

jaki19 nour_sn at hotmail.fr
Tue Mar 14 03:31:39 EDT 2017


Hallo, I have a polydata image with 124x126 but the vtkRenderWindow is always
300x300 why??

how can I fit the windows to my polydata borders??


            mapper.SetInputConnection(polyDataReader.GetOutputPort());
            vtkActor actor = new vtkActor();
            actor.SetMapper(mapper);
            actor.GetBounds(bounds);
            System.out.println("actor: " + bounds[1] + " x " + bounds[3]);   
* //124x126*

            //Create a renderer, render window, and interactor
            vtkRenderer renderer = new vtkRenderer();

            vtkRenderWindow renderWindow = new vtkRenderWindow();
                     
            renderWindow.AddRenderer(renderer);

            vtkRenderWindowInteractor renderWindowInteractor = new
vtkRenderWindowInteractor();
            renderWindowInteractor.SetRenderWindow(renderWindow);


            //Add the actor to the scene
            renderer.AddActor(actor);
            renderer.SetBackground(0, 0, 0); 


            //Render and interact
            renderWindow.Render();

            //screenshot code:
            vtkWindowToImageFilter w2if = new vtkWindowToImageFilter();
            w2if.SetInput(renderWindow);
            w2if.Update();

            vtkPNGWriter writer = new vtkPNGWriter();
            writer.SetFileName("out.png");      *//image 300x300 why??*
            writer.SetInputData(w2if.GetOutput());
            writer.Write();

thanks




--
View this message in context: http://vtk.1045678.n5.nabble.com/fit-vtkRenderWindow-with-polydata-image-tp5742463.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list