[vtkusers] from cosmo to png without user interaction
Ula Popov
ula.popov at gmail.com
Thu Mar 10 00:25:00 EST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110309/a95d2bbd/attachment.htm>
More information about the vtkusers
mailing list