Re: WORD 16 bit unsigned? [message #11288] |
Sat, 28 March 1998 00:00 |
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  |
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  |
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? :^) |
============================================================ ================
|
|
|
|