lookuptable Module

Utility module for easy manipultions of lookup tables. This module is intended for use with by simple.py.

PARAVIEW_DEPRECATED_IN_5_12_0: will be removed in future releases of ParaView.

class paraview.lookuptable.vtkPVLUTReader(ns=None)[source]

Bases: object

Reader and container for ParaView’s XML based lookup tables. Once lookup tables are loaded you access them by name. When accessing you must provide the array instance, which you may get from a pvpython ‘Source’ type object.

This reader makes use of ParaView’s XML LUT file format with one exception - the XML document must be root’ed by an element named “ColorMaps”. Within the “ColorMaps” element an arbitrary number of ParaView’s “ColorMap” elements define LUT entries.

Usage:

# at the top of your script
# create the reader and load LUT's
lr = lookuptable.vtkPVLUTReader()
lr.Read('/path/to/luts.xml')
lr.Print()

# after you have a pvpython source object, get
# one of it's arrays.
srcObj = GetActiveSource()
array = srcObj.PointData.GetArray('arrayName')

# create a LUT for the array.
lut = lr.GetLUT(array,'lutName')

# set the active array and assign the LUT
srcObjRep = Show(srcObj)
srcObjRep.ColorArrayName = 'arrayName'
srcObjRep.LookupTable = lut

# finally render to display the result
Render()

File Format:

<ColorMaps>
    ...
  <ColorMap name="LUTName" space="Lab,RGB,HSV" indexedLookup="true,false">
    <Point x="val" o="val" r="val" g="val" b="val"/>
      ...
    <Point x="val" o="val" r="val" g="val" b="val"/>
    <NaN r="val" g="val" b="val"/>
  </ColorMap>
    ...
  <ColorMap>
    ...
  </ColorMap>
    ...
</ColorMaps>
Clear()[source]

Clear internal data structures.

GetLUT(aArray, aLutName, aRangeOveride=[])[source]

Given an array and lookup table name assign the LUT to the given array and return the LUT. If aRangeOveride is specified then LUT will be mapped through that range rather than the array’s actual range.

GetLUTNames()[source]

Return a list of the currently available LUT’s names.

Print()[source]

Print the available list of LUT’s.

Read(aFileName)[source]

Read in the LUT’s defined in the named file. Each call to read extends the internal list of LUTs.