[vtkusers] Lookup table

Nikita Kojekine AKA Kitya Karlson karlson at stu.mech.titech.ac.jp
Sat Mar 30 06:38:39 EST 2002


Dear vtkUsers!
Do you know how to get the lookup table actual size?
For example I have made a *.vtk file where I wish to use a custom
color_table
for coloring cells.
I made it like this:

CELL_DATA 1119
SCALARS scalars float 1
LOOKUP_TABLE colors
0 0 0 0 0 0 0 0 0 0
....
0 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2
2 2 2 3 2 2 2 2 2 2
2 2 2 2 2 3 2 2 2 2
2 2 2 2 2 2 2 3 3 3
3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
LOOKUP_TABLE colors 4
1 1 1 1
1 0 0 1
0 1 0 1
0 0 1 1

So i wish to map white for 0 scalar value, red - for 1, green - for 2
and
blue - for 3. But when I load this file to vtkPolyDataMapper I actully
see
that 0 is mapped to white, but all above it 1,2,3 are mapped to blue.
That means that vtkPolyDataMapper is not getting correct ScalarRange.
if I set it manualy like this:
m_ModelMapper->SetScalarRange(0.,3.);
it works and uses all my colors, but how can I set it using the file
provided?
If i use following construction:
int
 n=((vtkLookupTable*)m_ModelMapper->GetLookupTable())->GetNumberOfTableValues();

I get 256 size of lookup table, not 4, as I was expeting.
Why is that?
Thank you!






More information about the vtkusers mailing list