[vtkusers] LUT: gray scale to RGB

Luis Roberto P. Paula luisrpp at gmail.com
Fri Jul 2 16:37:22 EDT 2010


Thanks Bill, It is working now!!

Regards,
Luis

On Fri, Jul 2, 2010 at 4:28 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100702/4cacbb09/attachment.htm>


More information about the vtkusers mailing list