[Paraview] Colormap in Paraview3 Python Script

funktioniert at gmx.net funktioniert at gmx.net
Mon Aug 20 04:22:39 EDT 2007


Hi all,

I have some *.vtk and datasets and I want to apply some filters (such as contour and slice) and a colormap to represent the value data (e.g. temperature) using the python script mode (Paraview version 3.0.2-Linux-x86). I tried to do this using the following script:

import paraview
paraview.ActiveConnection = paraview.Connect()
renModule = paraview.CreateRenderWindow()

source = paraview.CreateProxy("sources", "legacyreader", "sources")
source.SetFileName( "/home/daniel/ParaView/Test.vtk" )
source.UpdateVTKObjects()

contour = paraview.CreateProxy("filters", "Contour", "sources", "Contour1")
contour.SetInput( source )
contour.SetContourValues( 1200, 800 )
contour.UpdateVTKObjects()

colormap = paraview.CreateProxy("lookup_tables", "LookupTable", "lookup_tables")
colormap.SetHueRange(0.0, 0.66667)
colormap.SetValueRange(100,1800)
colormap.Build()

disp = paraview.CreateDisplay(contour, renModule)
disp.SetLookupTable(colormap)
disp.SetVisibility( 1 )
disp.SetOpacity( 1 )
disp.UpdateVTKObjects()

renModule.SetRenderWindowSize(1200,1200)
renModule.SetBackground( 0.329412, 0.34902, 0.427451 )
renModule.SetCameraFocalPoint( 77.8, 17.1645, 0 )
renModule.SetCameraParallelProjection( 1 )
renModule.SetCameraPosition( 77.8, 351.787, 0 )
renModule.SetCameraViewAngle( 30 )
renModule.SetCameraViewUp( 1, 0, 0 )
renModule.ResetCamera()
renModule.UpdateVTKObjects()

renModule.StillRender()

renModule.WriteImage("/home/daniel/ParaView/Test/Test.png", "vtkPNGWriter")

As long as I don't use the colormap (comment out "disp.SetLookupTable(colormap)") it just works fine an I get a nice monocolor (blue) picture.
When I use it, i get the following error message:

  >>> disp.UpdateVTKObjects()
  ERROR: In /home/berk/Work/ReleaseBuilds/ParaView3/Servers/Common/vtkProcessModule.cxx, line 971
  vtkProcessModule (0x8072ca8): Object type: vtkVolumeProperty, could not find requested method: "SetColor"
  or the method was called with incorrect arguments.
  
  while processing
  Message 0 = Invoke
    Argument 0 = id_value {82}
    Argument 1 = string_value {SetColor}
    Argument 2 = id_value {107}
  
  
  ERROR: In /home/berk/Work/ReleaseBuilds/ParaView3/Servers/Common/vtkProcessModule.cxx, line 973
  vtkProcessModule (0x8072ca8): Aborting execution for debugging purposes.
  
  Aborted

What am I doing wrong and how can I make it work?

Thanks
Daniel
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the ParaView mailing list