[vtkusers] Convert grayscale image to rgb

David Cole dlrdave at aol.com
Wed Jun 4 07:34:18 EDT 2014


> Hi David. Thank you very much for the example, it did push me a bit
> further. Another thing, I have a number of
> 16bit grayscale images that also need converting. In what way should
> I modify the lookup table to accommodate these files?

See the updated example which I've put on the wiki now:

    http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageMapToColors

You can use any of the classes that derive from vtkScalarsToColors as
the lookup table.

    http://www.vtk.org/doc/nightly/html/classvtkScalarsToColors.html

If you just use vtkLookupTable as in the example, you can just modify
the arguments to the SetRange call to cover whatever range of grayscale
values you want to map to color. Anything lower than the lower arg will
map to the lowest color, and anything higher than the higher arg will
map to the highest color... in between values get interpolated.

    http://www.vtk.org/doc/nightly/html/classvtkLookupTable.html

Please keep replies on the list so others may also benefit from the
discussion.


Thanks,
David C.




More information about the vtkusers mailing list