[vtkusers] Overlaying simulation results on PNG image

Artem Babayan artem.paraview at googlemail.com
Tue Aug 30 10:21:47 EDT 2011


Hi,

I have a 2D concentration field defined over 1000x1000m area on 50x50
rectangular grid. I have PNG image of the map of the area (e.g.
400x400 pixels). I need to draw the concentration field over the map
(and to be able to rotate the resulting  2D image in 3D). How can I
make both pictures to cover the same area?

Providing, that I have

vtkSmartPointer<vtkDataSet> data_set
vtkSmartPointer<vtkPNGReader> png_reader

already filled with data and omitting parts for setting the lookup
table I do the following:

//For PNG image:
 vtkSmartPointer<vtkImageViewer> image_viewer =
                                  vtkSmartPointer<vtkImageViewer>::New();
 image_viewer->SetInputConnection(png_reader->GetOutputPort());

 vtkSmartPointer<vtkDataSetMapper> mapper_png =
               vtkSmartPointer<vtkDataSetMapper>::New();
 mapper_png->SetInput(image_viewer->GetInput());

 actor_png->SetMapper(mapper_png);

//For conc field:
 vtkSmartPointer<vtkDataSetMapper> mapper_field =
               vtkSmartPointer<vtkDataSetMapper>::New();
 mapper_field->SetInput(data_set);
 actor_field->SetMapper(mapper_field);

and then add both actors to window for rendering. The PNG image covers
just as fraction of the area covered with concentration filed. Is it
possible to make PNG file automatically stretched over the
concentration field area Or, if it should be done manually, how to
calculate the required stretching coefficient?

Best wishes
Artem



More information about the vtkusers mailing list