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

Home » Public Forums » archive » Re: MSB, LSB?
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: MSB, LSB? [message #14441] Thu, 04 March 1999 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
David Fanning (davidf@dfanning.com) writes:

>> Height = MSB(most significant bits) * 256 + LSB(least significant bits)

Whoops! I wrote:

> height = Byte(data, 0) * 256 + Byte(data, 1)

And I probably should have written:

height = Byte(data, 1) * 256 + Byte(data, 0)

I think I wrote my test number incorrectly. :-(

You also have to pay attention to where this data was
created and what kind of machine you are working on.
For example, if this data was created on a UNIX machine
and I'm reading it on my PC, then I have to swap the
MSB and LSB when I read the data file.

OpenR, lun, filename, /Get_Lun, /Swap_If_Little_Endian

Cheers,

David

P.S. I promise in the future to get my kids off to school
BEFORE I start answering questions on the newsgroup. :-)

--
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
Re: MSB, LSB? [message #14443 is a reply to message #14441] Thu, 04 March 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
������ (raptor28@net-in.co.kr) writes:

> i want to read some datas.
> its description is below.
>
> <Description of Data>
> Spatial Resolution : 3" x 3"(about 90m)
> Number of Row and Column : 1201 x 1201
> Pixel depth : 2byte
> Height Accuracy : 1m
> File Name E127n38.img : E127 - E128, N38 - N39
> File Format : unformatted binary
> Height = MSB(most significant bits) * 256 + LSB(least significant bits)
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> i can't read this data to use IDL
> how read?


OpenR, lun, thisFile, /Get_Lun
data = IntArr(1201, 1201)
ReadU, lun, data
Free_Lun, data
height = Byte(data, 0) * 256 + Byte(data, 1)

Cheers,

David

--
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: hiding scrollbars
Next Topic: Re: Keyboard events in a widget

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

Current Time: Fri Oct 10 01:31:37 PDT 2025

Total time taken to generate the page: 1.73963 seconds