Previous ENVI User's Guide: File Management Next

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.

  1. From the ENVI main menu bar, select File  Edit ENVI Header. The Edit Header Input File dialog appears.
  2.  


    Tip
    You can also open the header by right-clicking the filename in the Available Bands List.

     

  3. Click on the desired filename. The file details display in the text box labeled File Information.
  4.  

  5. 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.
  6.  


    Note
    The header file does not allow class names that include commas.

     

  7. After editing the header, click OK.
  8.  


    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.

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.

  1. From the Header Info dialog menu bar, select Input Header Info From  Other File.
  2.  

  3. 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.

  1. From the Header Info dialog menu bar, select Edit Attributes  Bad Bands List.
  2.  

  3. 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.
  4.  

    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.

     

  5. Click OK.

Editing Band Names or Spectral Library Names

  1. From the Header Info dialog menu bar, select Edit Attributes  Band Names, or Spectral Library Names.
  2.  

  3. Click on the name to change in the list. The value appears in the text box under the Edit Selected Item label.
  4.  

  5. In the text box, type the new name and press the Enter or Return key.
  6.  

  7. Click OK.

Editing Wavelengths and FWHM

  1. From the Header Info dialog menu bar, select Edit Attributes  Wavelengths or FWHM.
  2.  

  3. Click on the value to change in the list. The value appears in the text box under the Edit Selected Item label.
  4.  

  5. In the text box, type the new value and press the Enter or Return key.
  6.  

  7. In the Wavelength/FWHM Units: drop-down list, select the units to use with your wavelength and FWHM values.
  8.  


    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.

     

  9. Click OK.
Importing Header Data from ASCII Files
  1. In any Edit Values dialog, click Import ASCII.
  2.  

  3. 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.
  4.  


    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.

     

  5. In the Wavelength Column text box, enter the number of the ASCII column that contains the wavelengths.
  6.  


    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.

     

  7. In the FWHM Column text box, enter the number of the ASCII column that contains the band width information (used in spectral resampling).
  8.  


    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.

     

  9. Enter the number of the ASCII column that contains the Bad Bands List.
  10.  

  11. Click OK.
  12.  

  13. 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.

  1. 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.
  2.  

  3. 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.

     

  4. 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.

  1. From the Header Info dialog, select Edit Attributes  Gains or Offsets.
  2.  

  3. Click on the value to change in the list. The value appears in the text box under the Edit Selected Item label.
  4.  

  5. In the text box, type the new value and press Enter or Return.
  6.  

  7. 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).

  1. From the Header Info dialog, select Edit Attributes  Map Info.
  2.  

  3. 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.
  4.  

  5. 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).
  6.  

  7. Select the map projection by clicking on Change Proj and selecting the appropriate projection from the list of projections (see Selecting Map Projection Types).
  8.  

  9. Enter the coordinates of the reference pixel in the appropriate text boxes.
  10.  


    Note
    The corresponding latitude and longitude are automatically calculated and can be viewed by clicking on the arrow toggle button for Proj:.

     

  11. 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.

  1. From the Header Info dialog menu bar, select the Edit Attributes  Associate DEM File option.
  2.  

  3. 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.

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:

  1. 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.
  2.  

  3. Toggle the arrow button to set RPC Projection Emulation Enabled to either On (enabled projection) or Off (use the native map information, if any).
  4.  

    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 build a customized map projection, click New and follow the instructions under Building Customized Map Projections.
    •  

    • 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.

     

  5. 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).

  1. From the Header Info dialog, select Edit Attributes  Geographic Corners.
  2.  

  3. Enter between one and four pixel locations and their corresponding latitudes and longitudes.
  4.  


    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

  1. From the Header Info dialog menu bar, select Edit Attributes  Pixel Sizes.
  2.  

  3. 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

  1. From the Header Info dialog, select Edit Attributes  Classification Info.
  2.  


    Note
    The File Type must be set to Classification for this selection to be available.

     

  3. Enter the number of classes in the Classification Info dialog and click OK. The Class Color Map Editing dialog appears.
  4.  

  5. 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.

     

  6. To make the changes permanent, click OK.
  7.  


    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.

  1. From the Header Info dialog, select Edit Attributes  Z Plot Information. The Edit Z Plot Information dialog appears.
  2.  

  3. 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.

  1. 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.
  2.  

  3. 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

  1. From the Header Info dialog, select Edit Attributes  Sensor Type.
  2.  

  3. 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.

  1. From the Header Info dialog menu bar, select Edit Attributes  Default Stretch.
  2.  

  3. From the Default Stretch menu, select the stretch type. Your choices include: linear, linear range, gaussian, equalize, square root, or none.
  4.  

    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.

  1. From the Header Info dialog menu bar, select Edit Attributes  Complex Lookup Function.
  2.  

  3. 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.

  1. From the Header Info dialog menu bar, select Edit Attributes Major/Minor Frame Offsets.
  2.  

  3. 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.
  4.  

    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

     

  5. Click OK.

  ENVI Online Help (August 12, 2005)