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

Home » Public Forums » archive » Importing Binary Images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Importing Binary Images [message #28969 is a reply to message #28873] Fri, 18 January 2002 09:05 Go to previous messageGo to previous message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
"rob schick" <rschick@neaq.org> wrote in message
news:240cd6d2.0201180638.46419bb3@posting.google.com...
> I'm new to idl, and am trying to import a binary grid that was created
> on a windows machine into idl on a linux machine. It's least
> significant byte first, 1561 rows, 2041 cols.
>
> I searched the archives and found a thread that suggested used the
> following syntax:
>
> IDL> openr, 1, 'gom15dd.dat'
> IDL> ms = bytarr(1561, 2041)
> IDL> readu, 1, ms
> IDL> tv, ms
>
> While this 'works', the image displayed is incorrect - sort of looks
> like speckled white noise. Any thoughts on what I may be doing wrong.
> For a newbie, what's the difference between using readu, and
> read_binary? The online help didn't help. Thanks.

Rob, I am a little confused (nothing new for a friday afternoon). Do you
mean you have BYTE data of size 1561 x 2041? If so then to my knowledge
there is no byte swapping issue. Endian-ness comes into play with data types
which are larger than one byte, eg INT, LONG, FLOAT etc. With these types
you swap the byte pairs from unix to windows, idl does this for you with the
routine:
unix_data = SWAP_ENDIAN(win_data)

If you know the file derives from windows (little endian), you can add a
keyword to the openr command:

openr, lun, filename, /SWAP_IF_LITTLE_ENDIAN

you then do not have to worry about swapping, as long as you read the data
in as the correct data type.
readu is the basic binary read for variables.

It would be a good idea to check exactly what type of data you have in this
file, start by checking its file size in bytes and seeing how many multiples
of (1561x2041) you have. If 1 then it really is bye, If 2 then its INT or
UINT, if 4 then it is LONG, ULONG or FLOAT
hope this helps

good luck

Martin
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: In case someone has trouble including export.h
Next Topic: Question again :)

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

Current Time: Fri Oct 10 01:48:12 PDT 2025

Total time taken to generate the page: 0.72016 seconds