What is GDP on a row

Help

Image description files

Three description files can be provided for BIL, BIP and BSQ files: a header file (HDR) to describe the layout of the image pixel data (required), a color file (CLR) to describe the image color map and a statistics file (STX) to describe the image statistics for the individual bands of the image. It is an ASCII text file that can be generated in a text editor based on the information you know about the image.

The header file

The image data is described in the header file. You have to generate a header file for each image file. Its file name must be identical to that of the image file, but with the extension HDR. Example:

The header file contains several entries, each of which describes a specific attribute of the image. An entry can be used to describe the number of rows or columns in the image, for example. The format of the entries is:

"" designates the respective attribute and "" the value to which the attribute is set. The order of the entries in the header is not specified, but each entry must be on a separate line in the file. All lines in the file that do not begin with a keyword are treated as comments and are ignored.

The following list shows the valid keywords with the corresponding image attributes. There are default values ​​for several keywords. If the image data is accurately represented by the default value, you can omit the keyword in the header file.

nrows: The number of lines in the image. The lines run parallel to the x-axis of the map's coordinate system. There is no default value.

ncols: The number of columns in the image. The columns run parallel to the y-axis of the map's coordinate system. There is no default value.

nbands: The number of spectral bands in the image. The default setting is 1.

nbits: The number of bits per pixel per band. Possible values ​​are 1, 4, 8, 16 and 32. The default value is 8 bits per pixel per band. For a true color image with three bands (R, G, B) stored at 8 bits per pixel per band, "nbits" equals 8 and "nbands" equals 3, for a total of 24 bits per pixel . In an image with "nbits" equal to 1, "nbands" must also equal 1.

pixel type:This keyword indicates that the pixel type is a signed integer. Your data is assumed to use unsigned integers unless the keyword "pixeltype" is used and the value you set for it is "signedint".

byteorder: The byte order in which the image pixel values ​​are stored. The byte order is important for 16-bit images with 2 bytes per pixel. The following values ​​are possible:

  • I: Intel® byte order (Silicon Graphics®, DEC Alpha ™, PC) or "Little Endian"
  • M: Motorola® byte order (Sun ™, HP® etc.) or "Big Endian"

The default byte order is the same as the order used on the host computer on which the software is running.

layout: The arrangement of the bands in the image file. The following values ​​are possible:

  • bil: Band Interleaved by Line. This is the default setting.
  • gip: Band Interleaved by Pixel
  • bsq: Band Sequential

skipbytes: The number of data bytes in the image file that must be skipped to the beginning of the image data. You can use this keyword to bypass any image header information in the file. The default value is 0 bytes.

ulxmap: The map coordinate on the x-axis in the center of the upper left pixel. If you specify this parameter, you must also specify ulymap, otherwise a default value will be used.

ulymap: The map coordinate on the y-axis in the center of the upper left pixel. If you specify this parameter, you must also specify ulxmap, otherwise a default value will be used.

xdim: The x-dimension of a pixel in map units. If this parameter is specified, you must also specify "ydim", "ulxmap", and "ulymap", otherwise a default value will be used.

ydim: The y dimension of a pixel in map units. If this parameter is specified, you must also specify "xdim", "ulxmap", and "ulymap", otherwise a default value will be used.

The following illustration shows the default values ​​for ulxmap, ulymap, xdim, and ydim. The center of the upper left pixel is given the map coordinates (ulxmap, ulymap) = (0, (nrows - 1)), while the center of the lower left pixel is given the position (0, 0). In this figure, the coordinate values ​​for "ulxmap" and "ulymap" are equal to (0, 3). The standard values ​​"xdim" = 1 and "ydim" = 1 are used for the x and y pixel dimensions.

bandrowbytes: The number of bytes per tape per line. This must be an integer value. This keyword is only used with BIL files when there are additional bits at the end of each band in a line to be skipped. The keyword "bandrowbytes" can be understood as an index for the starting point of the next data band. At the beginning of any band in a line, "bandrowbytes" changes the same line to the beginning of the next band.

The following illustration shows a line of data from an image with three bands. "Bandrowbytes" is the sum of the number of bytes for storing the image data and the additional bits that have to be skipped until the beginning of the next band.

To set "bandrowbytes", you need to know the layout of the image data. More precisely, you need to know how many bytes are used to store the pixel values ​​for each band in a line. If "bandrowbytes" is not specified, a default value is calculated according to the following equation:

The default handles cases where there are no extra bits at the end of each tape on a line and the number of bytes per tape per line is the smallest integer value of bytes that can properly store the data for the tape. For example, if 2.5 bytes are required for the data, 3 bytes is the smallest integer value of bytes to store the data. In either of these cases, "bandrowbytes" does not need to be set. However, if the number of bytes per tape per line is greater than the default, you will need to set bandrowbytes accordingly.

The following two examples show the default behavior of bandrowbytes. The first example deals with the case in which there are no bits at the end of a tape in a line, the second with the case in which they are present.

  • When there are no overhead bits at the end of a tape, "bandrowbytes" is the number of bytes to store the image data. Assume there is a 6 by 6 image with three bands and 8 bits (1 byte) per pixel. 6 bytes per band and line are then required for the image data. By default, "bandrowbytes" is set to 6 bytes as shown in the following equation: Since the number of bytes per tape per line is "bandrowbytes", the default value is the appropriate setting. The parameter "bandrowbytes" does not have to be specified explicitly.
  • If there are extra bits at the end of a tape in a line, "bandrowbytes" is not equal to the number of data bytes per tape per line.

    For example, suppose you have a three-band image with 5 rows and 5 columns with 4 bits per pixel. By default, bandrowbytes is set to the smallest integer number of bytes to properly store the data. In this case the default value is 3 and is calculated as follows:

    However, only 2.5 bytes are required for the image data, which results from the product of "ncols" and "nbits". The number of bytes to be skipped is therefore 0.5 bytes (4 bits) or the difference between 3 bytes ("bandrowbytes") and 2.5 bytes (bytes for the image data). The following illustration shows a band of data for one line of the image.

totalrowbytes: The total number of bytes of data per line. Use "totalrowbytes" if there are extra bits at the end of each line.

In a BIL file, the default value for "totalrowbytes" is calculated according to the following equation:

The default value assumes that there are no extra bits at the end of each line. Otherwise you have to set "totalrowbytes" accordingly. Suppose there is an image with three bands and "bandrowbytes" equal to 3. Then "totalrowbytes" is equal to 9 by default. If there is an extra byte at the end of each line, set "totalrowbytes" to 10.

For a BIP file, the default value is calculated according to another equation:

"Totalrowbytes" is rounded up to the next number of bytes (an integer) in which the pixel data for the line can be properly stored. For example, suppose you have a BIP image with 5 rows and 5 columns, with 3 bands and 4 bits per pixel. Then the standard value for "totalrowbytes" is calculated as follows:

This figure shows the default totalrowbytes setting for a BIP image.

If the default value for "totalrowbytes" does not display the data properly, then "totalrowbytes" must be set to the appropriate number of bytes in each line.

bandgapbytes: The number of bytes between the bands in a BSQ picture. The default setting is 0.

The following example shows a typical header file that could be generated for a BIL satellite image in which the image data is preceded by a 128-byte header.

The following table lists the keywords that can be used in an HDR file:

keywordPossible values:default

nrows

All integer values> 0

No

ncols

All integer values> 0

No

nbands

All integer values> 0

1

nbits

1, 4, 8, 16, 32

8

pixeltype

SIGNEDINT

Unsigned integer

byteorder

I = Intel; M = Motorola

As on the host computer

layout

bil, bip, bsq

bil

skipbytes

All integer values ​​≥ 0

0

ulxmap

All real numbers

0

ulymap

All real numbers

nrows - 1

xdim

All real numbers

1

ydim

All real numbers

1

bandrowbytes

All integer values> 0

Smallest integer value ≥ (ncols x nbits) / 8

totalrowbytes

All integer values> 0

For BIL: nbands x bandrowbytes; for BIP: smallest integer value ≥ (ncols x nbands x nbits) / 8

bandgapbytes

All integer values ​​≥ 0

0

Summary of the keywords that can be used in an HDR file

To the color file

The color file (CLR) is an optional file that describes the image color map for single band false color images. If the file does not exist, the image will be displayed in grayscale.

The colors for the pixel values ​​of the image are saved in the color file. The colors are defined using the RGB color model, in which the colors are described according to the proportions of red, green and blue. The file contains several entries, with each entry in its own line describing the color of a pixel value in the image.

The format of the entries is:

"" is a certain pixel value, and "", "" and "" are the color components of the pixel. Sort the entries in ascending order by pixel value. If the first non-space character on a line is not a number, the line is interpreted as a comment and ignored. All characters in a line that are not spaces and are specified after the fourth parameter ("") are ignored and can also be used for comments.

The components red, green and blue are specified on a scale from 0 to 255. As the color value increases, so does the intensity of the respective color component. The default color for a pixel value without an entry is black. The following example is a sample color file for a raster soil map with pixel values ​​11, 16, 18, 19, 21, 98 and 99:

Color files are only used for single band images. Single band images with a color file are interpreted as a false color image. Color files associated with multiband images are ignored.

To the statistics file

The statistics file (STX) is an optional file that describes the image statistics for the individual spectral bands in a grayscale or multiband image. The file consists of several entries, one per band, in which the minimum and maximum pixel values, the mean value, the standard deviation and two linear parameters for contrast stretching are saved.

Each entry has the following format (the values ​​for each band are displayed in one line):

2 "is the number of the band," "the minimum pixel value in the band," "the maximum pixel value in the band," {mean} "the mean pixel value," {std_deviation} "the standard deviation , "{linear_stretch_min}" the minimum pixel value for linear contrast stretching and "{linear_stretch_max}" the maximum pixel value for linear contrast increase.

The values ​​for the individual parameters are entered in one line. Entries in which the first non-space character on a line is not a number are treated as a comment and ignored. Required parameters are the number of the band and the minimum and maximum pixel values. The mean, the standard deviation, and the minimum and maximum values ​​for linear stretching are optional parameters. With "#" you can skip the optional parameters.

The values ​​for the number of the band range from 1 to "nbands". The contrast of the display image can be increased with the parameters "linear_stretch_min" and "linear_stretch_max". Pixel values ​​smaller than "linear_stretch_min" are displayed in black, and pixel values ​​greater than "linear_stretch_max" are displayed in white. The pixel values ​​between the minimum and maximum linear stretch parameters are displayed in gray levels, with lower pixel values ​​displayed in a darker gray level.

The pixel values ​​between the linear stretch parameters are displayed using the maximum number of gray levels available on the display device.

If "linear_stretch_min" and "linear_stretch_max" are not specified, the mean value minus two standard deviations for "linear_stretch_min" and the mean value plus two standard deviations for "linear_stretch_max" are used as standard values. If the standard deviation is not specified, the minimum and maximum pixel values ​​are used as parameters for contrast stretching.

In multiband images, each band is stretched before the composite image is displayed. If a color (CLR) file is present, the linear contrast stretching of the single band grayscale image is overridden and the image is displayed as a false color image instead.

The following example is a statistics file for a satellite image with four bands and 8 bits per pixel per band: