Hi David,<br><br>It can be done by repeating colors as you say. But how do I identify the number of table values? Because the values<br>10<br>20<br>30<br>40<br>50<br>60<br>80<br>100<br>200<br><br>is entered by user. and user may enter any value like,<br>
<br>10<br>20<br>30<br>35<br>40<br>45<br>70<br>90<br>100<br>200<br><br>In this case, number of table values will be more (i.e. @ interval of 5). Well, I&#39;ll just give a try. Number of colors should remain same in either case right? only number of table values will vary. Am I correct..??<br>
<br>Thanks <br><br>Regards<br>Rakesh Patil<br><br><div class="gmail_quote">On Tue, Feb 22, 2011 at 2:41 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</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>
You can&#39;t change the fact that the binsize is uniform.  But I don&#39;t<br>
understand why you don&#39;t just repeat the colors:<br>
<div class="im"><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>
70     ==== (0.0, 1.0, 0.5)<br>
80     ==== (0.0, 1.0, 1.0)<br>
90     ==== (0.0, 1.0, 1.0)<br>
100   ==== (0.0, 0.5, 1.0)<br>
</div>110   ==== (0.0, 0.0, 1.0)<br>
... ditto for 120 to 190 ...<br>
<div class="im">200   ==== (0.0, 0.0, 1.0)<br>
<br>
</div> - David<br>
<br>
On Tue, Feb 22, 2011 at 12:58 AM, rakesh patil<br>
<div><div></div><div class="h5">&lt;<a href="mailto:prakeshofficial@gmail.com">prakeshofficial@gmail.com</a>&gt; wrote:<br>
&gt; Hey David,<br>
&gt;<br>
&gt; Thanks for that explanation. Now it&#39;s bit clear about how lookup table<br>
&gt; works. But in my case, I guess, binsize is not uniform. Let me put it in<br>
&gt; this form<br>
&gt;<br>
&gt; 10     ==== (1.0, 0.0, 0.0)<br>
&gt; 20     ==== (1.0, 0.5, 0.0)<br>
&gt; 30     ==== (1.0, 1.0, 0.0)<br>
&gt; 40     ==== (0.5, 1.0, 0.0)<br>
&gt; 50     ==== (0.0, 1.0, 0.0)<br>
&gt; 60     ==== (0.0, 1.0, 0.5)<br>
&gt; 80     ==== (0.0, 1.0, 1.0)<br>
&gt; 100   ==== (0.0, 0.5, 1.0)<br>
&gt; 200   ==== (0.0, 0.0, 1.0)<br>
&gt;<br>
&gt; in this case, bin size is not equal to (max-min)/n. I mean, lookup table<br>
&gt; might calculate it like that. But If dont want in that way, then what<br>
&gt; changes I have to do to implement? May be I am wrong in understanding the<br>
&gt; meaning of binsize. Please correct me if I&#39;m wrong.<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
&gt; Regards<br>
&gt; Rakesh Patil<br>
&gt;<br>
&gt; On Tue, Feb 22, 2011 at 11:58 AM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Rakesh,<br>
&gt;&gt;<br>
&gt;&gt; The way that the lookup table maps values to colors is as follows:<br>
&gt;&gt; If the Range of the table is set to [min,max] and the number of colors<br>
&gt;&gt; in the table is n, then the equation that maps a value &quot;v&quot; to an<br>
&gt;&gt; index &quot;i&quot; is:<br>
&gt;&gt;<br>
&gt;&gt;  i = floor((v - min)*n/(max - min))<br>
&gt;&gt;<br>
&gt;&gt; The bin size is uniform and equal to (max - min)/n.  Values in the<br>
&gt;&gt; range [min, min + binsize] go into the first bin (and values less than<br>
&gt;&gt; min also go into the first bin).<br>
&gt;&gt;<br>
&gt;&gt; Since the bins are uniform in size, you will need a table with 20 values<br>
&gt;&gt; and a binsize of 10, and some of the colors will have to be repeated.<br>
&gt;&gt; Use lut-&gt;SetTableRange(0.5, 200.5), where the &quot;.5&quot; is for rounding.<br>
&gt;&gt;<br>
&gt;&gt;  - David<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Mon, Feb 21, 2011 at 10:35 PM, rakesh patil<br>
&gt;&gt; &lt;<a href="mailto:prakeshofficial@gmail.com">prakeshofficial@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Hello,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I have to display contours, for a given range, by mapping values to<br>
&gt;&gt; &gt; colours.<br>
&gt;&gt; &gt; i.e. Consider I need to display contours between 1 and 200.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I use the lookuptable as follows<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; vtkSmartPointer&lt;vtkLookupTable&gt; lut =<br>
&gt;&gt; &gt; vtkSmartPointer&lt;vtkLookupTable&gt;::New();<br>
&gt;&gt; &gt; lut-&gt;SetNumberOfTableValues(9);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(0, 1.00, 0.00, 0.00);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(1, 1.00, 0.50, 0.00);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(2, 1.00, 1.00, 0.00);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(3, 0.50, 1.00, 0.00);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(4, 0.00, 1.00, 0.00);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(5, 0.00, 1.00, 0.50);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(6, 0.00, 1.00, 1.00);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(7, 0.00, 0.50, 1.00);<br>
&gt;&gt; &gt; lut-&gt;SetTableValue(8, 0.00, 0.00, 1.00);<br>
&gt;&gt; &gt; lut-&gt;Build();<br>
&gt;&gt; &gt; Now suppose I want the output like show below<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 01 - 10     ==== (1.0, 0.0, 0.0)<br>
&gt;&gt; &gt; 11 - 20     ==== (1.0, 0.5, 0.0)<br>
&gt;&gt; &gt; 21 - 30     ==== (1.0, 1.0, 0.0)<br>
&gt;&gt; &gt; 31 - 40     ==== (0.5, 1.0, 0.0)<br>
&gt;&gt; &gt; 41 - 50     ==== (0.0, 1.0, 0.0)<br>
&gt;&gt; &gt; 51 - 60     ==== (0.0, 1.0, 0.5)<br>
&gt;&gt; &gt; 61 - 80     ==== (0.0, 1.0, 1.0)<br>
&gt;&gt; &gt; 81 - 100    ==== (0.0, 0.5, 1.0)<br>
&gt;&gt; &gt; 101 - 200  ==== (0.0, 0.0, 1.0)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; How can this be done.?? So that the values supplied should be mapped to<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; corresponding colour and should be displayed.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Regards<br>
&gt;&gt; &gt; Rakesh Patil<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>