[vtkusers] Convert grayscale image to rgb

David Gobbi david.gobbi at gmail.com
Sat May 31 11:44:27 EDT 2014


Use vtkImageMapToColors, here is a python example of
how to set it up:

rgbConverter = vtkImageMapToColors()
rgbConverter.SetOutputFormatToRGB()
rgbConverter.SetLookupTable(vtkScalarsToColors())

The "vtkScalarsToColors" object describes how the
mapping of scalars to colors is done.  By default, it just
replicates the scalar into the r, g, and b components.

  David


On Sat, May 31, 2014 at 9:21 AM, Milan Vidakovic <milan.vidakovic at tp.rs> wrote:
> I have a number of single-scalar grayscale vtkImageData objects that would
> need to convert to rgb. Is there a way to perform this transformation
> without loosing the grayscale information? Even a change from grayscale to
> mono-color would do the trick.
>
> Thank you!
> Milan


More information about the vtkusers mailing list