[vtkusers] Re: Build One Lookup Table For Two Different Scalar Groups

Janny Dong janny.dong at gmail.com
Tue Sep 25 11:03:26 EDT 2007


Amy,

Thanks so much for your reply. I'll try it out and send my feedback to the
list.

Have a great day.
Janny

On 9/25/07, Amy Squillacote <amy.squillacote at kitware.com> wrote:
>
> Hi Janny,
>
> The easiest way to accomplish what you want is with a
> vtkColorTransferFunction. It is a subclass of vtkScalarsToColors, so you
> can pass it to your mapper the same way you would with a vtkLookupTable.
> The code in C++ would look like the following.
>
> vtkColorTransferFunction *colors = vtkColorTransferFunction::New();
> colors->AddRGBPoint(50, 1, 0, 0); // 50 - scalar value; (1, 0, 0) - red
> color
> colors->AddRGBPoint(51, 0, 0, 1);
> colors->AddRGBPoint(52, 0, 0, 0); // > 50, so use black
>
> By default, in the vtkColorTransferFunction, scalar values that fall
> outside the scalar values you specify are mapped to the color of the
> closest endpoint. So in the above example, values less than or equal to
> 50 are mapped to red, and values greater than or equal to 52 are mapped
> to black. (If you have values between 51 and 52 that should be mapped to
> black, change the scalar value in the last AddRGBPoint to get the
> coloring the way you want it. The scalar values are of type double.)
>
> - Amy
>
> Janny Dong wrote:
> > The effect I want to get is that some polygons' colors change
> > according to their scalar values, while others only have one color.
> > How can I do that?
> >
> > Janny
> >
> > On 9/24/07, * Janny Dong* <janny.dong at gmail.com
> > <mailto:janny.dong at gmail.com>> wrote:
> >
> >     Hello,
> >
> >     I have some 2D polygons and corresponding scalars.One group of
> >     scalars is between 50 and 51, the other is 100. I'd like to build
> >     a color lookup table for those two groups of scalar data. For
> >     scalars between 50 and 51, I want the colors to be linearly
> >     interpolated between red and blue. I want 100 to be mapped as
> >     black. I don't want any interpolation between those two groups. I
> >     know how to build lookup tables separately for these two different
> >     cases. Is it possible to make such a lookup table?
> >
> >     I have not got any answer to my past few questions. Please help me
> >     with this one.
> >
> >     Thanks,
> >     Janny
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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
> >
>
> --
> Amy Squillacote
> Kitware, Inc.
> 28 Corporate Drive
> Clifton Park, NY 12065
> Phone: (518) 371-3971 x106
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070925/6bb03d13/attachment.htm>


More information about the vtkusers mailing list