[vtkusers] How to display contents of vtkImageData

CLEMENTS, ROBERT rclement at kent.edu
Fri Nov 14 10:13:43 EST 2008

 The image i created was an 8 bit image with a  single component, you need to set
grids SetNumberOfScalarComponents 3

then set each of the scalar components within the loop (which should be the rgb values making your color)  so for red;

grids SetScalarComponentFromFloat $i $p 0 0 255
grids SetScalarComponentFromFloat $i $p 0 1 0
grids SetScalarComponentFromFloat $i $p 0 2 0

this may work.  an alternate solution would be to use a lookup table on your the single component image mapping color to value.


Hi Rob,
                The data value of 0 corresponds to black, and I guess
255 will correspond to white.

How can I set this up, so that I can specify r g b color values, and
display red (255 0 0)?

Best regards,

Elvis Dowson

More information about the vtkusers mailing list