[vtkusers] Overlaying simulation results on PNG image

Sebastien Jourdain sebastien.jourdain at kitware.com
Tue Aug 30 10:28:00 EDT 2011


Hi Artem,

you can use the actor transformation of the PNG image to stretch to
the current value.
As I don't fully understand your problem, I might provide an invalid
answer. But based on the bounds of both your data, you should be able
to determine the scale that you want to apply to the PNG so it could
match the other.

Good luck,

Seb

On Tue, Aug 30, 2011 at 10:21 AM, Artem Babayan
<artem.paraview at googlemail.com> wrote:
> 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
> _______________________________________________
> 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