bastian
(Bastian)
1
I need to obtain a list of active color transfer functions, but I can’t figure out how to.
Here is a minimum code that visualizes a variable named ‘Swirl’:
# trace generated using paraview version 5.7.0-RC2
from paraview.simple import *
renderView1 = GetActiveViewOrCreate('RenderView')
renderView1.Update()
fastUniformGrid1 = FastUniformGrid()
fastUniformGrid1Display = Show(fastUniformGrid1, renderView1)
ColorBy(fastUniformGrid1Display, ('POINTS', 'Swirl', 'Magnitude'))
fastUniformGrid1Display.RescaleTransferFunctionToDataRange(True, False)
fastUniformGrid1Display.SetScalarBarVisibility(renderView1, True)
swirlLUT = GetColorTransferFunction('Swirl')
swirlPWF = GetOpacityTransferFunction('Swirl')
fastUniformGrid1Display.SetRepresentationType('Surface')
What I need is a function like GetColorTransferFunctions
:
ListOfLUTs = GetColorTransferFunctions() # = [ GetColorTransferFunction('Swirl') ] in the above example
Or, alternatively, a function that provides the names of variables for which there is a LUT:
ListOfVariableNames = GetVariableNames( withLUT=True ) # = ['Swirl'] in the above example
mwestphal
(Mathieu Westphal (Kitware))
2
This is not exposed. You can implement it using vtkSMSessionProxyManager::GetProxies
bastian
(Bastian)
3
I’m not familiar with the vtkSMSessionProxyManager
thing. Is it available in a python script that I would run in the shell or via pvbatch
/pvpython
?
bastian
(Bastian)
4
@mwestphal, there is
servermanager.ProxyManager().GetProxies(groupname=?, proxyname=?)
but what are the arguments needed to obtain the names of the LUTs?
mmmh, proxyname='LookupTable'
? …
mwestphal
(Mathieu Westphal (Kitware))
5
servermanager.ProxyManager().GetProxies("lookup_tables", "PVLookupTable")
should do the trick.
mwestphal
(Mathieu Westphal (Kitware))
7
My bad, there is no direct way to do that. You can do it this way :
proxyList = []
nProxies = servermanager.ProxyManager().GetNumberOfProxies('lookup_tables')
for i in range(nProxies):
proxyName = servermanager.ProxyManager().GetProxyName('lookup_tables', i)
proxyList.add(servermanager.ProxyManager().GetProxy('lookup_tables', proxyName))