ascii2biff
[ XITE Reference Manual | XITE home ]
Contents
Name
ascii2biff - convert an ascii file to BIFF format
#include <xite/convert.h>
int ascii2biff( IBAND* band, char* asciifile,
IPIXTYP pixtyp );
ascii2biff reads asciifile and returns a band of
pixtyp. asciifile = - or NULL means stdin.
If the file contains $size info, use this. Otherwise, count
the number of elements on each line. Does it look like an
m x n matrix? If yes, assign m to ysize and n to xsize.
Otherwise return an error message.
If pixtyp is equal to Iunknown_typ, use the $type
info in the file, otherwise set type to signed short.
The file is an ordinary ascii file. Comments start with a
# or a ; and stop at end of line. Blank lines or comment
lines are ignored. Lines with $ in coloumn 1 is treated as
special arguments. The format is
$<keyword> <1 or 2 arguments>
where <keyword> is one of "type", "size", "xsize", "ysize",
"start", "xstart", "ystart", "mag", "xmag" or "ymag".
The format for each <keyword> is:
$type <uns_byte | uns_short | sign_short | integer | real>
$size <xsize> <ysize>
$xsize <xsize>
$ysize <ysize>
$start <xstart> <ystart>
$xstart <xstart>
$ystart <ystart>
$mag <xmag> <ymag>
$xmag <xmag>
$ymag <ymag>
The keywords will be used as image band arguments. If the size
arguments are omitted, the size is calculated from the
organization of the file. Default start arguments are
-(size/2), and default mag arguments are 1.
Pixels inside a line are separated by blanks. Lines are
separated by newline. If pixel type is uns_byte, uns_short,
sign_short or integer, the special value - means lowest legal
value, and + means largest legal value.
-
Example 1
-
#
$ size 4 3
3 5 6 4 3 2
7 5 3 2 1 3
The resulting image:
#
# 3 5 6 4
# 3 2 7 5
# 3 2 1 3
#
-
Example 2
-
#
3 5 6 4
3 2 7 5
3 2 1 3
The resulting image:
#
# 3 5 6 4
# 3 2 7 5
# 3 2 1 3
0 - OK
1 - Not used
2 - Can't find file
3 - Bad pixeltype
4 - Bad xsize or ysize
5 - Can't calculate image size
6 - Not enough memory
Otto Milvang