[vtkusers] problems with LookupTable
Chr. Rossmanith
cr at neuro.ma.uni-heidelberg.de
Thu Jun 7 08:04:02 EDT 2001
Hi,
I think I have a relatively simple problem defining a lookup table for
an image but I'm not able to solve it :-(
My testimage consists of 5 vertical stripes with grey levels 0, 63, 127,
191, 255. I'd like to create a lookup table converting the grey levels
to shades of red.
First I create a LUT and set some table values. I'd expect, that it is
enough to set those entries of the LUT, which are used later...
vtkLookupTable lut
lut SetNumberOfTableValues 255
lut SetTableRange 0 255
lut SetTableValue 0 0.2 0 0 1
lut SetTableValue 63 0.4 0 0 1
lut SetTableValue 127 0.6 0 0 1
lut SetTableValue 191 0.8 0 0 1
lut SetTableValue 255 1.0 0 0 1
Next I read the image data and set up the rendering stuff...
vtkTIFFReader reader
reader SetFileName ./test.tif
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkDataSetMapper dataMapper
dataMapper SetInput [reader GetOutput]
dataMapper SetLookupTable lut <-
now the image could become coloured....
vtkActor dataActor
dataActor SetMapper dataMapper
ren1 AddActor dataActor
renWin SetSize 500 500
renWin Render
The image gets rendered but in shades of grey. Obviously I'm missing
something, but what?
The documentation of SetTableValue looks like
void vtkLookupTable::SetTableValue (
int indx,
float r,
float g,
float b,
float a = 1.0 )
<- does this mean that a always has to be 1 or is it 1 if I don't
specify it
Thank you in advance,
Christina Rossmanith
More information about the vtkusers
mailing list