STScI logoSTSDAS Help Pages
bin2iraf ctio bin2iraf

NAME · USAGE · PARAMETERS · DESCRIPTION · EXAMPLES · BUGS · SEE_ALSO

NAME

bin2iraf -- Convert binary files into IRAF images

USAGE

bin2iraf files images nlines ncols

PARAMETERS

files
Input file list.
images
Output image list. This list should be equal in length to the list of input files.
nlines
Number of lines in the output image. If the number of lines is one the output images will be one dimensional. Otherwise they will be two dimensional.
ncols
Number of columns in the output image.
nskip = 0
Number of bytes to skip before reading the pixel data. This parameter allows skipping of header data that might be at the begging of the file.
data_type = "ubyte"
File data type. It can take the following values: ubyte for unsigned bytes, ushort for unsigned short integers, short for short integers, int for integers, long for long integers, and real for reals. The actual number of bits used to represent of these numbers is machine dependent, although normally a byte is eight bits long, a short is sixteen bits long, and an int and a long are thirty two bits long, and a real is also thirty two bits long.
swap = "none"
Byte swap mode. It can take the following values: none to leave data untouched, swap2 to swap every two bytes, and swap4 to swap every four bytes. A byte in this case is always eight bits long. With swap2 the hexadecimal input sequence "0123456789ABCDEF" is converted into "23016745AB89EFCD", and with swap4 the same sequence is converted into "67452301EFCDAB89". The line length should be a multiple of two when swapping every two bytes, and a multiple of four when swapping every four bytes.

DESCRIPTION

This task takes a list of binary files and converts them into IRAF images. The image title will be set to the name of the corresponding input file. The output image data type is chosen automaticaly by the task depending on the file data type. It will be short for file types ubyte , ushort , and short ; int for file type int ; and long for file type long . The task can optinally swap bytes when reading each input line from a file.

EXAMPLES

1.- Convert a binary file containing unsigned bytes, into a 32 by 8 IRAF image, without byte swapping. List the image header afterwards:


ct> bin2iraf file.bin image.imh 32 8 data_type=ubyte swap=none
ct> imheader image long+
image[32,8][short]: file.bin
    No bad pixels, no histogram, min=unknown, max=unknown
    Line storage mode, physdim [32,8], length of user area 1 s.u.
    Created Mon 17:03:23 05-Nov-90, Last modified Mon 17:03:24 05-Nov-90
    Pixel file 'ctiol2!/ul21/iraf/iraf/imageaa.pix' [ok]

2.- Convert two binary files containing integers, into two 32 by 32 IRAF images, swapping data every two bytes:

ct> bin2iraf file1.bin,file2.bin image1,image2 \
>>> 32 32 data_type=int swap=swap2

3.- Convert a binary file containing bytes, into a 512 by 320 IRAF image, skipping the first 128 bytes, and without byte swapping:

ct> bin2iraf file.bin image.imh 512 320 nskip=128 data_type=ubyte swap=none

BUGS

The number of bytes to skip at the beginning of the files MUST be an integral multiple of SZB_CHAR (the size of an SPP character in bytes). SZB_CHAR is a machine dependent number defined in hlib$mach.h, normally equal to two bytes.

SEE ALSO

iraf2bin


Source Code · Search Form · STSDAS

Maintained by the Science Software Group at STScI
This file last updated on 9 Jul 1993