[vtkusers] help on scalar color mapping

mirko heuegger mheuegger at gmail.com
Thu Jul 23 03:07:19 EDT 2009


On Wed, Jul 22, 2009 at 11:31 AM, zhigao<chen0136 at ntu.edu.sg> wrote:
> What i am trying to color are boxes. I have a scalar array which ranges from
> 0 to 3000, and i would like it to map in a way which is not evenly spaced,
> for exampe:
> 0-1 red
> 1-3 green
>  [ .. cut .. ]
> I check the codes about the vtkLookupTable, it seems like it will equally
> divided the range according to the number of color which is not i want.

Take a look at the 'vtkColorTransferFunction'

And the vtkPiecewiseFunction-class might be helpful for your stepwise
or you reclassify you input-data (e.g.:  0-10 |--> 1; 11-25 |--> 2;
...) and using this new values as points for the
vtkColorTransferFunction.Add(RGB|HSV)Point(..) function.



Real programmers don't document; if it was
hard to write, it should be hard to understand.

More information about the vtkusers mailing list