elas2viff(1)

PROGRAM
elas2viff - Converts an ELAS file format to the VIFF image file format.

SYNTAX

elas2viff

-i  input ELAS data file

-o  resulting output image (viff file)

[-b]
    band number

[-x]
    upper left x coordinate

[-y]
    upper left y coordinate

[-w]
    width

[-h]
    height

[-c]
    select color space model:
    0 (no model),
    1 (ntscRGB model),
    2 (ntscCMY model),
    3 (ntscYIQ model),
    4 (HSV model),
    5 (HLS model),
    6 (IHS model),
    7 (cieRGB model),
    8 (cieXYZ model),
    9 (cieUVW model),
    10 (cieucsUVW model),
    11 (cieucsSOW model),
    12 (cieucsLab model),
    13 (cieucsLuv model),
    14 (GENERIC model),
    or 15 (genericRGB model)
       [default = 0]

[-V]
    Gives the version for elas2viff

[-U]
    Gives the usage for elas2viff

[-P]
    Prompts for command line options

[-A [file1]]
    Creates the answer file called elas2viff.ans or file1

[-a [file1]]
    Uses elas2viff.ans or file1 as the answer file

DESCRIPTION
elas2viff is a routine that converts an ELAS image file format into a VIFF file format. The ELAS image file format describes the image format used by the ELAS Image system.

An ELAS image usually contains more than one channel or band of information, although it can exist as a single band image. This routine performs the conversion from the ELAS image format to the VIFF image format one band at a time. That is, only one band can be converted at a time. Additionally, an option is provided which allows for the conversion of a selected area of the ELAS image. This is accomplished by specifying the starting x and y coordinates along with the desired width and height of the resulting image. If no subimage information is provided, then the entire band is converted to the VIFF format. Another option allows for the selection of the desired color space model of the resulting image.

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. Each record contains one scan line of one channel, thus each record corresponds to a new scan line for a particular channel.

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 format is according to the following scheme:
     Record Number         Data Description
     ------------          ----------------
           1               Header Record
           2               Scan line 1, channel 1
           3               Scan line 1, channel 2
           4               Scan line 1, channel 3
           5               Scan line 2, channel 1
           6               Scan line 2, channel 2
           .                        .
           .                        .
           .                        .

Note that the terminology for band and channel is used interchangably, The term band is typically used in the conventional image processing community, while channel is commonly used in the remote sensing community. Scan line here refers to one row of the image.

The image header for the ELAS image file format is as follows:
 BYTES      TYPE                DESCRIPTION
-------     ----    -------------------------------------------
[1-4]       int     (NBIH) Number of bytes in header.
[5-8]       int     (NBPR) Number of bytes per record.
[9-12]      int     (IL)   Initial line of data file.
[13-16]     int     (LL)   Last line of data file.
[17-20]     int     (IE)   Initial element of each scan line.
[21-24]     int     (LE)   Last element of each scan line.
[25-28]     int     (NC)   Number of channels (bands).
[29-32]     int     (4321) Header record identification.
[33-36]     ASCII   Grid descriptor for Y-axis: NOR, LSNL, etc.
[37-40]     int     Y-Offset: Y-coordinate value for scan line 0.
[41-44]     ASCII   Grid descriptor for X-axis: EAS, LNSE, etc.
[45-48]     int     X-Offset: X-coordinate value for element 0.
[49-52]     float   Y Spot size, or pixel element height.
[53-56]     float   X Spot size, or pixel element width.
[57-72]     float   Transformation matrix (linear) from line and
                     column (IL, LL, IE, LE) coordinates to the
                     coordinates described by the grid descriptors.
                       1., 0., 0., 1. =  identity transformation
                       1., 0., 0., -1. = data in UTM format
[73-84]     ---     Not Used.
[85-88]     int     (Eikonix) Used by modules RFEKDA and VEKS.
[89-92]     int     (LABL) Used by module LABL.
[93-96]     ASCII   (HEAD) Used by module HEAD.
[97-480]    ASCII   Comments - 6 lines at 64 characters each or
                     96 4-character descriptiors for data base use.
[481-992]   int     Color Table (color map)
[993-1024]  ---     Not Used.

The following fields in the VIFF image header are set as follows:

1.  data_storage_type = BYTE (VFF_TYP_1_BYTE)

2.  data_encode_scheme = RAW (VFF_DES_RAW)

3.  map_scheme = NONE (VFF_MS_NONE)

4.  map_enable = OPTIONAL (VFF_MAP_OPTIONAL)

5.  location_type = NONE

6.  num_images = 1

The remaining fields are obtained from the ELAS image header.

IMPORTANT

The utilities used to read and write the ELAS image file are machine dependent. WE ASSUME THAT THE ELAS IMAGE WILL ALWAYS BE IN LITENDIAN BYTE FORMAT. This means that a machine that uses bigendian byte order (i.e. sun, sony, etc) must byte swap some fields in the image header. So, the code allows conversion between litendian byte order and bigendian byte order.

The only file that has machine dependencies is elas.c in the file format 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 elas.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.

REQUIRED ARGUMENTS

-i  type: infile
    desc: input ELAS data file

-o  type: outfile
    desc: resulting output image (viff file)

OPTIONAL ARGUMENTS

-b  type: integer
    desc: band number
    default: 0
    bounds: no range checking

-x  type: integer
    desc: upper left x coordinate
    default: 0
    bounds: value >= 0

-y  type: integer
    desc: upper left y coordinate
    default: 0
    bounds: value >= 0

-w  type: integer
    desc: width
    default: 128
    bounds: value > 0

-h  type: integer
    desc: height
    default: 128
    bounds: value > 0

-c  type: integer
    desc: select color space model
    allowed values:
    0 (no model),
    1 (ntscRGB model),
    2 (ntscCMY model),
    3 (ntscYIQ model),
    4 (HSV model),
    5 (HLS model),
    6 (IHS model),
    7 (cieRGB model),
    8 (cieXYZ model),
    9 (cieUVW model),
    10 (cieucsUVW model),
    11 (cieucsSOW model),
    12 (cieucsLab model),
    13 (cieucsLuv model),
    14 (GENERIC model),
    or 15 (genericRGB model)

EXAMPLES
elas2viff -i image.elas -o image.viff -c 1

This will convert an image in the ELAS image file format to an image in VIFF image file format, and set the color space model to ntscRGB. Since no band number was specified, the first band (b = 0) will be converted.

elas2viff -i image.elas -o image.viff -b 2 -x 100 -y 50 -w 256 -h 256

This will convert the third band of the ELAS image starting at location x=100 and y=50 to a VIFF image. The resulting dimensions of the VIFF image will be 256 by 256, and it will have a color space model of NONE.

SEE ALSO
intro(1), verror(3), vgparms(3), vutils(3), lelas2viff(3)

RESTRICTIONS
Only one band at a time is converted.

Elas images are assumend to be in NS byte order (little endian).

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