[vtkusers] Non-continuous lookup function
Lisa Sobierajski Avila
lisa.avila at kitware.com
Wed Aug 1 22:57:25 EDT 2001
Hello Ron,
You should be able to use vtkColorTransferFunction for this (it is a
subclass of vtkScalarsToColors just as vtkLookupTable is). Let e be some
small epsilon value, min be the minimum value in your scalar range and max
be the maximum - then you would do the following
ctf = vtkColorTransferFunction::New();
ctf->AddRGBPoint( min, r1, g1, b1 );
ctf->AddRGBPoint( a-e, r1, g1, b1 );
ctf->AddRGBPoint( a, r2, g2, b2 );
ctf->AddRGBPoint( b, r2, g2, b2 );
ctf->AddRGBPoint( b+e, r3, g3, b3 );
ctf->AddRGBPoint( max, r3, g3, b3 );
This would set all values below a to (r1, g1, b1), those between a and b to
(r2, g2, b2) and those above b to (r3, g3, b3).
The problem you are having with vtkLookupTable is that the scalar value is
implied from the number of entries and the scalar range. With
vtkColorTransferFunction you have more control.
Lisa
At 12:09 PM 7/31/2001, Ron Inbar wrote:
>Hi all,
>
>In my application, I want to paint all the cells whose scalar value falls
>within a specified range in one color, and the rest of the cells in another
>color.
>The reasonable way to do this, in my opinion, is to set up a lookup table of
>3 entries, corresponding to values below the minimum, within the range, and
>above the maximum, in this order, and then have the vtkLookupTable object
>map the scalar values as described above. But vtkLookupTable doesn't behave
>this way. If I set the scalar range to be [a,b] then the value a will
>always be mapped to entry 0 and the value b to entry 2, but intermediate
>values close to the ends of the range will also be mapped to these entries.
>I want a+epsilon and b-epsilon to be always mapped to entry 1, no matter how
>small epsilon is.
>Can I use vtkLookupTable or a subclass thereof to achieve the behavior I
>need?
>
>Thanks in advance,
>
>Ron Inbar
>
>
>
>...
>---
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list