lviff2big(3)

LIBRARY ROUTINE
lviff2big - Converts VIFF file format to BIG image file format

LIBRARY CALL
#include "vinclude.h"
int lviff2big(viff_image, big_image)
struct  xvimage *viff_image;
struct  big **big_image;

INPUT

    struct xvimage *viff_image - input image to be converted

OUTPUT

    struct big **big_image - resulting big image.

MODIFICATIONS
Ghosted By Pascal ADAM 14-JUNE-90

DESCRIPTION
viff2big is a routine that converts a BIG image file format into a VIFF file format. The BIG image file format describes the image format used by Terra-Mar MicroImage. This format is based on record sizes of 512.

Record 1 contains all the header information. The remaining records, beginning with record 2 store image data one scanline at a time in (BIL) band-interleaved-by-line format for any number of bands. Since a scanline has a variable number of pixels depending on the original data, each scanline is divided into an appropriate number of records (512 pixels per record). If the number of pixels per scanline is not evenly divisible by 512, then the last record for each line will contain the remainder for that line; it will be only partially full. Note, records are padded to a length of 512.

The Band-Interleaved-By-Line order means that the first scanline of the first band is stored first. It is followed by the first scanline of the second band, third band, fourth band, and so on up to the last band avaliable. This order then repeats for the second scanline, the third scanline and so on.

The image header is assigned as follows:
Bytes[1-22]     reserved1[22];          /* Reserved                      */
Bytes[23]       data_type;              /* 'L' -> MSS data               */
                                        /* 'T' -> TM data                */
                                        /* 'S' -> SPOT data              */
Bytes[24]       reserved2;              /* Reserved                      */
Bytes[25-26]    num_channels;           /* Number of Channels/Bands      */
Bytes[27-28]    start_line_num;         /* Starting Line Number          */
Bytes[29-30]    start_pixel_num;        /* Starting Pixel Number         */
Bytes[31-32]    num_lines;              /* Number of Lines (row size)    */
Bytes[33-34]    num_pixels_line;        /* Number of Pixels per Line     */
                                        /*     (column size)             */
Bytes[35-36]    reserved3[2];           /* Reserved                      */
Bytes[37-38]    reserved4[2];           /* Reserved                      */
Bytes[39-119]   title[80];              /* Title of Image                */
Bytes[120-121]  records_line;           /* Records_Per_Line (rounded up) */
Bytes[122-512]  reserved5[392];         /* Reserved                      */

The image type for the BIG image file format is set by the number of bands:

1.  If the number of bands is less than or equal to 3 the image type is set to 'S' = SPOT.

2.  If the number of data bands is greaterr than 3 the image type is set to 'L' = MSS.

IMPORTANT

The utilities used to read and write the BIG image file are machine dependent. WE ASSUME THAT THE BIG IMAGE WILL ALWAYS BE IN LITENDIAN BYTE FORMAT, since the Terra-Mar Image processing system runs under DOS on a PC. This means that a machine that uses bigendian byt order (i.e. sun, sony, etc) must byte swap some fields in the image header. So, a #if has been placed in the code to allow conversion between litendian byte order and bigendian byte order.

The only file that has machine dependencies is big.c in the file formats library (libfile_formats.a).

1. The not define flag
    This routine can be compiled so that it is not machine dependent by using -DNMD option. NMD stands for not machine dependent. When compiled with this option the bigendian to litendian conversion is not performed.

2. defines for machine dependencies
    The defines for machine dependencies (conversion to and from bigendian) are sun, bigendian, and ieeeorder. So big.c can be compiled with -Dbigendian. Note, when compiling on a sun machine, sun is defined so the conversion code from bigendian to litendian will be be compiled. If it is unwanted see 1. above.

SEE ALSO
viff2big(1), intro(3), vipl(3), verror(3), vutils(3) file_formats(3)

RESTRICTIONS

The input image must be of data storage type BYTE.

AUTHOR
Mark Young, Tom Sauer

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.