<div dir="ltr">Hi David,<br><br>I&#39;d like to get a colored surface with three colors like a traffic light:<br>green  -  (which represents  low values)<br>orange -  (which represents  middle values)<br>red     -   (which represents high values) <br>

<br>each of those values should get its brightness due to the value its range.<br>for example:<br>lets say that my vtkFloatArray consists of six elements s.t.:<br>  [5,2,1,6,4,1]<br>-divide the elements to three groups and normalized each value s.t:<br>

lighter    (LI)     color x {green,orange,red}<br>stronger (ST)    color x { &quot; }<br>  [LI red, ST green, LI green, ST red, ST orange, LI green]<br><br>Hope that now my question is clearer.<br>Thanks in advance :-)<br>

<br><br><div class="gmail_quote">On Mon, Jan 9, 2012 at 12:12 AM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div></div><div class="h5">On Sun, Jan 8, 2012 at 5:08 PM, Miri Trope &lt;<a href="mailto:miritrope@gmail.com">miritrope@gmail.com</a>&gt; wrote:<br>
&gt; Hi David,<br>
&gt;<br>
&gt; Thank you for your answer.<br>
&gt; Regarding my previous questions, I tried some new manipulations and came<br>
&gt; with results:<br>
&gt;<br>
&gt; *First, regarding the writing of vtkPolyData with its scalars:<br>
&gt;   I tried to use this filter with the following code:<br>
&gt;<br>
&gt;   vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt; writerXML =<br>
&gt;     vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt;::New();<br>
&gt;<br>
&gt;   writerXML-&gt;SetFileName(&quot;Colored_Surface.vtp&quot;);<br>
&gt;<br>
&gt;   writerXML-&gt;SetInput(surfacePolyData);<br>
&gt;<br>
&gt;   writerXML-&gt;Write();<br>
&gt;<br>
&gt;   But It&#39;s only writing the polyData without its scalars/colors.<br>
&gt;   What have I missed?<br>
&gt;<br>
&gt; *Second, regarding the look up table: I simply used the following code and<br>
&gt; got the right results, but I&#39;m still searching for a way to get a variety<br>
&gt; from the same color in each range (for example, in the i&#39;th table which I<br>
&gt; set to red, I&#39;d like to get lighter/darker color due to its value in the<br>
&gt; range).<br>
&gt;<br>
&gt;   vtkSmartPointer&lt;vtkLookupTable&gt; lut =<br>
&gt; vtkSmartPointer&lt;vtkLookupTable&gt;::New();<br>
&gt;<br>
&gt;   lut-&gt;SetNumberOfTableValues(3); // I need only three colors<br>
&gt;<br>
&gt;   lut-&gt;Build();<br>
&gt;<br>
&gt;   lut-&gt;SetTableValue(0,0,1,0);<br>
&gt;<br>
&gt;   lut-&gt;SetTableValue(1,1,1,0);<br>
&gt;<br>
&gt;   lut-&gt;SetTableValue(2,1,0,0);<br>
&gt;<br>
&gt;   myVtkFloatArray-&gt;SetLookupTable(lut);<br>
&gt;<br>
&gt;<br>
&gt; Any help would be very appreciated!<br>
&gt; Regards,<br>
&gt; Miri<br>
<br>
</div></div>I think you&#39;ll still need to explain your second question more clearly<br>
- prehaps give more concrete examples (specific values that you want<br>
mapped to specific colors, and then then recoloring you&#39;re trying to<br>
describe).<br>
<br>
For the first question, you must not have attached the colors properly<br>
to surfacePolyData. Ideally please post fully compilable code with no<br>
external dependencies. If you can&#39;t do that for some reason, at least<br>
show us the way you are setting up the polydata. In you original post<br>
the variable was called mySurface - could that be the problem?<br>
<font color="#888888"><br>
David<br>
</font></blockquote></div><br></div>