[vtkusers] vtkLookupTable colours

David Gobbi david.gobbi at gmail.com
Sun Aug 10 21:11:40 EDT 2008


Hi Phil,

Here is VTK's equation for color mapping:

color_index = int((value - range[0])*(ncolors)/(range[1] - range[0]));

Due to the truncation from double to int, the ranges include the lower limit:

if (val < 1) color = red;
if (1 <= val < 2) color = green;
if (val >= 2) color = blue;

I hope that this is what you were looking for.

    David





On Sun, Aug 10, 2008 at 8:33 PM, Phil Goddard <philgoddard at telus.net> wrote:
>
> I have a question regarding the colours used by vtkLookupTable at the
> breakpoints in the table.
>
> Assume I have a vtkLookupTable with the following properties
>
> lut->SetRange(0,3);
> lut->SetNumberOfColors(3);
>
> And that the colours generated are 0<red<1<green<2<blue<3
>
> I believe that points with values <= 0 will be red, and that those >=3 will
> be blue.
> However what are the colours of points with values 1, and those with 2?
>
> i.e. Do the ranges include their lower limit or their upper limit?
>
> Thanks
> Phil.
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list