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

Home » Public Forums » archive » Viewing unsigned int images (was: 16 bit / 8 bit depth colors on the mac)
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
Viewing unsigned int images (was: 16 bit / 8 bit depth colors on the mac) [message #7383] Thu, 07 November 1996 00:00
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
On Tue, 5 Nov 1996, David Fanning wrote:
<cut>
> Read the image data into 16-bit integers (the default
> or short IDL integer size). To convert the signed integer array to an
> unsigned integer array, you will have to convert the array to long integers,
> like this:
>
> image = INTARR(256, 256)
> READU, lun, image
> image = LONG(image) AND 'FFFF'x
<cut>

It just occurred to me that there is a way to view an unsigned int (16-bit)
image without having to convert to LONGs. (Memory may sometimes be an
issue, especially for large multiband images.)
e.g.,
image = INTARR(256, 256)
READU, lun, image ;read in the unsigned int image
f=fix(32768) ;F is a signed short int, value = -32768
image=temporary(image)+f ;remap "unsigned" values to monotonically
;increasing signed values
tvscl,image

The problem with viewing unsigned int data as if they are signed is that
values 32768 .. 65535 get interpreted (backwards!) as -32768 .. -1.
(Values 0 .. 32767 are ok.)
By subtracting 32768 from the data we're mapping to an acceptable signed
int range:
0 .. 32767 => -32768 .. -1
32768 .. 65535 => 0 .. 32767
So any operation which is concerned with the RELATIVE data range (like
TVSCL or BYTSCL) stands a chance of working on the remapped data.



Peter Mason
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: WTB: Used IDL
Next Topic: Re: gcc and idl

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

Current Time: Wed Oct 08 11:36:33 PDT 2025

Total time taken to generate the page: 0.00621 seconds