[Paraview] Paraview/Load File and Take Screenshot
Fastl, Thomas
thomas.fastl at kcl.ac.uk
Fri Jan 2 10:57:31 EST 2015
Hello Utkarsh,
thank you for the information! I have been searching online for tutorials on how I can load and display .vtk-files in Paraview and realized that I can save a state as a Python script. This script provides me with all the information necessary to load the .vtk-files, change their mesh color and the view angle (I can run the script using pvbatch test.py). However, I could not figure out how I can take a screenshot from that stage and save the .png-file. The python script test.py looks like this:
# state file generated using paraview version 4.2.0
# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# Create a new 'Render View'
renderView1 = CreateView('RenderView')
renderView1.ViewSize = [1613, 837]
renderView1.CenterOfRotation = [91.7317943572998, 165.96746826171875, 209.01107025146484]
renderView1.CameraPosition = [91.7317943572998, -19.57611529481801, 209.01107025146484]
renderView1.CameraFocalPoint = [91.7317943572998, 165.96746826171875, 209.01107025146484]
renderView1.CameraViewUp = [0.0, 0.0, 1.0]
renderView1.CameraParallelScale = 48.022213121002615
renderView1.Background = [0.32, 0.34, 0.43]
# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------
# create a new 'Legacy VTK Reader'
outputEndoSurfRegistrationvtk = LegacyVTKReader(FileNames=['/home/.../outputEndoSurfRegistrationvtk.vtk'])
# create a new 'Legacy VTK Reader'
atlasEndoSurfRegistrationvtk = LegacyVTKReader(FileNames=['/home/.../atlasEndoSurfRegistration.vtk'])
# ----------------------------------------------------------------
# setup the visualization in view 'renderView1'
# ----------------------------------------------------------------
# show data from atlasEndoSurfRegistrationvtk
atlasEndoSurfRegistrationvtkDisplay = Show(atlasEndoSurfRegistrationvtk, renderView1)
# trace defaults for the display properties.
atlasEndoSurfRegistrationvtkDisplay.ColorArrayName = [None, '']
atlasEndoSurfRegistrationvtkDisplay.DiffuseColor = [0.0, 0.0, 0.4980392156862745]
# show data from outputEndoSurfRegistrationvtk
outputEndoSurfRegistrationvtkDisplay = Show(outputEndoSurfRegistrationvtk, renderView1)
# trace defaults for the display properties.
outputEndoSurfRegistrationvtkDisplay.ColorArrayName = ['POINTS', '']
outputEndoSurfRegistrationvtkDisplay.DiffuseColor = [0.0, 0.3333333333333333, 0.0]
I guess that it will be only a simple command added at the end of the script which does the trick and would appreciate any help on that, thanks! Finally, happy new year to everyone! :-)
Best, Thomas
________________________________________
From: Utkarsh Ayachit <utkarsh.ayachit at kitware.com>
Sent: Friday, December 19, 2014 6:42 PM
To: Fastl, Thomas
Cc: paraview at paraview.org
Subject: Re: [Paraview] Paraview/Load File and Take Screenshot
You can indeed run a python script from terminal to automate such a
task. Use pvpython or pvbatch executables. Those are simply Python
interpreters with ParaView initialization stub. You can pass in a
script as command line argument and the application will quit once the
script is done.
Utkarsh
On Fri, Dec 19, 2014 at 9:01 AM, Fastl, Thomas <thomas.fastl at kcl.ac.uk> wrote:
> Dear Paraview-Community,
>
>
> I am currently running parameter sweeps and want to visually compare the
> result (a single .vtk file) to a base line (a single .vtk file). Therefore,
> I wanted to load both .vtk-files in Paraview, generate a screenshot of them
> and close Paraview again. Since I have several hundred simulations this task
> would be very tedious to do manually and hence I though I might be able to
> run a python script from the terminal to do this task in an automated
> fashion.
>
>
> I have found this link online
> (http://public.kitware.com/pipermail/paraview/2011-October/023026.html)
> which is not very promising, but also hoping that this feature would have
> been added since then. I already want to thank you in advance for any help,
> merry Xmas!
>
>
> Kind regards,
> ___________________________
> DI Thomas E Fastl, BSc
> Research Student
> King's College London
> School of Medicine
> Department of Biomedical Engineering
>
> The Rayne Institute
> 4th Floor, Lambeth Wing
> St Thomas' Hospital, London SE1 7EH
> Email: thomas.fastl at kcl.ac.uk
>
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
More information about the ParaView
mailing list