[vtkusers] Convert grayscale image to rgb

Milan Vidakovic milan.vidakovic at tp.rs
Sat May 31 11:58:19 EDT 2014


Thank you for a quick response. I did try it, and the scalar space does
increase to rgb, but my output is completely black. My vtkScalarsToColors
might be lacking something. The code is:

vtkSmartPointer<vtkScalarsToColors> scalarsToColors =
 vtkSmartPointer<vtkScalarsToColors>::New();

vtkSmartPointer<vtkImageMapToColors> colorMapper =
vtkSmartPointer<vtkImageMapToColors>::New();
firstColorMapper->SetOutputFormatToRGB();
firstColorMapper->SetInputData(myImageVtkImageData);
firstColorMapper->SetLookupTable( scalarsToColors );


On Sat, May 31, 2014 at 5:44 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140531/eb2d54e0/attachment.html>


More information about the vtkusers mailing list