[Paraview] How to re-center the volume, how to save a slice as PNG and how to recolour based on values(transfer function).

Magnus Elden magnus_elden at hotmail.com
Sat Oct 1 22:31:43 EDT 2016


I wrote a program in C++ with VTK and I basically did this: Read volume, create vtkImageCanvasSource2D, manually access each point and add that value to the canvas, write the image using vtkPNGWriter.

I was unable to open any XDMF files using C++, so I changed to python. There are now three problems:


1.  The volume, when using the interactor, seems to be way off the origin causing any roation I do to end in a huge swiping motion of the volume. I have been unable to find any method to re-center the volume even though when I open it in the Paraview application it works well and is centered.

2.  What I am doing in the script is simply that I read the volume and Slice() the reader. Then I want to store that slice to a subarea of a canvas that I store as a PNG image file. I have been unable to find any canvas class, any other storage class and I have not found a PNGwriter class. The only thing I have found has been a screenshot writer, something I so not want. I simply want to slice the volume n times along the Z axis and then save each slice to the canvas which, in turn, is stored to disk.

3.  Finally, this might be me being stupid, but I have been unable to find any method to create a LUT filter and render those colours. I did try to "lut = GetLookupTableForArray("Blue to Red Rainbow", 10);" and then add that to the actors LookupTable as follows: r = Show(volume); r.LookupTable = lut; However, this has not had any effect on the rendered image.

Below you can see in Paraview what I want in the python script.
http://puu.sh/ruIGf/c54f458415.png

Python I admit I am not too good with, but to add to that I am unable to autocomplete properly and I am also unable to see things like documentation and descriptions and open the class specifications using pvpython.exe. This causes me to only be able to use what I find in the online documentation with minimal help. Paraview's python interface is not up to the standard of the Paraview client.

Thank you for your help.

Yours,
Magnus Elden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161002/52991386/attachment.html>


More information about the ParaView mailing list