[vtkusers] colour jpg image with vtkJPEGwriter

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Mon Jun 23 14:17:01 EDT 2003


>>>>> "AGC" == Adam G Chandler <Adam> writes:

    AGC> At presnt the jpg image that i get out is only in a black and
    AGC> white scale. Is there some way that i can apply a colour
    AGC> lookup table to the jpg image, so that the scale is between
    AGC> red (for high values) and blue(for low values) for example?

Yes, you can.  If you have an array of the scalar values then
construct an appropriate vtkLookupTable instance and use its
MapScalars method to get a scalar array with 4 components of unsigned
chars that represent the colors.  You can then use this scalar array
and associate it with your dataset and generate your image.  For a
Python example look at imv.py from here:

  http://av.stanford.edu/~prabhu/software/mayavi.html

Specifically, look at the viewi function.

cheers,
prabhu



More information about the vtkusers mailing list