<div dir="ltr">Hi David,<br>Thank you for your answer, I'd appreciate a further advice:<br><br>I managed to map the right values (scalars) into the right colors (green, yellow and red).<br>However, I haven't found the method to get the color gradients in each color range.<br>
I mean that I'd like to obtain the scalars data (which have been mapped to those three colors) into the gradient of each color.<br>Thus, I should get something like a topological map.<br><br>Here is my code snippet:<br>
<br> vtk_lut->SetNumberOfColors(3);<br> vtk_lut->Build();<br> vtk_lut->SetTableValue(2,0,1,0); //green<br> vtk_lut->SetTableValue(1,1,1,0); //yellow<br> vtk_lut->SetTableValue(0,1,0,0); //red<br>
<br>If it possible, please represent in which functions I should use.<br>Thanks in advance!<br><br><br><div class="gmail_quote">On Thu, Jan 12, 2012 at 3:18 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, Jan 12, 2012 at 2:47 AM, Miri Trope <<a href="mailto:miritrope@gmail.com">miritrope@gmail.com</a>> wrote:<br>
> Hi David,<br>
><br>
</div><div class="im">> I'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 { " }<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>
</div>I'd suggest you insert the colors in the color map as HSV values. I<br>
don't think there is direct support for doing this, but you can<br>
convert them manually.<br>
<br>
You'll want to end up with something like:<br>
<br>
ColorMap = { {H_g, S_g, V_light}, {H_g, S_g, V_dark}, {H_o, S_o,<br>
V_light}, {H_o, S_o, V_dark}, {H_r, S_r, V_light}, {H_r, S_r, V_dark}<br>
}<br>
<br>
That is, choose a green hue (H_g), a green saturation (S_g), hues for<br>
orange and red, and then the values of "light" and "dark" you want.<br>
<br>
But you'll have to insert them as RGB values. You can convert the HSV<br>
values to choose to RGB using functions from vtkMath<br>
(<a href="http://www.vtk.org/doc/nightly/html/classvtkMath.html#a432c7d56d981a3030cb0d6f4a8789b79" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkMath.html#a432c7d56d981a3030cb0d6f4a8789b79</a>)<br>
such as vtkMath::HSVToRGB.<br>
<br>
For reference:<br>
<a href="http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV" target="_blank">http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV</a><br>
<br>
Good luck,<br>
<font color="#888888"><br>
David<br>
</font></blockquote></div><br></div>