Amy,<br><br>Thanks so much for your reply. I'll try it out and send my feedback to the list.<br><br>Have a great day.<br>Janny<br><br><div><span class="gmail_quote">On 9/25/07, <b class="gmail_sendername">Amy Squillacote
</b> <<a href="mailto:amy.squillacote@kitware.com">amy.squillacote@kitware.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Janny,<br><br>The easiest way to accomplish what you want is with a<br>vtkColorTransferFunction. It is a subclass of vtkScalarsToColors, so you<br>can pass it to your mapper the same way you would with a vtkLookupTable.
<br>The code in C++ would look like the following.<br><br>vtkColorTransferFunction *colors = vtkColorTransferFunction::New();<br>colors->AddRGBPoint(50, 1, 0, 0); // 50 - scalar value; (1, 0, 0) - red<br>color<br>colors->AddRGBPoint(51, 0, 0, 1);
<br>colors->AddRGBPoint(52, 0, 0, 0); // > 50, so use black<br><br>By default, in the vtkColorTransferFunction, scalar values that fall<br>outside the scalar values you specify are mapped to the color of the<br>closest endpoint. So in the above example, values less than or equal to
<br>50 are mapped to red, and values greater than or equal to 52 are mapped<br>to black. (If you have values between 51 and 52 that should be mapped to<br>black, change the scalar value in the last AddRGBPoint to get the<br>
coloring the way you want it. The scalar values are of type double.)<br><br>- Amy<br><br>Janny Dong wrote:<br>> The effect I want to get is that some polygons' colors change<br>> according to their scalar values, while others only have one color.
<br>> How can I do that?<br>><br>> Janny<br>><br>> On 9/24/07, * Janny Dong* <<a href="mailto:janny.dong@gmail.com">janny.dong@gmail.com</a><br>> <mailto:<a href="mailto:janny.dong@gmail.com">janny.dong@gmail.com
</a>>> wrote:<br>><br>> Hello,<br>><br>> I have some 2D polygons and corresponding scalars.One group of<br>> scalars is between 50 and 51, the other is 100. I'd like to build<br>> a color lookup table for those two groups of scalar data. For
<br>> scalars between 50 and 51, I want the colors to be linearly<br>> interpolated between red and blue. I want 100 to be mapped as<br>> black. I don't want any interpolation between those two groups. I
<br>> know how to build lookup tables separately for these two different<br>> cases. Is it possible to make such a lookup table?<br>><br>> I have not got any answer to my past few questions. Please help me
<br>> with this one.<br>><br>> Thanks,<br>> Janny<br>><br>><br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________
<br>> This is the private VTK discussion list.<br>> Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>> Follow this link to subscribe/unsubscribe:
<br>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>><br><br>--<br>Amy Squillacote<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br>Phone: (518) 371-3971 x106
<br><br></blockquote></div><br>