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

Home » Public Forums » archive » Re: WORD 16 bit unsigned?
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: WORD 16 bit unsigned? [message #11288] Sat, 28 March 1998 00:00
hdsfkj is currently offline  hdsfkj
Messages: 12
Registered: March 1998
Junior Member
I was more concerned with space considerations actually. I'm reading in
images from a 16bit
resoluton 1024x1024 ccd array.

Don.
dfg@ai.mit.edu


David Kastrup wrote:

>
>
> read them into an ordinary int array (say x), then calculate
>
> ( x + 65536L * (x LT 0))
>
> --
> David Kastrup Phone: +49-234-700-5570
> Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
> Institut f�r Neuroinformatik, Universit�tsstr. 150, 44780 Bochum, Germany
Re: WORD 16 bit unsigned? [message #11331 is a reply to message #11288] Tue, 24 March 1998 00:00 Go to previous message
David Kastrup is currently offline  David Kastrup
Messages: 33
Registered: February 1998
Member
dors@gamma.physics.uiowa.edu (Eric E. Dors) writes:

> No there aren't any unsigned data types in IDL, I have talked to the
> IDL folks (David Stern) about this one, and I didn't get the
> impression that they have any intention of supporting them either.
> This can be a big problem when reading in data not created by IDL.

read them into an ordinary int array (say x), then calculate

( x + 65536L * (x LT 0))


--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f�r Neuroinformatik, Universit�tsstr. 150, 44780 Bochum, Germany
Re: WORD 16 bit unsigned? [message #11332 is a reply to message #11331] Tue, 24 March 1998 00:00 Go to previous message
dors is currently offline  dors
Messages: 8
Registered: June 1994
Junior Member
No there aren't any unsigned data types in IDL, I have talked to the
IDL folks (David Stern) about this one, and I didn't get the
impression that they have any intention of supporting them either.
This can be a big problem when reading in data not created by IDL.
They don't support 64 bit integers either. Which is annoying if you
have a DEC Alpha which is native 64 bit!!!

To represent unsigned data, you need to use the next larger size of
variable in idl, for 16 bit unsigned use the 32 bit long type of idl.
For 32 bit unsigned variables, you are out of luck, and have to use
floats or doubles in IDL.

For instance to read in data from a file which contains one unsigned
16 bit integer, read the data in as a byte array and convert to long:

openr,unit,/get_lun
x=bytarr(2)
readu,unit,x
close,unit
free_lun,unit

y=long(x(0)) + 256 * long(x(1)) ; you may have to switch x(0) and
; x(1) depending on the byte order of
; your machine. this order should
; work for DEC and PC computers


Good luck,

Eric




hdsfkj <dsfds@dsjhf.dfjk.jp> writes:

> Is there a 16 bit unsigned type in IDL? Can't find anything in the
> manual.
>
> Donald Green
> dfg@ai.mit.edu
>

--
============================================================ ================
| Eric E. Dors | Internet: eric.dors@unh.edu |
| University of New Hampshire | |
============================================================ ================
| "if free particles were truly free..." |
| "they wouldn't be represented by bras, <k| " |
| ---oh no, how did a physics joke make it in here? :^) |
============================================================ ================
Re: WORD 16 bit unsigned? [message #11335 is a reply to message #11331] Mon, 23 March 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Donald Green (dfg@ai.mit.edu) writes:

> Is there a 16 bit unsigned type in IDL? Can't find anything in the
> manual.

No. You can find an article on how to read 16-bit unsigned
integers into IDL on my web page, however.

http://www.dfanning.com/tips/unsigned_integers.html

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Wavelet Transform for imagery
Next Topic: Re: Color BMP problems

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

Current Time: Wed Oct 08 11:51:32 PDT 2025

Total time taken to generate the page: 0.01338 seconds