Re: integer to float? [message #12310 is a reply to message #12196] |
Tue, 14 July 1998 00:00   |
Jonas
Messages: 23 Registered: May 1998
|
Junior Member |
|
|
menakkis@my-dejanews.com skrev i meddelandet
<6obm1m$dba$1@nnrp1.dejanews.com>...
> "Jonas" <jonas_2@hotmail.com> wrote:
>> Read image information to vector as 32-bit integer
>> perform byte-swap
>> save in new file as byte
>> read new file as 32-bit float and sort the data to a complax array.
> I don't quite see what you are up to here. If I'm reading between the
lines
> correctly, it seems that your image is not actually FLOAT but
> single-precision complex, and you are uncertain about how BYTEORDER will
deal
> with complex. Either way, you can perform the byte re-ordering without
using
> a temporary file. Simply read the original image into an array of the
> correct type (FLOAT or COMPLEX?) and then do:
> BYTEORDER,my_image_array,/LSWAP
>
> This will do the proper byte order reversal (genuine bigendian to genuine
> smallendian) for LONG, FLOAT or (single-precision) COMPLEX.
>
>
> Peter Mason
>
Thanx Peter!
My problem was that I did not realise that the BYTEORDER procedure worked on
single-precision complex. Instead of reading the original file into a
complex array at once and perform BYTEORDER, I used quite a detour:
read the file as long integer, performed the byte swap (using byteorder),
saved as byte, read to vector as float, separated to real and imaginary
arrays, joined to a complex array.
Thanxalot (again), this group is a gold mine for a total newbie like me,
keep up the good work guys...
Jonas
|
|
|