[vtkusers] lookupTable

Phil Cook p.cook at cs.ucl.ac.uk
Mon Oct 28 06:53:50 EST 2002


> Message: 1
> Date: Mon, 28 Oct 2002 00:39:59 +0100
> From: Stefan Ulbrich <stevie157 at gmx.net>
> To: vtkusers at public.kitware.com
> Subject: [vtkusers] lookupTable
> 
> hello,
> 
> i want to create a polydata object with several different colors. i've 
> associated a vtkUnsignedCharArray (i also tried float and int) with it 
> using
> 
> scalar-->InsertNextValue(0);
> scalar-->InsertNextValue(1);
> scalar ->InsertNextValue(4);
> pd->GetPointData()->SetScalars(scalar);
> 
> i created a lookuptable
> 
> lup->->SetNumberOfTableValues  (n);
> 
>         lut->SetTableValue(0,1,1,1,1);
>         lut->SetTableValue(1,1,1,1,.5);
>         lut->SetTableValue(2,1,0,0,.75);
>         lut->SetTableValue(3,0,0,1,.25);
>         .....
> 
>  scalars->SetLookupTable (lut);
> 
> but only the points with the scalar value 0 get the right color. the 
> others get the color defined in the last entry of the lookuptable.
> i wrote the object to disk and the values became between 0 and 1.
> 
> what do i have to do, to connect a point to a specific color??
> 
> thank you very much
> 
> stefan
> 
> 

By default, unsigned char scalars will not be mapped through the LUT.
You need to call vtkMapper::SetColorModeToMapScalars() to correct this. 

Also, set the correct scalar range of the LUT. You can do this directly,
or you can call SetScalarRange on the vtkMapper.




More information about the vtkusers mailing list