[Paraview] Volume Render from python
Jordi Campos i Miralles
jcampos at maia.ub.es
Mon Jul 2 10:17:13 EDT 2007
Hi,
I have a working PV script with Surface representation, but if I try to
use the Volume representation it fails with:
"
ERROR: In /opt/local/fonts/ParaView3/VTK/Filtering/vtkExecutive.cxx, line 757
vtkUpdateSuppressorPipeline (0x83e1ed0): Algorithm vtkPVUpdateSuppressor(0x83e0e80) returned failure for request: vtkInformation (0x83eacd8)
Debug: Off
Modified Time: 612759
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In /mnt/dades/opt-local-fonts/ParaView3/Servers/Filters/vtkPVUpdateSuppressor.cxx, line 113
vtkPVUpdateSuppressor (0x83e0e80): No valid input.
Process XMLImageDataReader [...........]
Process FixedPointVolumeRayCastMapper [...
"
Below is the script list that works because it has commented the
SetRepresentation( VOLUME ) line.
Does anybody know what should be done in order to active the Volume
Render?
Thanks.
jor;)i
#!/usr/local/bin/pvpython
# PV-VolumeRender.py
import paraview
if paraview.ActiveConnection == None : CONSOLE = True
else : CONSOLE = False
if CONSOLE: # init Conn and RenderM
paraview.ActiveConnection = paraview.Connect()
renderM = paraview.CreateRenderWindow()
else:
renders = paraview.pyProxyManager().GetProxiesInGroup("multirendermodule",
paraview.ActiveConnection)
renderM = renders.values()[0].GetRenderModules()[0]
# alphaLUT
alphaLUT = paraview.CreateProxy("piecewise_functions", "PiecewiseFunction",
"pq_helper_proxies.81", "ScalarOpacityFunction")
alphaLUT.SetPoints( 0, 0, 4095, 1 )
alphaLUT.UpdateVTKObjects()
# colorLUT
colorLUT = paraview.CreateProxy("lookup_tables", "PVLookupTable",
"lookup_tables", "1.scalars")
colorLUT.SetColorSpace( 1 )
colorLUT.SetDiscretize( 1 )
colorLUT.SetHSVWrap( 0 )
colorLUT.SetLockScalarRange( 0 )
colorLUT.SetNumberOfTableValues( 256 )
colorLUT.SetRGBPoints( 0, 0, 0, 1, 4095, 1, 0, 0 )
colorLUT.SetScalarRangeInitialized( 1 )
colorLUT.SetUseLogScale( 0 )
colorLUT.SetVectorComponent( 0 )
colorLUT.SetVectorMode( 0 )
colorLUT.UpdateVTKObjects()
# source
source = paraview.CreateProxy("sources", "XMLImageDataReader",
"sources", "head.vti")
source.SetFileName( "/home/jcampos/head.vti" )
source.SetPointArrayInfo( "scalars", "1" )
source.SetPointArrayStatus( "scalars", "1" )
source.UpdateVTKObjects()
# display
display = paraview.CreateDisplay(source, renderM)
display.SetInput( source )
#display.SetRepresentation( 4 ) # IT FAILS
display.SetScalarMode( 3 )
display.SetScalarOpacityFunction( alphaLUT )
display.SetScalarOpacityUnitDistance( 1 )
display.SetLookupTable( colorLUT )
display.SetColorArray( "scalars" )
display.SetColorMode( 1 )
display.SetUseLookupTableScalarRange( 1 )
display.SetMapScalars( 1 )
display.SetScalarVisibility( 1 )
display.SetLODResolution( 50 )
display.SetVisibility( 1 )
display.UpdateVTKObjects()
if CONSOLE:
renderM.ResetCamera()
renderM.StillRender()
raw_input("Enter to finish")
I also have the following complement lines:
# display.SetAmbientColor( 1, 1, 1 )
# display.SetColor( 1, 1, 1 )
# display.SetDiffuseColor( 1, 1, 1 )
# display.SetForceStrips( 0 )
# display.SetImmediateModeRendering( 0 )
# display.SetInterpolateScalarsBeforeMapping( 1 )
# display.SetInterpolation( 1 )
# display.SetLineWidth( 1 )
# display.SetNumberOfSubPieces( 1 )
# display.SetOpacity( 1 )
# display.SetOrientation( 0, 0, 0 )
# display.SetOrigin( 0, 0, 0 )
# display.SetPickable( 1 )
# display.SetPointSize( 5 )
# display.SetPosition( 0, 0, 0 )
# display.SetSaveCacheOnCacheUpdate( 1 )
# display.SetScale( 1, 1, 1 )
# display.SetShading( 0 )
# display.SetSpecularColor( 1, 1, 1 )
# display.SetSpecularPower( 100 )
# display.SetUseStrips( 0 )
# display.SetUpdateTime( 0 )
# display.SetCacheUpdate( 0, -1 )
--
Jordi Campos i Miralles
Departament de Matemàtica Aplicada i Anàlisi, MAiA
Facultat de Matemàtiques, Universitat de Barcelona
Gran Via de les Corts Catalanes, 585
08007 Barcelona
Telf : +34 93 403 93 72
More information about the ParaView
mailing list