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
ACQUISITION_TIME
acquisition time
|
The date and time the image was acquired.
- For DubaiSat, Landsat, Pleiades, and SPOT, the acquisition time is the scene center time.
- For Pleiades tiled products, the acquisition time is the beginning time of the first tile.
- For EO-1 ALI, Gaofen-1, Hyperion, Ziyuan-1-02C, and Ziyuan-3A data, the acquisition time is the scene start time.
- For QuickBird and WorldView, acquisition time is taken from the firstLineTime field for basic products or the earliestAcqTime field for projected products.
If you save an image from any of these sensors to ENVI format, an acquisition time field will be added to the ENVI header file.
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
DEM_FILE
dem file
|
The path and filename of the DEM file to associate with the image.
See also: DEM Band.
|
Auxiliary RPC Spatial Reference
AUXILIARY_RPC_SPATIALREF
rpc info
|
Lists Rational Polynomial Coefficient (RPC) geolocation information for files that have RPC reference information instead of a standard map projection.
|
Bad Bands List
BBL
bbl
|
Designates known-bad image bands in the image header file. In the Edit ENVI Header dialog, click the Add button next to the Bad Bands List field; an Add dialog appears, listing the bands. Select the known bad bands to add to the list (multi-select using Shift+click or Ctrl+click), then click OK.
|
Band Names
BAND_NAMES
band names
|
The names of the image bands. You can change the band names to something more meaningful for your purposes.
|
Bands
NBANDS
bands
|
(Required) The number of bands per image file.
|
Byte Order
BYTE_ORDER
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 code font = is the .hdr file value to use with byte order =):
- Host Intel: Least significant byte first (LSF) data (DEC and MS-DOS systems). The .hdr file value = 0.
- Network (IEEE): Most significant byte first (MSF) data (all other platforms). The .hdr file value = 1.
|
Class Colors
CLASS_LOOKUP
class lookup
|
Lists class colors using RGB color definitions for classification files.
|
Class Names
CLASS_NAMES
class names
|
Lists the class names for classification files. You can change the class names to something more meaningful for your purposes.
|
Cloud Cover
CLOUD_COVER
cloud cover
|
The percentage of cloud cover within the raster.
|
Color Table
COLOR_TABLE
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
NCOLUMNS
samples
|
(Required) The number of samples (pixels) per image line for each band.
|
Complex Function
COMPLEX_FUNCTION
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:
-
Imaginary (imaginary portion of number)
-
Magnitude (square root of sum of the squares of the real and imaginary)
-
Power (default, ln(magnitude))
-
Real (real portion of number)
-
Phase (arc tangent of imaginary divided by real)
|
Coordinate System
coordinate system string
|
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 GEOGCS and lists the coordinate system name, datum, spheroid, prime meridian, and units:
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 PROJCS and lists all of the geographic coordinate system parameters, plus detailed parameters that describe the projected coordinate system:
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
CUSTOM_METADATA
N/A
|
Add your own metadata fields to the header. Field names will be stored in the .hdr file and display in lower case only; special characters are not permitted. The field values have no such restrictions.
|
Data Gain Values
DATA_GAIN_VALUES
data gain values
|
The gain values for each band. Units are W/(m2 * µm * sr).
|
Data Ignore Values
DATA_IGNORE_VALUE
data ignore value
|
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
DATA_OFFSET_VALUES
data offset values
|
Offset values for each band.
|
Data Reflectance Gain Values
DATA_REFLECTANCE_GAIN_VALUES
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
DATA_REFLECTANCE_OFFSET_VALUES
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
DATA_TYPE
data type
|
(Required) The type of data representation. Specify one of the following:
- Byte: 8-bit unsigned integer (.hdr file value = 1).
- Integer: 16-bit signed integer (.hdr file value = 2)
- Long Integer: 32-bit signed integer (.hdr file value = 3)
- Float: 32-bit single-precision (.hdr file value = 4)
- Double: 64-bit double-precision floating-point (.hdr file value = 5)
- Complex: Real-imaginary pair of single-precision floating-point (.hdr file value = 6)
- Double-precision Complex: Real-imaginary pair of double-precision floating-point (.hdr file value = 9)
- Unsigned Integer: 16-bit unsigned integer (.hdr file value = 12)
- Unsigned Long Integer: 32-bit unsigned integer (.hdr file value = 13)
- 64-bit Long Integer: 64-bit signed (.hdr file value = 14)
- 64-bit Unsigned Long Integer: 64-bit unsigned (.hdr file value = 15)
|
Default Bands to Load
DEFAULT_BANDS
default bands
|
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 .hdr file, specify the bands to load for RGB as {2,3,1} and specify a band for grayscale as { 3} grayscale and the band to load By default, a new image is automatically loaded when a file that has default bands
|
Default Stretch
DEFAULT_STRETCH
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 code font = is the .hdr file value to use with default stretch =):
- No stretch
- Bipolar
- Equalization:
- Gaussian: Enter the standard deviation (StdDev) to use; the default is 2. Optionally enter a Min Value pixel and Max Value pixel to use in the stretch. For multi-band images, these values will apply to all of the bands. You cannot set individual minimum/maximum values for each band.
- % Linear/Linear Range: For % Linear, optionally specify the percentage of the data to clip; for example: 5 % / default stretch = 5.0% linear. Or, for Linear Range, optionally enter a Min Value pixel and Max Value pixel to use in the stretch.
- Logarithmic: Optionally enter a Min Value pixel and Max Value pixel to use in the stretch. For multi-band images, these values will apply to all of the bands. You cannot set individual minimum/maximum values for each band.
- Optimized Linear: You can optionally modify settings that control the midtones, shadows, and highlights in an image with the following: Min % (default 0.025), Max % (default 0.99), Min Adjust % (default 0.1), and Max Adjust % (default 0.5). In the .hdr file, an example would look like default stretch = optimized linear 0.0250 0.9900 0.1000 0.5000.
- Square Root: Enter the square root Factor to use, the default is 2. Optionally enter a Min Value pixel and Max Value pixel to use in the stretch. For multi-band images, these values will apply to all of the bands. You cannot set individual minimum/maximum values for each band.
|
DEM Band
DEM_BAND
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 dem band field will not be written to the .hdr file. Otherwise dem band fields displays the index (starting at 1) of the selected DEM band.
Neither DEM Band nor Associated DEM is written to the .hdr file if an in-memory band is selected as the associated DEM band. In this case, the DEM association exists for the current ENVI session only; it does not persist for subsequent sessions.
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:
- Cursor Location/Value Tool: The DEM value for a given pixel displays next to the data value for areas where the DEM and the image share common geographic coordinates; for example, Data:11 (DEM=1280). The DEM value is not shown if either the image or the DEM are not georeferenced.
- 3D SurfaceView: ENVI uses the associated DEM file as the default and does not prompt you to select a DEM for the surface.
-
RPC or RSM Projection Emulation: If an image displays using RPC or RSM projection emulation and it has an associated DEM, ENVI uses the DEM to refine the RPC or RSM solution, which improves its positional accuracy.
For RPC or RSM Projection Emulation, the DEM must contain map information covering the area for the RPC or RSM image; otherwise, ENVI uses the default elevation.
- RPC or RSM Orthorectification: If an image being orthorectified has an associated DEM file, then ENVI uses it as the default elevation input to the orthorectification process. You can change this default designation at any time.
|
Description
_DESCRIPTION
description
|
A description of the image or the processing performed on it.
|
File Type
FILE_TYPE
file type
|
(Required) The ENVI-defined file type, such as a certain data format and processing result.
|
FWHM
FWHM
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
HEADER_LOCATION
header location
|
Specify one of the following to indicate where to save the associated header file (.hdr):
- Same as raster file: (default)
- Auxiliary File Directory: The directory specified in the Auxiliary File Directory field of the ENVI Preferences file.
|
Header Offset
HEADER_OFFSET
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
INTERLEAVE
interleave
|
(Required) Refers to whether the data interleave is BSQ, BIL, or BIP. See ENVI Image Files for details.
|
Number of Classes
CLASSES
classes
|
Defines the number of classes, including unclassified regions, for classification files.
|
projection info
|
If you defined a custom projection in ENVI Classic, this field contains that map information. A projection info line is added to the ENVI header file if the image uses a user-defined projection instead of a standard projection defined in the file map_proj.txt file of the ENVI distribution. If the header file contains a coordinate system string field, any existing projection info line information is ignored.
|
Read Procedures
READ_PROCEDURES
read procedures
|
The names of spatial and spectral read routines used in ENVI Classic custom file readers.
|
Reflectance Scale Factor
REFLECTANCE_SCALE_FACTOR
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
NROWS
lines
|
(Required) The number of lines per image for each band.
|
Security Tag
SECURITY_TAG
security tag
|
The security information inherited from formats that typically contain security classification levels (such as NITF).
|
Sensor Type
SENSOR_TYPE
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
SOLAR_IRRADIANCE
solar irradiance
|
The top of the atmosphere solar irradiance per band. Units are W/(m2 * µm).
|
Spatial Reference
SPATIALREF
geo points
map info
pixel size
|
Specify an ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, or ENVIStandardRasterSpatialRef that indicates the spatial reference of the raster.
In the header file, geo points are the geographic corners for non-georeferenced files, map info correspond to the top-left corner of the image, and pixel size indicates x and y pixel size in meters for non-georeferenced files.
|
spectra names
|
When viewing spectral library files in a text editor, this is a comma-separated list of spectra names enclosed in {curly brackets}
|
Sun Azimuth
SUN_AZIMUTH
sun azimuth
|
The angle of the sun (in degrees) from due north in a clockwise direction.
|
Sun Elevation
SUN_ELEVATION
sun elevation
|
The angle of the sun (in degrees) above the horizon.
|
Timestamp
TIMESTAMP
timestamp
|
The date/time strings associated with each band in a time cube.
|
Wavelength Units
WAVELENGTH_UNITS
wavelength units
|
The wavelength units. Units vary by sensor:
-
Micrometers
-
Nanometers
-
Wavenumber
-
GHz
-
MHz
-
Unknown
|
Wavelength
WAVELENGTH
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 Y Start
X_START Y_START
x start y 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 map info header field are one-based.
Changing these values does not affect the way ENVI reads the image data from the file.
|
z plot average
|
The number of pixels in the x and y directions to average for Z plots.
|
Z Plot Ranges
Z_PLOT_RANGE
z plot range
|
The default minimum and maximum values for Z plots.
|
Z Plot Titles
Z_PLOT_TITLES
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
Band 3
}
See Also
View File Metadata, Supported Data Types, ENVIRasterMetadata (API), ENVIRaster::WriteMetadata (API)