[vtkusers] LUT: gray scale to RGB
Luis Roberto P. Paula
luisrpp at gmail.com
Fri Jul 2 15:07:02 EDT 2010
Hi All,
I have an image in gray scale. In this image, there are just three possible
values: 0, 50 and 100.
I need to set 50 to red and 100 to green, so I have created the following
lookup table:
vtkLookupTable *lut = vtkLookupTable::New();
lut->SetNumberOfColors(101);
lut->SetTableValue(0,0,0,0,0);
lut->SetTableValue(50,1,0,0,1);
lut->SetTableValue(100,0,1,0,1);
lut->Build();
And here I'm using converting this image to RGB:
vtkImageMapToColors *img1_rgb = vtkImageMapToColors::New();
img1_rgb->SetInput(img_grey);
img1_rgb->SetLookupTable(lut);
img1_rgb->SetOutputFormatToRGBA();
img1_rgb->Update();
The problem is that the pixels with values 50 and 100 are always being
converted to green, with the same intensity.
Does anyone know what I'm doing wrong?
Thanks & Regards,
Luis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100702/82f7ab8c/attachment.htm>
More information about the vtkusers
mailing list