[vtkusers] from cosmo to png without user interaction
Bill Lorensen
bill.lorensen at gmail.com
Thu Mar 10 10:14:35 EST 2011
This example:
http://vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot
shows how to save a rendered image into a file.
Bill
On Thu, Mar 10, 2011 at 12:25 AM, Ula Popov <ula.popov at gmail.com> wrote:
> Hello all,
>
> I have 5000 cosmo files that I need to visualize and save each as a .png
> file.
>
> If I had one file, I'd
> 1. open it in paraview
> 2. choose glyph filter
> 3. choose
> vector : velocity
> glyph type: arrow
> color by: glyphVector
> 4. press "reset" button
> 5. adjust camera -> azimuth (XX)
> 6. File->Save ScreenShot
> 7. type "output_filename"
>
> I need to automate this process, but I don't know how.
> I do know how to read cosmo file into unstructured grid,
> how to create a window, but i don't know how to set
> all these parameters and save an image.
>
>
> int main ()
> {
> vtkUnstructuredGrid *data;
> vtkSmartPointer<vtkCosmoReader> reader =
> vtkSmartPointer<vtkCosmoReader>::New();
>
> reader->SetFileName("input_filename.cosmo");
> reader->Update();
> data = reader->GetOutput(0);
>
> vtkSmartPointer<vtkUnstructuredGridGeometryFilter> geometryFilter =
> vtkSmartPointer<vtkUnstructuredGridGeometryFilter>::New();
> geometryFilter->SetInputConnection(data->GetOutputPort());
> geometryFilter->Update();
>
> //Create a mapper and actor
> vtkSmartPointer<vtkDataSetMapper> mapper =
> vtkSmartPointer<vtkDataSetMapper>::New();
> mapper->SetInputConnection(geometryFilter->GetOutputPort());
> vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
> actor->SetMapper(mapper);
>
> // a renderer and render window
> vtkRenderer *ren = vtkRenderer::New();
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(ren);
>
> // an interactor
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
> // add the actor to the scene
> ren->AddActor(actor);
> ren->SetBackground(1,1,1); // Background color white
>
> renWin->Render();
>
> // begin mouse interaction
> iren->Start();
>
> ren1->Delete();
> renWin->Delete();
> iren->Delete();
> return EXIT_SUCCESS;
> }
>
>
> Any ideas, suggestions, code examples are highly appreciated,
> ula
>
> _______________________________________________
> 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