ENVI Header Files
The ENVI header file contains metadata for ENVI-format images. ENVI creates a new header file whenever you save an image to ENVI raster format. The header file uses the same name as the image file, with the file extension .hdr.
Use the View Metadata dalog to view the header information for ENVI-format images and other supported data types. For ENVI-format images, you can open the Edit ENVI Header dialog from the View Metadata dialog to edit certain fields.
See the following sections:
Edit ENVI Headers
Use the Edit ENVI Header dialog to edit or add metadata fields and values for rasters. The changes will be saved to the header file (.hdr), located in the directory with the input image (the directory must have write permissions).
You can also write a script to edit raster metadata using the SetRasterMetadata task or the ENVIRasterMetadata::UpdateItem method. Or, to edit specific metadata values for an input raster and produce a new raster and header file, use the EditRasterMetadata task.
To edit the ENVI Header file, open the Edit ENVI Header dialog with one of the following:
- In the View Metadata dialog, click the Edit Metadata button.
- From the Toolbox, select Raster Management > Edit ENVI Header, select an input raster, then click OK. You can open any raster format or sensor type that ENVI supports.
The Edit ENVI Header dialog displays metadata that is in the header file under these tabs:
- Main
- Spatial
- Spectral
- Display
- Other
- Custom
All header files require the following fields. See descriptions of all ENVI Header Fields in the next section.
- Bands
- Byte Order
- Columns
- Data Type
- File Type
- Header Offset
- Interleave
- Rows
To add new metadata fields to the header file:
- Click the Add button
. The Add Metadata Items dialog appears. - Select the header item(s) to add, then click OK. To select multiple items at once, multi-select using Shift+click or Ctrl+click), then click OK. The new metadata item(s) will be added under the different dialog tabs.
- Enter the values for the new fields, then click OK in the Edit ENVI Header dialog to close it and save the changes.
To import metadata from another raster file:
- Click the Import button
. The Data Selection dialog appears. - Navigate to the raster to import metadata from, then click OK. The Import Metadata Items dialog appears.
- Select the metadata item(s) to import. To select multiple items at once, multi-select using Shift+click or Ctrl+click, then click OK. The new metadata item(s) will be added to the different dialog tabs.
- Click OK in the Edit ENVI Header dialog to close it and save the changes.
To remove metadata fields from the header file:
- Click the Remove button
. The Remove Metadata Items dialog appears. - Select the item(s) to remove (multi-select using Shift+click or Ctrl+click).
- Click OK to remove the item, then click OK again in the ENVI Edit Header dialog to save the changes.
Only optional metadata fields can be removed; required metadata fields cannot be removed.
For TIFF and GeoTIFF image files, you can optionally use the Edit ENVI Header tool or a text editor to create an ENVI header file (.hdr) to override the default metadata fields. For example, you can change the default stretch type to better visualize the data or you can change the wavelength information if you know that it is wrong in the original TIFF/GeoTIFF file. Once you save the changes to a header file, ENVI will read the new metadata values when you re-open the image file.
ENVI Header Fields
The table below lists ENVI header fields by name as they appear in the Edit ENVI Header dialog. The column on the left includes the parameter name used with the ENVITask and the field name as it appears in the .hdr header file.
Required metadata fields are marked with "(Required)" in the description.
You can also write a script to edit the ENVI header file using the SetRasterMetadata task.
See Example below for an example header file.
|
Dialog Field Task Parameter .hdr Field |
Description |
|---|---|
|
Acquisition Time
|
The date and time the image was acquired.
If you save an image from any of these sensors to ENVI format, an Note: If you are programming with the ENVI API, all inherent metadata (including acquisition time) is stored in memory as a property to the raster object. See ENVIRaster and ENVIRasterMetadata for more information. You can also create an ENVITime object that stores the acquisition time for a given raster dataset. |
|
Associated DEM
|
The path and filename of the DEM file to associate with the image. See also: DEM Band. |
|
Auxiliary RPC Spatial Reference
|
Lists Rational Polynomial Coefficient (RPC) geolocation information for files that have RPC reference information instead of a standard map projection. |
| Bad Bands List
|
Designates known-bad image bands in the image header file. In the Edit ENVI Header dialog, click the Add button |
| Band Names
|
The names of the image bands. You can change the band names to something more meaningful for your purposes. |
| Bands
|
(Required) The number of bands per image file. |
| Byte Order
|
(Required) The order of the bytes in integer, long integer, 64-bit integer, unsigned 64-bit integer, floating point, double precision, and complex data types. Specify one of the following (where bold font = the dialog drop-down list option and
|
| Class Colors
|
Lists class colors using RGB color definitions for classification files. |
| Class Names
|
Lists the class names for classification files. You can change the class names to something more meaningful for your purposes. |
| Cloud Cover
|
The percentage of cloud cover within the raster. |
| Color Table
|
The default color table to use when ENVI displays the image. This is stored as an array of 768 numbers of type byte, representing the 3 by 256 color table to use. |
| Columns
|
(Required) The number of samples (pixels) per image line for each band. |
| Complex Function
|
Specifies the values to calculate from a complex image and to use when displaying the image, calculating statistics for the image, or writing the image to a new file. Values include the following:
|
| Coordinate System
|
When you save a georeferenced file to ENVI raster format, ENVI adds this metadata to the header file. It lists the parameters used for a geographic or projected coordinate system. Following are some examples: A geographic coordinate system (for example, Geographic Lat/Lon) string contains the word coordinate system string = GEOGCS["GCS_WGS_1984", DATUM["D_WGS_1984", SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]] A projected coordinate system string contains the word coordinate system string = PROJCS["WGS_1984_South_Georgia_Lambert", GEOGCS["GCS_WGS_1984", DATUM["D_WGS_1984", SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic"], PARAMETER["False_Easting",0.0], PARAMETER["False_Northing",0.0], PARAMETER["Central_Meridian",-37.0], PARAMETER["Standard_Parallel_1",-54.0], PARAMETER["Standard_Parallel_2",-54.75], PARAMETER["Latitude_Of_Origin",-55.0], UNIT["Meter",1.0]] See Coordinate System Strings and Codes for more information. |
| Custom Metadata Item
|
Add your own metadata fields to the header. Field names will be stored in the |
| Data Gain Values
|
The gain values for each band. Units are W/(m2 * µm * sr). |
| Data Ignore Values
|
Pixel values that should be ignored in image processing workflows such as Feature Extraction, or to specify pixel values that should be transparent when displayed in the view. |
| Data Offset Values
|
Offset values for each band. |
| Data Reflectance Gain Values
|
An array of reflectance gain values. With Landsat-8 files, the reflectance gains have been scaled by the sine of the sun elevation, as follows: data reflectance gain values = REFLECTANCE_MULT_BAND_1/sin(sun elevation) |
| Data Reflectance Offset Values
|
An array of reflectance offset values. With Landsat-8 files, the reflectance offsets have been scaled by the sine of the sun elevation, as follows: data reflectance offset values = REFLECTANCE_ADD_BAND_1/sin(sun elevation) |
| Data Type
|
(Required) The type of data representation. Specify one of the following:
|
| Default Bands to Load
|
The band numbers to automatically load into the Data Manager every time the file is opened. In the Edit ENVI Header dialog, select the RGB or Grayscale radio button, then click on each item in the list to select the band to open. In the |
| Default Stretch
|
The type of stretch to use when ENVI displays the image. For details on each stretch type, see Stretch.Specify one of the following (where bold font = the dialog drop-down list option and
|
|
DEM Band
|
The selected DEM band. Note: When you choose a DEM band, ENVI does not verify that both files are georeferenced and cover the same area. ENVI also automatically adds a geoid offset and assumes that the DEM is in meters above sea level, even for fixed-level DEMs. If the DEM file contains a single band, or if the first band of the DEM image was chosen, the band defaults to 0 and the Neither DEM Band nor Associated DEM is written to the See also Associated DEM. When you open an image that has an associated DEM, ENVI adds both the image and the DEM to the Layer Manager. If ENVI cannot find the associated file, ENVI displays an error message and adds only the base image to the Layer Manager. This DEM association also affects the following functions in ENVI:
|
| Description
|
A description of the image or the processing performed on it. |
| File Type
|
(Required) The ENVI-defined file type, such as a certain data format and processing result. |
| FWHM
|
Lists full-width-half-maximum (FWHM) values of each band in an image. Units vary by sensor and should be the same as those used for Wavelength. |
| Header Location
|
Specify one of the following to indicate where to save the associated header file (
|
| Header Offset
|
(Required) The number of bytes of embedded header information present in the file. ENVI skips these bytes when reading the file. The default value is 0 bytes. |
| Interleave
|
(Required) Refers to whether the data interleave is BSQ, BIL, or BIP. See ENVI Image Files for details. |
| Number of Classes
|
Defines the number of classes, including unclassified regions, for classification files. |
|
|
If you defined a custom projection in ENVI Classic, this field contains that map information. A |
| Read Procedures
|
The names of spatial and spectral read routines used in ENVI Classic custom file readers. |
| Reflectance Scale Factor
|
A scale factor that is used in the Endmember Collection tool to correctly scale library data or other reflectance data to match the image data. If one of the files used in the Endmember Collection dialog does not have a reflectance scale factor defined, then no scaling is applied. Enter the value that, when divided into your data, would scale it from 0-1 reflectance. For example, if the value of 10,000 in your data represents a reflectance value of 1.0, enter a reflectance scale factor of 10,000. |
| Rows
lines |
(Required) The number of lines per image for each band. |
| Security Tag
|
The security information inherited from formats that typically contain security classification levels (such as NITF). |
| Sensor Type
|
Specifies instrument types, such as Landsat TM, SPOT, RADARSAT, and so on. The string must exactly match an entry in the Sensor Type drop-down list in the Edit ENVI Header dialog. The complete list is also included in the SENSOR_TYPE description in the SetRasterMetadata task. |
| Solar Irradiance
|
The top of the atmosphere solar irradiance per band. Units are W/(m2 * µm). |
| Spatial Reference
|
Specify an ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, or ENVIStandardRasterSpatialRef that indicates the spatial reference of the raster. In the header file, |
|
|
When viewing spectral library files in a text editor, this is a comma-separated list of spectra names enclosed in {curly brackets} |
|
Sun Azimuth
|
The angle of the sun (in degrees) from due north in a clockwise direction. |
| Sun Elevation
|
The angle of the sun (in degrees) above the horizon. |
| Timestamp
|
The date/time strings associated with each band in a time cube. |
| Wavelength Units
|
The wavelength units. Units vary by sensor:
|
| Wavelength
|
Lists the center wavelength values of each band in the image. The values should be the same as those used for the FWHM field. |
|
X Start
|
Defines the image coordinates for the upper-left pixel in the image. Images that are spatial subsets of larger images often use an image coordinate system that references the parent (or larger) image so that you can link and dynamically overlay the two images. The default values for the upper-left pixel are (0,0). The reference (tie point) pixels in the Changing these values does not affect the way ENVI reads the image data from the file. |
|
|
The number of pixels in the x and y directions to average for Z plots. |
| Z Plot Ranges
|
The default minimum and maximum values for Z plots. |
| Z Plot Titles
|
The x and y axis titles for Z plots. |
Example Header File
The following is a typical ENVI header file. Not all available fields are listed:
ENVI
description = {
Registration Result. Method1st degree Polynomial w/ nearest neighbor [Wed Dec 20 23:59:19 1995] }
samples = 709
lines = 946
bands = 7
header offset = 0
file type = ENVI Standard
data type = 1
interleave = bsq
sensor type = Landsat TM
byte order = 0
map info = {UTM, 1, 1, 295380.000, 4763640.000, 30.000000, 30.000000, 13, North}
z plot range = {0.00, 255.00}
z plot titles = {Wavelength, Reflectance}
pixel size = {30.000000, 30.000000}
default stretch = 5.0% linear
band names = {
Warp (Band 1:rs_tm.img), Warp (Band 2:rs_tm.img), Warp (Band 3:rs_tm.img), Warp (Band 4:rs_tm.img), Warp (Band 5:rs_tm.img), Warp (Band 6:rs_tm.img), Warp (Band 7:rs_tm.img)}
wavelength = {
0.485000, 0.560000, 0.660000, 0.830000, 1.650000, 11.400000, 2.215000}
fwhm = {
0.070000, 0.080000, 0.060000, 0.140000, 0.200000, 2.100000, 0.270000}
Classification files include the following additional keywords:
classes = 4
class lookup = { 0, 0, 0,255, 0, 0, 0,255, 0,255,255, 0}
class names = {
Unclassified,
region 1,
region 2,
region 3}
Spectral library files include the following additional keywords:
spectra names = {
ACTINOLITE IN-4A, ALBITE TS-6A, ALMANDINE GARNET NS-4A, ALUNITE SO-4A,
AMBLYGONITE P-3A, ANALCIME TS-18A, ANATASE SYNTHETIC O-12A,
ANDESINE TS-4A, ANGLESITE SO-10A, ANHYDRITE SO-1A, ANORTHITE TS-5A,
ANTHOPHYLLITE IN-8A, ANTLERITE SO-11A, APATITE P-1A, APHTHITALITE SO-9A}
You can create an ENVI header file using a text editor. The file must start with the text string ENVI for ENVI to recognize it as a native file header. Keywords within the file indicate critical file information.
You can add comments to the file by inserting a line with a semicolon as the first character. ENVI ignores these lines when parsing the header file. Comments begin with a semicolon and must be on their own line. Comments can appear anywhere within a header file except within keyword/value brackets:
band names = {
Band1
Band2
; comment
Band 3
}
See Also
View File Metadata, Supported Data Types, ENVIRasterMetadata (API), ENVIRaster::WriteMetadata (API)