Immersive Visualization / IQ-Station Wiki

This site hosts information on virtual reality systems that are geared toward scientific visualization, and as such often toward VR on Linux-based systems. Thus, pages here cover various software (and sometimes hardware) technologies that enable virtual reality operation on Linux.

The original IQ-station effort was to create low-cost (for the time) VR systems making use of 3DTV displays to produce CAVE/Fishtank-style VR displays. That effort pre-dated the rise of the consumer HMD VR systems, however, the realm of midrange-cost large-fishtank systems is still important, and has transitioned from 3DTV-based systems to short-throw projectors.

Difference between revisions of "ParaView Tips"

From IQ-Station Wiki
Jump to navigation Jump to search
(Added new examples for ParaView Python shell interaction)
m (Corrected the year of the SC talk -- 2014)
Line 61: Line 61:
=Stereoscopic Batch rendering=
=Stereoscopic Batch rendering=
I gave a talk on the ins and outs of ParaView stereoscopic batch rendering:
I gave a talk on the ins and outs of ParaView stereoscopic batch rendering:
* [https://www.tacc.utexas.edu/documents/10165/1147324/02+Creating+Animations+with+Paraview.pdf/51d89121-5610-4dd0-bbec-eef15df5cd38 SuperComputing 2004 talk on stereo animation batch rendering]
* [https://www.tacc.utexas.edu/documents/10165/1147324/02+Creating+Animations+with+Paraview.pdf/51d89121-5610-4dd0-bbec-eef15df5cd38 SuperComputing 2014 talk on stereo animation batch rendering]
Here's my main example of creating a "pvbatch" to render a stereo pair of images.
Here's my main example of creating a "pvbatch" to render a stereo pair of images.



Revision as of 12:56, 7 May 2022

This page will have a handful of ParaView tricks that I find handy, and will probably want to make use of in the future.

Basic Python Shell Interaction w/ Pipeline

  • Load a Wavelet source
  • View the Python Shell
  • Interact in the shell

For example:

>>> c = Contour()
>>> w = FindSource("Wavelet1")
>>> w
<paraview.servermanager.Wavelet object at 0x1269c7b50>
>>> w.GetDataInformation()
<paraview.servermanager.DataInformation object at 0x1269c71d0>
>>> # go to the information tab to get some info
>>> w.GetDataInformation().GetNumberOfCells()
8000L                               
>>> pd = w.GetPointDataInformation()                               
>>> pd                                                             
<paraview.servermanager.FieldDataInformation object at 0x1269c73d0>
>>> pd.keys()             
['RTData']                
>>> pd["RTData"].GetName()              
'RTData'                                
>>> pd["RTData"].GetNumberOfComponents()
1                                       
>>> pd["RTData"].GetComponentRange(0)
(37.353103637695312, 276.82882690429688)
>>> r = pd["RTData"].GetComponentRange(0)
>>> c.Isosurfaces = [(r[0]+r[1])/2]
>>> Show()
<paraview.servermanager.GeometryRepresentation object at 0x125dfe210>
>>> Render()
<paraview.servermanager.RenderView object at 0x125dd3e50>

Manipulate Camera in Python (shell or script)

Simple commands to affect the camera:

>>> c = GetActiveCamera()
>>> c.Roll(10)
>>> Render()
<paraview.servermanager.RenderView object at 0x125dd3e50>
>>> c.Roll(10)
>>> c.Azimuth(10)
>>> Render()
<paraview.servermanager.RenderView object at 0x125dd3e50>

Write the rendering to a file (shell or script)

One-liner to write the current rendering:

>>> WriteImage("/tmp/foo.png")


Stereoscopic Batch rendering

I gave a talk on the ins and outs of ParaView stereoscopic batch rendering:

Here's my main example of creating a "pvbatch" to render a stereo pair of images.

#! /home/avl/VR/Apps/ParaView/ParaView-v4.0.1-source/Build/bin/pvbatch
from paraview.simple import *
servermanager.LoadState("V3A.pvsm")
SetActiveView(GetRenderView())
view = GetActiveView()
scene = GetAnimationScene()
PythonAnimationCue1 = PythonAnimationCue()
PythonAnimationCue1.Script= """
def start_cue(self):
   print 'Animation starting'
   print 'NumberOfFrames = ' + str(scene.NumberOfFrames)
   print 'FramesPerTimestep = ' + str(scene.FramesPerTimestep)
   print 'PlayMode = ' + str(scene.PlayMode)
   print 'StartTime = ' + str(scene.StartTime)
   print 'EndTime = ' + str(scene.EndTime)
   print 'Duration = ' + str(scene.Duration)

def tick(self):

   i = scene.TimeKeeper.Time
   print "time is " + str(i)

   view.ViewTime = i
   scene.AnimationTime = i
   Render()

def end_cue(self):
   print 'Animation ending'
"""
scene.Cues.append(PythonAnimationCue1)
# Make some tweaks to the visualization
#path=FindSource('TemporalParticlesToPathlines5')
#path.MaxTrackLength=55
path2=FindSource('TemporalParticlesToPathlines4')
path2.MaxTrackLength=2000
sphere=FindSource('Glyph4').GlyphType
sphere.PhiResolution=12
sphere.ThetaResolution=12
#tube=FindSource('Tube5')
tube2=FindSource('Tube4')
#tube.NumberofSides=12
#tube.Radius=0.020
tube2.NumberofSides=12
tube2.Radius=0.017
# Setup the rendering parameters
scene.NumberOfFrames=2408
view.ViewSize = [1920,1080]
view.StereoRender = 1
view.StereoType = "Left"
view.UseOffscreenRendering = 1
WriteAnimation("TCollision_02_L/tcollision_02_V3A_L.png")
view.StereoType = "Right"
view.UseOffscreenRendering = 1
WriteAnimation("TCollision_02_R/tcollision_02_V3A_R.png")