Amy,<br><br>Thanks so much for your reply. I&#39;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> &lt;<a href="mailto:amy.squillacote@kitware.com">amy.squillacote@kitware.com</a>&gt; 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-&gt;AddRGBPoint(50, 1, 0, 0); // 50 - scalar value; (1, 0, 0) - red<br>color<br>colors-&gt;AddRGBPoint(51, 0, 0, 1);
<br>colors-&gt;AddRGBPoint(52, 0, 0, 0); // &gt; 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>&gt; The effect I want to get is that some polygons&#39; colors change<br>&gt; according to their scalar values, while others only have one color.
<br>&gt; How can I do that?<br>&gt;<br>&gt; Janny<br>&gt;<br>&gt; On 9/24/07, * Janny Dong* &lt;<a href="mailto:janny.dong@gmail.com">janny.dong@gmail.com</a><br>&gt; &lt;mailto:<a href="mailto:janny.dong@gmail.com">janny.dong@gmail.com
</a>&gt;&gt; wrote:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Hello,<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; I have some 2D polygons and corresponding scalars.One group of<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; scalars is between 50 and 51, the other is 100. I&#39;d like to build<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; a color lookup table for those two groups of scalar data. For
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; scalars between 50 and 51, I want the colors to be linearly<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; interpolated between red and blue. I want 100 to be mapped as<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; black. I don&#39;t want any interpolation between those two groups. I
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; know how to build lookup tables separately for these two different<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; cases. Is it possible to make such a lookup table?<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; I have not got any answer to my past few questions. Please help me
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; with this one.<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Thanks,<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Janny<br>&gt;<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________
<br>&gt; This is the private VTK discussion list.<br>&gt; 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>&gt; Follow this link to subscribe/unsubscribe:
<br>&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;<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>