USDA ARS

Format of IPW Image Headers

The headers in an IPW image are stored as lines of text. Each text line is either a preamble which indicates the start of a header, or a datum which contains the actual contents of the header.

Preamble lines

A preamble line begins with the unique identifier string: "!<header>". After this string comes the header's type and the number of the band the header is associated with. Here is an example of the preamble line for a GEO (geodetic) header for an image's first band (band 0):

     !<header> geo 0 $Revision: 1.4 $
The characters following the band number represent revision information used internally by the IPW software.

Datum lines

A datum line in a header has the format:

     keyword = value [...]
For example, here are some of the datum lines from the BI (basic image) header of an image:
     nlines = 96 
     nsamps = 281 
     nbands = 3 
These lines indicate that the image has 96 lines, 281 samples per line, and 3 bands (pixels) per sample.

The notation "[...]" in the format above indicates that the keyword may have multiple values. A common example of this case is an LQ (linear quantization) header:

     !<header> lq 0 $Revision: 1.4 $
     map = 0 0
     map = 255 56.78
An explanation of the map datum lines of a LQ header is described in the next section of this guide.

Where headers end and pixels begin

A special preamble line marks the end of an IPW image's headers:

	!<header> image -1 $Revision: 1.5 $^L
This last header line immediately preceeds the image's pixel data.

To facilitate the direct viewing of an IPW image's headers with the UNIX pagination utility "more", this last header line image contains a formfeed character (ASCII code 12, control-L) which is shown above as "^L". This formfeed causes the utility to stop just before the pixel data, and allows the user to terminate the utility before any binary pixel data is written to the terminal screen.

Furthermore, UNIX text processing commands such as "sed" and "awk" can be used to process an image's headers by utilizing the formfeed character as the marker to stop reading the image file.


IPW documentation / Last revised 20 May 2009 / IPW web site