[vtkusers] Saving a PNG images instead of opening a window

David E DeMarle dave.demarle at kitware.com
Mon Sep 10 09:39:25 EDT 2012


You need to configure VTK to use offscreen rendering. Then you can
prevent it from opening up a window.

ParaView's parallel visualization is built out of classes in VTK's MPI
parallel kits/modules. See the ParallelIso regression test
(VTK5.10/Parallel/Testing/Cxx/ParallelIso.cxx) for a sample.

VisIt is based on the same concepts (domain decomposition in
distributed memory parallel pipelines), but it is implemented in a
layer external of VTK. Ask the VisIt mailing list for details.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Mon, Sep 10, 2012 at 9:28 AM, Matthieu Dorier
<matthieu.dorier at irisa.fr> wrote:
> Hello,
>
> I'm new to VTK and I have inherited a visualization code that ends up
> opening a window to produce its result (I put part of this code below).
> I'd like to change it so it doesn't open a window but saves the result in a
> PNG image instead. How can I do that?
>
> Other question: I know VTK is used by VisIt and ParaView to perform parallel
> visualization. Does VTK itself supports parallel rendering or is the
> "parallel" aspect brought by these software? (In other words if I want to do
> visualization in parallel, can I keep using VTK only or do I have to learn
> another software?)
>
> Thank you,
>
> Matthieu Dorier
>
>         vtkUnstructuredGrid *data = vtkUnstructuredGrid::New();
>         // here some code filling the data object
>         // ...
>
>         vtkDataSetMapper *mapper = vtkDataSetMapper::New();
>         mapper->SetInput(data);
>         mapper->SetScalarRange(scalar_min, scalar_max);
>
>         // init actor
>         vtkActor *actor = vtkActor::New();
>         actor->SetMapper(mapper);
>
>         // init renderer
>         vtkRenderer *renderer = vtkRenderer::New();
>         renderer->AddActor(actor);
>         renderer->SetBackground(0.1, 0.2, 0.4);
>
>         // init window
>         vtkRenderWindow *window = vtkRenderWindow::New();
>         window->AddRenderer(renderer);
>         window->SetSize(512, 512);
>
>         // init window interaction and run the window
>         vtkRenderWindowInteractor *interactor =
> vtkRenderWindowInteractor::New();
>         interactor->SetRenderWindow(window);
>         interactor->Initialize();
>         interactor->Start();
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list