[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SHOWIMAGE posted (companion to SAVEIMAGE)

Liam Gumley (Liam.Gumley@ssec.wisc.edu) writes:

> I just posted a new procedure named SHOWIMAGE at
> http://cimss.ssec.wisc.edu/~gumley/imagetools.html

Really nice programs, Liam. I like them a lot. And
I'm bummed I didn't think of the idea. :-)

I have a couple of questions and a bug report. :-(

Why are you doing this in ShowImage:

    ;- Sort the color table from darkest to brightest

    table_sum = total([[long(r)], [long(g)], [long(b)]], 2)
    table_index = sort(table_sum)
    image_index = sort(table_index)
    r = r[table_index]
    g = g[table_index]
    b = b[table_index]
    oldimage = image
    image[*] = image_index[temporary(oldimage)]

I just can't figure out what this does. 

And why do you reduce the number of colors on an 8-bit 
display? Is it because a GIF image, for example, may have 
more colors than your IDL session? What if it does and you 
can't reduce the number of colors? Is there any way to 
display the GIF image correctly then?

I happened to be fooling around in IDL when this post
showed up, so I just downloaded the code and tried it
out. I'm running IDL 5.2 in 24-bit mode. I thought I 
would see how  it did on a 24-bit image, so I chose 
the rose.dat file in the IDL/examples/data directory:


It worked great, except the colors were all screwed up. :-(
The problem, of course, is that I had a color table loaded
in my IDL session (and the DECOMPOSED keyword set to 0,
naturally), and IDL took these RGB colors through
the color tables because in this Windows version of 
IDL it does that. 

Here is your code:

   ;- Display 8-bit or 24-bit image

   if info.channels eq 1 then begin

     ;- Display 8-bit image

     device, get_decomposed=current_decomposed
     device, decomposed=0
     tvlct, r, g, b
     tv, image
     device, decomposed=current_decomposed

   endif else begin

     ;- Display 24-bit image

     tv, image, true=1


But, unfortunately, you have to do the same DECOMPOSED trick
for 24-bit displays:

     ;- Display 24-bit image

   device, get_decomposed=current_decomposed
   device, decomposed=1
   tv, image, true=1
   device, decomposed=current_decomposed

But here is the REALLY good news! Your program works *perfectly*
in IDL 5.2.1, because the folks at RSI really do listen to users
sometimes, and they fixed this annoying bug! :-)

But all in all, some really nice, extremely useful software.
Thanks for taking the time to do it. I have a feeling I'm going
to be using it just about every day. :-)

Best Regards,


P.S. Martin Schultz hasn't been in contact with you, has he?
I used to hear from him several times a day for a week after
I posted new software. I hope he's not going soft back there
in Germany. :-)

David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155