<div dir="ltr">Hi Liu Pen,<div><br></div><div>That's because I forgot to include the index argument in the call to SetTableValue:</div><div><br></div><div><div>table->SetRange(-1024, 4095);</div><div>table->SetNumberOfTableValues(4095 + 1024 + 1);</div></div><div><div>for (int i = -1024; i < -10; i++) {</div><div> table->SetTableValue(i + 1024, 0.0, 0.0, 0.0, 1.0);</div><div>}</div></div><div><br></div><div>The table index must start at zero. The call to SetRange(-1024, 4095) causes the scalar value -1024 to map to table index 0. In the "for" loop, i is the scalar value.</div><div><br></div><div> - David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 8, 2016 at 7:27 AM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, David, <br><div><br>When I try, a lot of errors are popup: "Can't set the table value for negative index".<br><br>Seems the negative grayscale needs some transformation.<br><br>Thanks<br>Liu Peng<br><br></div><span class="">
<span>
</span>
<br> 在2016-03-08,"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> 写道:
</span><blockquote style="padding-left:1ex;margin:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><span class="">
-----原始邮件-----<br>
<b>发件人:</b>"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> <br>
<b>发送时间:</b>2016年03月8日 星期二<br>
<b>收件人:</b>"Liu_tj" <<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>><br>
<b>抄送:</b>"vtkusers" <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
<b>主题:</b>Re: [vtkusers] How to map negative grayscale to color?<br>
<br></span><div><div class="h5"><div dir="ltr">Hi Liu Peng,<div><br></div><div>You can set individual values in the lookup table,</div><div>in order to precisely map certain scalar values to</div><div>specific colors:</div><div><br></div><div>table->SetRange(-1024, 4095);</div><div>table->SetNumberOfTableValues(4095 + 1024 + 1);</div><div>for (int i = -1024; i < -10; i++) {</div><div> table->SetTableValue(0.0, 0.0, 0.0, 1.0);</div><div>}</div><div>for (int i = -10; i <= 200; i++) {</div><div> table->SetTableValue(0.0, 1.0, 0.0, 1.0);</div><div>}</div><div>etcetera.</div><div><br></div><div> - David</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 7, 2016 at 9:31 AM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi,<br><br>I try to use the vtkLookupTable to convert the grayscale to rgb color. The image scalar range is [-1024,3071] returned by vtkImageData::GetScalarRange(). Now I want to convert specific grayscale range, for example, [-10,200] to one color, such as green (RGB is 0,1,0). How to do that by vtkLookupTable? I have no idea what method should call: SetNumberOfTableValues(), SetRange(), SetHueRange(), SetValueRange(). What do "Hue" and "Value" stand for?<br><br>BR,<br>Liu Peng<br></div></blockquote></div><br></div></div></div>
</div></div></blockquote><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br></div>