.help irafil mar86 proto
.ih
NAME
irafil -- converts a binary file containing pixel values to an IRAF image
.ih
USAGE
irafil input nrows ncols
.ih
PARAMETERS
.ls input
the input file names to be converted
.le
.ls nrows
the number of rows of data in the image
.le
.ls ncols
the number of columns of data in the image
.le
.ls bits = 16
the number of data bits per pixel. This must be either 8 or 16
.le
.ls signed = yes
the pixels are assumed to be signed integers if the bits parameter is 16,
and unsigned if the bits parameter is 8. If signed is set to no, then
the 16 bit pixels will be treated as unsigned integers and the resultant
image will be of type long integers.
.le
.ls tb_flip = no
This parameter allows the image to be "top-to-bottom" flipped during
conversion.
.le
.ls skip = 0
the number of bytes to skip prior to reading pixel data. This allows
skipping of header data which is otherwise not translatable and would
be confused with the pixel data.
.le
.ih
DESCRIPTION
The specified files are read as integers and converted to IRAF images.
The specified number of header bytes will be skipped, and the specified
data format, 8 or 16 bit pixels, at the rate of ncols by nrows will be
read. Signed data or 8 bit data will be placed into images having data
type short. Unsigned 16 bit pixels will be converted into images of
type long.

The resultant images will be assigned the same name as the input file,
but with ".i" appended to indicate IRAF format.

The tb_flip parameter should be set to yes when converting the "snap"
format files from the Compaq image display station, or other devices
which refer to the first row as inverted from the usual IRAF notation.

This utility is capable of converting a large number of strange
image formats to IRAF images. By skipping any initial header, and specifying
a value for ncols equal to either the row length of the image, or the
number of pixels used in the foreign internal format, almost any
16-bit format can be read. For example, FORTH pictures can be read
by skipping the initial 2048 bytes and reading the pixels assuming
a row length of 1024, even if the actual row length is shorter. There
will be garbage pixels at the end of each row which can be trimmed
with IMCOPY using picture sections. An absurd example is to read an
IRAF pixel file by skipping 1024 bytes and reading with a row length of
1024 [at least for the 800 pixel image I tried].

Since no byte swapping is performed, a foreign tape format must be byte swapped
if necessary prior to using IRAFIL. This may be done with REBLOCK in the
dataio package.
.ih
EXAMPLES

1. Say you've deleted your header file to an IRAF image. The pixel file
is pix3034x. Assuming the pixels are short integers, the image is
10 rows by 800 columns:

.nj
.nf
lo> irafil pix3034x 10 1024 skip=1024
lo> imcopy pix3034x.i[1:800,*] phoenix
.fi
.ju

The first line creates the IRAF image pix3034x.i which is readable
by IRAF tasks, but has 1024 pixels per row. The real image only
has 800 pixels per row, but we had to read it this way because of the
way pixels are stored in IRAF images. So we IMCOPY the good part of
the picture to the new IRAF image we call phoenix.

2. To read the "snap" format pictures from the Compaq station:

.nj
.nf
lo> irafil m82.snp 512 512 tb_flip+ bits=8
.fi
.ju

This will create the IRAF image m82.snp.i which can then be run
through CRTPICT to make a Dicomed hardcopy.
.ih
TIME REQUIREMENTS
.ih
BUGS
There is no way to explicitly specify the output image name.
.ih
SEE ALSO
binfil,imcopy,reblock
.endhelp
