[vtk-developers] LookupTable madness

David Gobbi dgobbi at irus.rri.on.ca
Mon May 21 17:27:16 EDT 2001


Hi all,

I'm looking for a simple way to build a lookup table with a greyscale
ramp in VTK, but the only way I've found is to set all table values
directly via SetTableValue().

For example, the seemingly 'obvious' way to build a greyscale ramp is:

  t = vtkLookupTable()
  t.SetValueRange(0,1)
  t.SetSaturationRange(0,0)
  t.SetHueRange(0,0)
  t.Build()

but this results in the following grey values:

  0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   2
  2   2   3   3   3   4   4   5   5   5   6   6   7   8   8   9
  9  10  11  11  12  13  13  14  .........  254 254 254 254 255

I don't know enough about HSV to RGB conversions to know if this
is in fact correct.


A second method is the vtkWindowLevelLookupTable, which I expected
would give the proper greyscale ramp as a default:

  t = vtkWindowLevelLookupTable()
  t.Build()

  0   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14
  ..............    127 129   ...............       253 254 255

but the vtkWindowLevelLookupTable has a few fencepost-counting
bugs in it.

I'm re-writing the vtkWindowLevelLookupTable to produce a
correct ramp, but I'm curious about what other people have
been doing to create quantitatively accurate lookup tables.

 - David

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario





More information about the vtk-developers mailing list