[vtkusers] vtkLookUpTable, what am I doing wrong?

Julian Humphries julian at essaustin.com
Tue May 1 19:26:25 EDT 2001


Hi,

I am using a recent vtkNightly release on Win2k with python (1.5).  The 
following code
doesn't behave as I expect:  I thought I was building a LUT with a simple 
linear grayscale
value range of 0 to 1.

table = vtkLookupTable()
table.SetTableRange(0,255)
table.SetValueRange(0.0,1.0)
table.SetSaturationRange(0.0,0.0)
table.SetHueRange(0.0,0.0)
table.SetAlphaRange(0.0,0.0)
table.SetNumberOfColors(256)
table.Build()

However, the resulting table starts off with the first 16 entries listed below
This is not what I wanted. When applied to any grayscale image this LUT
should change nothing (or at least that is what I want, as in later code I will
be changing the min and max table range values to change image leveling).

Here is the code that applies the LUT

newstack = vtkImageMapToColors()
newstack.SetInput(reader.GetOutput()
newstack.SetOutputFormatToLuminance()
newstack.SetLookupTable(table)
...

Do I need to manually insert all the LUT values?  or is there another
set of values for vtkLookupTable that will produce a linear grayscale LUT?
or is there a bug somewhere?  Or do I simply not understand what I am
doing (always possible).

Thanks, Julian Humphries
University of Texas

First 16 values using "print i, table.GetTableValue(i)"

0 (0.0, 0.0, 0.0, 0.0)
1 (0.0, 0.0, 0.0, 0.0)
2 (0.0, 0.0, 0.0, 0.0)
3 (0.0, 0.0, 0.0, 0.0)
4 (0.0, 0.0, 0.0, 0.0)
5 (0.0, 0.0, 0.0, 0.0)
6 (0.0, 0.0, 0.0, 0.0)
7 (0.0, 0.0, 0.0, 0.0)
8 (0.0, 0.0, 0.0, 0.0)
9 (0.0, 0.0, 0.0, 0.0)
10 (0.0, 0.0, 0.0, 0.0)
11 (0.00392156885937, 0.00392156885937, 0.00392156885937, 0.0)
12 (0.00392156885937, 0.00392156885937, 0.00392156885937, 0.0)
13 (0.00392156885937, 0.00392156885937, 0.00392156885937, 0.0)
14 (0.00392156885937, 0.00392156885937, 0.00392156885937, 0.0)
15 (0.00784313771874, 0.00784313771874, 0.00784313771874, 0.0)





More information about the vtkusers mailing list