[vtkusers] How to map negative grayscale to color?
David Gobbi
david.gobbi at gmail.com
Tue Mar 8 09:37:20 EST 2016
Hi Liu Pen,
That's because I forgot to include the index argument in the call to
SetTableValue:
table->SetRange(-1024, 4095);
table->SetNumberOfTableValues(4095 + 1024 + 1);
for (int i = -1024; i < -10; i++) {
table->SetTableValue(i + 1024, 0.0, 0.0, 0.0, 1.0);
}
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.
- David
On Tue, Mar 8, 2016 at 7:27 AM, Liu_tj <tjlp at netease.com> wrote:
> Hi, David,
>
> When I try, a lot of errors are popup: "Can't set the table value for
> negative index".
>
> Seems the negative grayscale needs some transformation.
>
> Thanks
> Liu Peng
>
>
> 在2016-03-08,"David Gobbi" <david.gobbi at gmail.com> 写道:
>
> -----原始邮件-----
> *发件人:*"David Gobbi" <david.gobbi at gmail.com>
> *发送时间:*2016年03月8日 星期二
> *收件人:*"Liu_tj" <tjlp at netease.com>
> *抄送:*"vtkusers" <vtkusers at vtk.org>
> *主题:*Re: [vtkusers] How to map negative grayscale to color?
>
> Hi Liu Peng,
>
> You can set individual values in the lookup table,
> in order to precisely map certain scalar values to
> specific colors:
>
> table->SetRange(-1024, 4095);
> table->SetNumberOfTableValues(4095 + 1024 + 1);
> for (int i = -1024; i < -10; i++) {
> table->SetTableValue(0.0, 0.0, 0.0, 1.0);
> }
> for (int i = -10; i <= 200; i++) {
> table->SetTableValue(0.0, 1.0, 0.0, 1.0);
> }
> etcetera.
>
> - David
>
>
> On Mon, Mar 7, 2016 at 9:31 AM, Liu_tj <tjlp at netease.com> wrote:
>
>> Hi,
>>
>> 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,
>> Liu Peng
>>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160308/1a023b6a/attachment.html>
More information about the vtkusers
mailing list