[vtkusers] LUT: gray scale to RGB
Bill Lorensen
bill.lorensen at gmail.com
Fri Jul 2 15:28:40 EDT 2010
Try
lut->SetRange(0.0, 100.0);
On Fri, Jul 2, 2010 at 3:07 PM, Luis Roberto P. Paula <luisrpp at gmail.com> wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list