<div dir="ltr">Hi David,<br><br>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><br><div class="gmail_quote">On Mon, Jan 9, 2012 at 12:12 AM, 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><div></div><div class="h5">On Sun, Jan 8, 2012 at 5:08 PM, Miri Trope <<a href="mailto:miritrope@gmail.com">miritrope@gmail.com</a>> wrote:<br>
> Hi David,<br>
><br>
> Thank you for your answer.<br>
> Regarding my previous questions, I tried some new manipulations and came<br>
> with results:<br>
><br>
> *First, regarding the writing of vtkPolyData with its scalars:<br>
> I tried to use this filter with the following code:<br>
><br>
> vtkSmartPointer<vtkXMLPolyDataWriter> writerXML =<br>
> vtkSmartPointer<vtkXMLPolyDataWriter>::New();<br>
><br>
> writerXML->SetFileName("Colored_Surface.vtp");<br>
><br>
> writerXML->SetInput(surfacePolyData);<br>
><br>
> writerXML->Write();<br>
><br>
> But It's only writing the polyData without its scalars/colors.<br>
> What have I missed?<br>
><br>
> *Second, regarding the look up table: I simply used the following code and<br>
> got the right results, but I'm still searching for a way to get a variety<br>
> from the same color in each range (for example, in the i'th table which I<br>
> set to red, I'd like to get lighter/darker color due to its value in the<br>
> range).<br>
><br>
> vtkSmartPointer<vtkLookupTable> lut =<br>
> vtkSmartPointer<vtkLookupTable>::New();<br>
><br>
> lut->SetNumberOfTableValues(3); // I need only three colors<br>
><br>
> lut->Build();<br>
><br>
> lut->SetTableValue(0,0,1,0);<br>
><br>
> lut->SetTableValue(1,1,1,0);<br>
><br>
> lut->SetTableValue(2,1,0,0);<br>
><br>
> myVtkFloatArray->SetLookupTable(lut);<br>
><br>
><br>
> Any help would be very appreciated!<br>
> Regards,<br>
> Miri<br>
<br>
</div></div>I think you'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'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'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>