Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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/
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
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? :^) | ============================================================ ================
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