[vtkusers] vtkLookUpTable, what am I doing wrong?

David Gobbi dgobbi at irus.rri.on.ca
Fri May 25 13:13:32 EDT 2001


Hi Julian,

Sorry about the late reply on this, but at the present time there
is only one way to create a linear greyscale ramp LUT in VTK: set
all the table values yourself.  In the CVS version of VTK, I've
patched the vtkWindowLevelLookupTable to build a proper ramp.

In Python, you can build the ramp as follows:

table = vtkLookupTable()
table.SetTableRange(0,1)
table.Build()
for i in range(256):
     table.SetTableValue(i,i/255.0,i/255.0,i/255.0,1.0)

The problem with the basic vtkLookupTable class in VTK is
that it builds an S-curve ramp instead of a linear ramp
(why, I have no idea -- the VTK oldtimers haven't offered an
explanation).

 - David





More information about the vtkusers mailing list