Editing ENVI Headers
ENVI stores information about files in a separate text header file with the same name as the image file, but with the file extension .hdr. Use the Edit ENVI Header function to change the header information. Each time a data file is opened, ENVI searches for the header file and uses the information to open the file.
- From the ENVI main menu bar, select File
Edit ENVI Header. The Edit Header Input File dialog appears.
Tip
You can also open the header by right-clicking the filename in the Available Bands List. |
- Click on the desired filename. The file details display in the text box labeled File Information.
- Click OK. The Header Info dialog appears. Use the Header Info dialog to edit general image parameters, band names, wavelengths, and map information; or to associate a DEM with an image. Refer to the procedures in the following sections for specific editing instructions.
Note
The header file does not allow class names that include commas. |
- After editing the header, click OK.
Note
If you edit the header of a file that is currently open, ENVI closes that file and re-opens it when you click OK. Because the displays using that file close when the file closes, you must restart those displays from the Available Bands List. |
Modifying General Image Parameters
Use the Header Info dialog to edit general image parameters. Each field is explained in this section.
Note
Use caution when editing the general image parameters for files not in the ENVI file format. For example, changing the data type of an image in an HDF file does not effect the data type of the displayed or returned data. The HDF format overrides any setting by the user. To change the data type of an HDF image, first save the data to an ENVI file then change the data type. This is also true for many external file formatted files opened in ENVI.
To save an image file as and ENVI format file, see Saving Files as Standard ENVI Files. |
- Samples - Displays the number of samples in the file.
- Lines - Displays the number of lines in the file.
- Bands - Displays the number of bands stored in the file.
- Offset - Displays the offset in bytes from the start of the file to where the actual data begins. (The Offset is sometimes known as the embedded header.)
- xstart/ystart - Define the image coordinates for the upper-left hand 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 the two can be linked and dynamically overlaid. The default values are (1,1) so that the upper-left hand pixel has an image coordinate of (1,1).
Note
Changing the value of xstart or ystart does not affect the way ENVI reads the image data from the file. |
- Data Type - Use this drop-down list to select the appropriate data type (byte, integer, unsigned integer, long integer, unsigned long integer, floating point, double precision, 64-bit integer and unsigned 64-bit integer, complex, or double complex).
- Byte Order - Use this drop-down list to select the byte order of the data. This parameter varies by platform:
- For DEC machines and PCs, select Host (Intel), for the host least significant first byte order.
- For all other platforms, select Network (IEEE), for the network most significant first byte order.
- Interleave - Use this drop-down list to select the data storage order from these choices:
- BSQ - band sequential
- BIL - band interleaved by line
- BIP - band interleaved by pixel
- Use the text field at the bottom of the Header Info dialog to insert string text that describes the data file.
Selecting File Types
ENVI uses the File Type header field to automatically identify certain types of data files. In the Header Info dialog, use the File Type field to identify the native file type of the file that the ENVI header belongs to. The file has an ENVI Header, but still exists in its native format. The ENVI header file can be used to add ancillary information (i.e., wavelengths) that is used in ENVI.
From the File Type drop-down list, select a file type.
Tip
For a complete list of all file types recognized by ENVI, see the filetype.txt file in the menu directory. You may edit this file and add new user-defined file types (see "Custom File Input" in the ENVI Programmer's Guide). |
The file types include ENVI-specific file types such as meta files, classification files, virtual mosaics, spectral libraries, and FFT results. The file types also encompass data-specific formats such as NLAPS, RadarSat, SPOT, etc. TIFF, BMP, ERDAS IMAGINE 8.x and PCI files are also recognized.
Inputting Header Information from Other Files
In the Header Info dialog, use the Input Header Info From drop-down list to incorporate the header information of another open file into the header of the current file.
- From the Header Info dialog menu bar, select Input Header Info From
Other File.
- Select the file containing the header information and click OK.
Editing Ancillary Header Information
ENVI headers may have associated ancillary information (Band Names, Spectral Library Names, Wavelengths, Bad Bands List, FWHM) depending on the image data type.
In the Header Info dialog, use the Edit Attributes drop-down button to edit ancillary header information such as band names and wavelengths, to edit map, classification, Z-plot and stretching information, and to determine what images to display for complex data types.
Selecting Bad Bands
Use the Bad Bands List to select bands to exclude from plotting or optionally omitted during processing. The Bad Bands list is often used to omit the water vapor bands in hyperspectral data sets.
- From the Header Info dialog menu bar, select Edit Attributes
Bad Bands List.
- In the Edit Bad Bands List values dialog, all bands in the list are highlighted by default as good. Deselect any desired bands in order to designate them as bad bands.
To designate a range of bands, enter the beginning and ending band numbers in the text boxes next to the Add Range button. Click Add Range.
- Click OK.
Editing Band Names or Spectral Library Names
- From the Header Info dialog menu bar, select Edit Attributes
Band Names, or Spectral Library Names.
- Click on the name to change in the list. The value appears in the text box under the Edit Selected Item label.
- In the text box, type the new name and press the Enter or Return key.
- Click OK.
Editing Wavelengths and FWHM
- From the Header Info dialog menu bar, select Edit Attributes
Wavelengths or FWHM.
- Click on the value to change in the list. The value appears in the text box under the Edit Selected Item label.
- In the text box, type the new value and press the Enter or Return key.
- In the Wavelength/FWHM Units: drop-down list, select the units to use with your wavelength and FWHM values.
Note
The wavelength units are used to scale correctly between different wavelength units in ENVI's Endmember Collection dialog. For more information, see Collecting Endmember Spectra. |
- Click OK.
Importing Header Data from ASCII Files
- In any Edit Values dialog, click Import ASCII.
- When the standard ENVI File Selection dialog appears, open the ASCII file. The Input ASCII File dialog appears with first few values from the ASCII file listed.
Note
The number of rows of the ASCII file must match the number of bands in the image file. The ASCII file may have one or more columns of ASCII data, while the file used to import band names can only contain strings. |
- In the Wavelength Column text box, enter the number of the ASCII column that contains the wavelengths.
Note
To scale the wavelength values on-the-fly, enter a multiplicative scale factor in the Multiply Factor text box. For example, to multiply the imported wavelength values by 100, enter 100. |
- In the FWHM Column text box, enter the number of the ASCII column that contains the band width information (used in spectral resampling).
Note
The ASCII file can also contain a Bad Bands List column. The Bad Bands List column specifies a good band with a 1 and bad band with a 0. |
- Enter the number of the ASCII column that contains the Bad Bands List.
- Click OK.
- Click OK in the Header Info dialog to write all of the changes to the header file.
Setting Default Bands to Load
Use Default Bands to Load to identify the bands to automatically load into the a new display group when the file is opened. Either a grayscale image or a color image can be selected.
- From the Header Info dialog, select Edit Attributes
Default Bands to Load. The Default Bands to Load dialog appears with a list of all the bands in the file.
- Click on the bands names to load in the red (R), green (G), and blue (B) guns.
- If only one band is selected, it is loaded as a grayscale image.
- Click Reset to clear the bands.
- Click OK to return to the Header Info window.
When the file is opened, the bands are automatically loaded into a new display group.
Entering Gains and Offsets
Use Gains and Offsets to enter values to use as default values in the Basic Tools
Preprocessing
General Purpose Utilities
Apply Gain and Offset function. For more information, see Applying Gain and Offset.
- From the Header Info dialog, select Edit Attributes
Gains or Offsets.
- Click on the value to change in the list. The value appears in the text box under the Edit Selected Item label.
- In the text box, type the new value and press Enter or Return.
- Click OK.
Entering Map Information for Georeferenced Files
Map information is associated with georeferenced files. In ENVI, the term georeferenced refers to images that are geometrically corrected (i.e., rectified) such that they conform to a known projection. To establish the georeferenced data coordinate system, you must know the sample and line coordinates of one pixel (the reference pixel), the pixel size, the map projection, and map coordinates of this pixel.
Note
In ENVI, pixel values always refer to the upper-left corner of the pixel. Map coordinates also typically refer to the upper-left corner of the pixel. However, if you want the map coordinate to reference the middle of the pixel, add 0.5 to the image coordinate of the reference pixel specified in the Map Info field of the header (e.g., x = 1.5, y = 1.5 would make the map coordinates refer to the center of the pixel). |
- From the Header Info dialog, select Edit Attributes
Map Info.
- In the Edit Map Information dialog, enter the reference pixel coordinates in the Image Coordinate of Tie Points X and Y text boxes and the pixel size in the Pixel Size and Rotation X and Y text boxes. Be sure to enter the pixel size in the units appropriate for your selected projection.
- If north is not up in the image, enter a rotation angle in degrees in the Map Rotation text box. Measure the angle in a clockwise direction where zero degrees is straight up (see Overlaying Grid Lines).
- Select the map projection by clicking on Change Proj and selecting the appropriate projection from the list of projections (see Selecting Map Projection Types).
- Enter the coordinates of the reference pixel in the appropriate text boxes.
Note
The corresponding latitude and longitude are automatically calculated and can be viewed by clicking on the arrow toggle button for Proj:. |
- Click OK to return to the Header Info window.
Associating a DEM to a File
You can associate a DEM (Digital Elevation Model) with an image via the ENVI header file. This allows you to retain the association between the two files in a persistent manner. You can also break the association by editing the ENVI header file to remove the reference to the DEM file.
To associate a DEM with an image, perform the following steps.
Note
When a DEM band is chosen, no checks are performed to assure the DEM is complimentary to the image; that is, no check is made to verify they are georeferenced and cover the same area. |
- From the Header Info dialog menu bar, select the Edit Attributes
Associate DEM File option.
- If an association already exists, the Associate DEM with File dialog appears. Select either Edit existing DEM file association, or Clear existing DEM file association.
- If you choose Edit existing DEM file association, a Select DEM Band to Associate With This File dialog appears. The existing associated band is highlighted by default. Edit the DEM file association by selecting another band to associate. Click OK.
- If you choose Clear existing DEM file association, the Associate DEM with File dialog closes, the association no longer exists, and you are returned to the Header Info dialog.
If the association of a DEM with this image is new, a file selection dialog appears. (Spectral or spatial subsets are not allowed in this dialog.) Select a band as the associated DEM. Click OK.
When a DEM association is selected, two fields (Table 2-1) are written to the ENVI header file.
Table 2-1: Associated DEM Header Fields
Table 2-1: Associated DEM Header Fields
|
Field
|
Description
|
|
dem file = /path/file
|
Path and Filename of selected DEM file
|
|
dem band = 2
|
Index (starting at 1) of selected DEM band
The dem band is not written if the DEM file contains a single band, or if the first band of an image was chosen. In these cases, the dem band value defaults to 0.
|
|
Note - Neither field is written 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.
|
Whenever an image which has an associated DEM is opened, the DEM is also opened in the Available Bands List.
The DEM is not displayed in the Available Bands List if the associated DEM file is not found by ENVI. When this happens, an error message is returned and the base image is still opened in the Available Bands List, but the DEM is not.
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 - The associated DEM file is used as the default and you are not prompted to select a DEM for the surface.
- RPC Projection Emulation - If an image displays using RPC projection emulation and it has an associated DEM, the DEM is used to refine the RPC solution. This increases the positional accuracy of the RPC solution.
Note
For this function, the DEM must contain map information covering the area for the RPC image; otherwise, the default elevation is used. |
- RPC Orthorectification - If an image being orthorectified has an associated DEM file, then it is used by default as the elevation input to the orthorectification process. You can change this default designation at any time, if desired.
Emulating an RPC Projection
If your file has an associated RPC file, use this method to automatically use the RPC file to derive RPC-based geolocation information for individual pixels in an image. A file containing the image RPCs is required. The geolocations are determined from a pseudo projection, which is emulated from the provided RPC model. This method does not change the appearance of the image, it simply calculates the correct geolocation for each individual pixel.
Note
This RPC-based georeferencing method is less computationally and disk space intensive than a full orthorectification process performed on the imagery; however, the full orthorectification process provides greater accuracy. |
To establish a pseudo projection emulated from a file containing RPCs, perform the following steps:
- From the Header Info dialog, select Edit Attributes
RPC Projection Emulation. If an associated RPC file cannot be found, a warning dialog appears prompting you to select a file containing the RPC coefficients. The RPC Parameters dialog appears when a file containing RPCs is determined.
- Toggle the arrow button to set RPC Projection Emulation Enabled to either
On (enabled projection) or Off (use the native map information, if any).
If needed, use the Select Projection section of the RPC Parameters dialog to modify the projection used to report the resulting geolocation information. Different parameters are available depending on the selected projection type.
- To change the datum for a projection type, click Datum and select a datum from the list in the Select Geographic Datum dialog.
- If you select UTM, click the N or S toggle button to indicate if the selected latitude is north (N) or south (S) of the equator. Enter a zone, or click Set Zone and enter the latitude and longitude values to automatically calculate the zone.
- If you select a State Plane projection, enter the zone or click Set Zone and select the zone name from the list.
Both NOS and USGS zone numbers are shown next to the zone name.
- To designate the units for a projection type, click Units and select a unit type for the pop-up dialog.
- Click OK to return to the Header Info window.
Entering Geographic Information for Non-Georeferenced Files
If your file is not georeferenced but does include geographic information, use this procedure to place that information in the ENVI header file. Currently, ENVI uses the first geographic point to place a flag on the geo-browser showing the location of the file (see Opening Files with the Geo-Browser). The other points remain in the header for your information only (image georeferencing is defined using the MapInfo field).
- From the Header Info dialog, select Edit Attributes
Geographic Corners.
- Enter between one and four pixel locations and their corresponding latitudes and longitudes.
Note
In ENVI, pixel values always refer to the upper-left corner of the pixel. Map coordinates also typically refer to the upper-left corner of the pixel. However, if you want the map coordinate to reference the middle of the pixel, add 0.5 to the image coordinate of the reference pixel specified in the Map Info field of the header (e.g., x = 1.5, y = 1.5 would make the map coordinates refer to the center of the pixel). |
Entering Pixel Sizes for Non-Georeferenced Files
- From the Header Info dialog menu bar, select Edit Attributes
Pixel Sizes.
- Enter the X and Y pixel sizes into the appropriate text boxes and select the desired units from the Units drop-down list.
Editing Classification Information
- From the Header Info dialog, select Edit Attributes
Classification Info.
Note
The File Type must be set to Classification for this selection to be available. |
- Enter the number of classes in the Classification Info dialog and click OK. The Class Color Map Editing dialog appears.
- In the Class Color Map Editing dialog, click on the class name of the region to change from the list Selected Classes.
- To change a selected class name, edit it in the Class Name text field.
- To change the class color in the RGB color space (0-255 for the three colors), move the three sliders labeled Red, Green, or Blue.
- To reset the original class colors and names, click Reset.
- To change the class colors in the HSV or HLS color spaces, from the System drop-down list in the Class Color Map Editing dialog, select the appropriate system. Move the Hue, Saturation, Value or Hue, Lightness, Saturation sliders to the desired values.
- To make the changes permanent, click OK.
Note
On 24-bit color displays, ENVI does not automatically apply the color changes. Instead, for 24-bit hardware, apply color changes to the image by clicking on the Apply Changes button, which appears only when 24-bit color is available. |
Changing Z Plot Information
Use Z Plot Information to change Z profiles, set axes titles, set a Z Plot box size, or specify an additional Z profile filename.
- From the Header Info dialog, select Edit Attributes
Z Plot Information. The Edit Z Plot Information dialog appears.
- Select from the following options:
- Enter the minimum range value in the left and maximum value in the text boxes labeled Z Plot Range.
- Enter the desired axes titles into the X Axis Title and Y Axis Title fields.
- To specify the size (in pixels) of the box used to calculate an average spectrum, enter the parameters into the Z Plot Average Box fields.
- To specify an additional filename from which to extract Z profiles, click Default Additional Z Profiles. When the Default Additional Z Profiles dialog appears, click Add New File.
- Select the desired filename and click OK. The filename appears in the list.
- To remove a filename from the list, click on the filename and click Remove Selected File.
Entering a Reflectance Scale Factor
Use Reflectance Scale Factor to enter a reflectance scale factor that is used in ENVI's Endmember Collection to correctly scale library data or other reflectance data to match the image data. If one of the files used in the Endmember Collection does not have a reflectance scale factor defined, then no scaling is done.
- Select Edit Attributes
Reflectance Scale Factor and enter the value that, when divided into your data, would scale it from 0 to 1. 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.
- Click OK.
Entering a Data Value to Ignore
This parameter is currently used only for ENVI programming. See ENVI_FILE_QUERY for details.
Entering Sensor Types
- From the Header Info dialog, select Edit Attributes
Sensor Type.
- From the list, select a sensor type.
Setting the Default Stretch
Use Default Stretch to set the default stretch to use when displaying a band from the file.
- From the Header Info dialog menu bar, select Edit Attributes
Default Stretch.
- From the Default Stretch menu, select the stretch type. Your choices include: linear, linear range, gaussian, equalize, square root, or none.
Some of the stretches require you to enter additional information:
- For the % Linear stretch, enter the percentage of the data to clip (i.e. 5%).
- For Linear Range stretching, enter the minimum and maximum DN values to use in the stretch.
- For Gaussian stretching, enter the number of standard deviations to use in the stretch.
ENVI saves the stretch setting in the .hdr file. Whenever you display this image, this stretch setting overrides the global default stretch given in the envi.cfg file.
Note
If the Default Stretch is set to None, use the Default Stretch set in the ENVI Configuration File (envi.cfg). |
Using the Complex Lookup Function
For complex data types, use Complex Lookup Function to determine which image to display.
- From the Header Info dialog menu bar, select Edit Attributes
Complex Lookup Function.
- When the Complex Data Lookup Function dialog appears, select the desired lookup function from the drop-down list: Real (real portion of number), Imaginary (imaginary portion), Power (log10 of magnitude), Magnitude (square root of sum of the squares of the real and imaginary), and Phase (arc tangent of imaginary divided by real). The default image is Power.
Setting Row Offsets
Use Major/Minor Frame Offsets to set the number of extra bytes to skip at the beginning and ending of lines and bands. An offset is non-image data that you want to skip, and it comes before and/or after a frame. A minor frame is one-dimensional, and a major frame is two-dimensional.
See Table 2-2 for definitions of major and minor frames for the various file formats.
- From the Header Info dialog menu bar, select Edit Attributes
Major/Minor Frame Offsets.
- In the Major/Minor Frame Offsets dialog, enter or select the number of prefix and suffix bytes to skip per major or minor frame by clicking on the arrow buttons or by typing into the text boxes.
The following table contains major and minor definitions for the file formats in ENVI.
Table 2-2: Major and Minor Frame Definitions
Table 2-2: Major and Minor Frame Definitions
|
File Format
|
Minor Frame
|
Major Frame
|
|
BSQ
|
# of samples (line)
|
# of samples by # of lines (band)
|
|
BIL
|
# of samples (line)
|
# of samples by # of bands
|
|
BIP
|
# of bands (spectrum)
|
# of bands by # of samples
|
- Click OK.
ENVI Online Help (August 12, 2005)