comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Plot two images in different color
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Plot two images in different color [message #6681] Tue, 30 July 1996 00:00
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
> I want to plot two images (2-d bytarr) in one window. The background
> is black. Thus one image should be in white color while another one
> is in red color. I know how to load the color table.
> The routine I use to plot image is tv or tvscl.

It is fairly easy to display 2 (or more) images simultaneously on an
8-bit display. (I assume that you're using an 8-bit display.) The
most straightforward way is to reduce the #colours in each image so that
you can construct a compound LUT:
. For simplicity, assume that the images have no common colours;
. Find out how many colours are available, also considering the number you
want to use "globally" (e.g., for the background and annotation);
. Set up and load a LUT for your global colours and for each image's
colours;
. Rescale each image to map to its section in the LUT;
. TV the images.

e.g., Your case where you have 2 "simultaneous" byte images - the first
in greyscale and the second in "redscale". For simplicity you might not
even use a global black - just include black twice (once for each image).
NC= !D.N_COLORS ;but must first have initialised IDL's display system
NC2=NC/2 ;half avail colours for each image
FAC=255.0/(NC2-1.0) ;colour scaling factor
J=BYTE(FINDGEN(NC2)*FAC) ;common stuff for sub-luts
Z=BYTARR(NC2) ;"zero" stuff for sub-luts
TVLCT,[J,J],[J,Z],[J,Z] ;load compound grey/red LUT
TV,grey_img/FAC ;grey image rescaled 0..255 => 0..NC2-1
TV,red_img/FAC +NC2 ;red image rescaled 0..255 => NC2..NC-1

It is important that IDL's display system be initialised before you look
at !D.N_COLORS, otherwise you'll find it to show 256 (incorrectly) instead
of 232 or so. One way to ensure this is to use something like:
window,/free,xsiz=16,ysiz=16,/pixmap &wdelete,!d.window
shortly after starting IDL. If you want to squeeze the most out of
IDL's display then use the WINDOW command's COLORS switch, e.g.,
window,/free,xsiz=16,ysiz=16,/pixmap,colors=-1 ;leave 1 colour for other apps



Peter Mason
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: An IDL Satellite Image Mapping Tool
Next Topic: reading a series of image files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:33:27 PDT 2025

Total time taken to generate the page: 0.00623 seconds