Re: integer to float? [message #12325 is a reply to message #12196] |
Mon, 13 July 1998 00:00  |
menakkis
Messages: 37 Registered: June 1998
|
Member |
|
|
"Jonas" <jonas_2@hotmail.com> wrote:
> I have an image file from our Siemens Magnetom scanner.
> the format is stored as bigendian and is originally in 32-bit float format.
> Since I'm new at this I would like some guidance in retrieving the pixel
> information in a smooth way. I have written some code like this:
> 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.
>
> It works fine, but I would prefer to convert from integer to float without
> having to save to a new file. How is that done?
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
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
|
|
|