Hey David,<br><br>Thanks for that explanation. Now it's bit clear about how lookup table works. But in my case, I guess, binsize is not uniform. Let me put it in this form<br><br> 10 ==== (1.0, 0.0, 0.0)<br>20 ==== (1.0, 0.5, 0.0)<br>
30 ==== (1.0, 1.0, 0.0)<br>40 ==== (0.5, 1.0, 0.0)<br>50 ==== (0.0, 1.0, 0.0)<br>60 ==== (0.0, 1.0, 0.5)<br>80 ==== (0.0, 1.0, 1.0)<br>100 ==== (0.0, 0.5, 1.0)<br>200 ==== (0.0, 0.0, 1.0)<br><br>in this case, bin size is not equal to (max-min)/n. I mean, lookup table might calculate it like that. But If dont want in that way, then what changes I have to do to implement? May be I am wrong in understanding the meaning of binsize. Please correct me if I'm wrong.<br>
<br>Thanks<br><br>Regards<br>Rakesh Patil<br><br><div class="gmail_quote">On Tue, Feb 22, 2011 at 11:58 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Rakesh,<br>
<br>
The way that the lookup table maps values to colors is as follows:<br>
If the Range of the table is set to [min,max] and the number of colors<br>
in the table is n, then the equation that maps a value "v" to an<br>
index "i" is:<br>
<br>
i = floor((v - min)*n/(max - min))<br>
<br>
The bin size is uniform and equal to (max - min)/n. Values in the<br>
range [min, min + binsize] go into the first bin (and values less than<br>
min also go into the first bin).<br>
<br>
Since the bins are uniform in size, you will need a table with 20 values<br>
and a binsize of 10, and some of the colors will have to be repeated.<br>
Use lut->SetTableRange(0.5, 200.5), where the ".5" is for rounding.<br>
<font color="#888888"><br>
- David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Mon, Feb 21, 2011 at 10:35 PM, rakesh patil<br>
<<a href="mailto:prakeshofficial@gmail.com">prakeshofficial@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I have to display contours, for a given range, by mapping values to colours.<br>
> i.e. Consider I need to display contours between 1 and 200.<br>
><br>
> I use the lookuptable as follows<br>
><br>
> vtkSmartPointer<vtkLookupTable> lut =<br>
> vtkSmartPointer<vtkLookupTable>::New();<br>
> lut->SetNumberOfTableValues(9);<br>
> lut->SetTableValue(0, 1.00, 0.00, 0.00);<br>
> lut->SetTableValue(1, 1.00, 0.50, 0.00);<br>
> lut->SetTableValue(2, 1.00, 1.00, 0.00);<br>
> lut->SetTableValue(3, 0.50, 1.00, 0.00);<br>
> lut->SetTableValue(4, 0.00, 1.00, 0.00);<br>
> lut->SetTableValue(5, 0.00, 1.00, 0.50);<br>
> lut->SetTableValue(6, 0.00, 1.00, 1.00);<br>
> lut->SetTableValue(7, 0.00, 0.50, 1.00);<br>
> lut->SetTableValue(8, 0.00, 0.00, 1.00);<br>
> lut->Build();<br>
> Now suppose I want the output like show below<br>
><br>
> 01 - 10 ==== (1.0, 0.0, 0.0)<br>
> 11 - 20 ==== (1.0, 0.5, 0.0)<br>
> 21 - 30 ==== (1.0, 1.0, 0.0)<br>
> 31 - 40 ==== (0.5, 1.0, 0.0)<br>
> 41 - 50 ==== (0.0, 1.0, 0.0)<br>
> 51 - 60 ==== (0.0, 1.0, 0.5)<br>
> 61 - 80 ==== (0.0, 1.0, 1.0)<br>
> 81 - 100 ==== (0.0, 0.5, 1.0)<br>
> 101 - 200 ==== (0.0, 0.0, 1.0)<br>
><br>
> How can this be done.?? So that the values supplied should be mapped to the<br>
> corresponding colour and should be displayed.<br>
><br>
> Thanks<br>
><br>
> Regards<br>
> Rakesh Patil<br>
</div></div></blockquote></div><br>