[vtkusers] Why is the image red?

David Gobbi david.gobbi at gmail.com
Mon Dec 14 16:57:22 EST 2009


On Mon, Dec 14, 2009 at 2:09 PM, David Doria <daviddoria+vtk at gmail.com> wrote:

> David G,
>
> I was looking here:
> http://www.vtk.org/doc/nightly/html/classvtkTexture.html#_details and
> I still don't see anything about the rules it uses?
>
> I checked this:
>
> vtkstd::cout << "Map through LUT? " <<
> myTexture->GetMapColorScalarsThroughLookupTable () << vtkstd::endl;
>
> and it is 0, so that should mean that the image should be displayed
> based on its actual RGB values, right? I must still be
> misunderstanding.
>
> Thanks,
>
> David D.

The MapColorScalarsThroughLookupTable is the right setting.   So I
think your problem is that your image is not of type "UnsignedChar".
Only unsigned char scalars can be directly used as colors in VTK.

Also, in your examples you should create your images with an image
source, don't create them by hand.  You're setting a bad example, and
I'm going to complain about this every time I see it (just you watch
me!)  You can use vtkImageGridSource, vtkImageGaussianSource or
vtkImageCanvasSource2D.

   David



More information about the vtkusers mailing list