Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  ENVI API  >  Custom File Readers


Custom File Readers

Custom File Readers

To read an image format that ENVI does not already support, you must write a custom file reader that consists of a required spatial and an optional spectral read routine. Spatial read routines handle all spatial data requests, ranging from an entire band to a single pixel. Spectral read routines handle all spectral data requests, ranging from all spectra for an entire line to a single spectrum. In simple cases, read routines perform data format conversions; in more complex cases, they interface to an image database where data requests are pulled directly from the database.

You have two options for implementing custom file readers. Each option has different requirements and instructions.

Custom Image Format with ENVI Header

Use this option to create a custom image format with an ENVI header and to use the File > Open menu to open it.

  1. Create an ENVI header file (.hdr) for the image with all required fields defined. The header file must have the following line:
  2.   read_procedures = [spatial_routine_name, spectral_routine_name]

    where the two array elements are the names of the spatial and spectral read routines (in that order). The spectral read routine is optional.

  3. Write the spatial and spectral read routines as IDL .pro or .sav files, then save the files as described in Save Custom File Readers.
  4. Use the File > Open menu option or the OpenRaster method to the ENVI object to open the image. ENVI will see the read_procedures line in the associated header file and use the custom spatial and spectral readers to open the image.

If the header file contains any user-defined metadata tags, they will be available for querying or editing in the API and will be listed under the "User-Defined" section of the Metadata Viewer.

Custom Open Procedure

Use this option to read a custom data file without an ENVI header, or when you want to pass custom metadata into your spatial and spectral readers. You can add this procedure to the ENVI menu under File > Open As > Custom.

  1. Write a custom open procedure.
  2. Write the spatial and spectral read routines as IDL .pro or .sav files.
  3. Save the custom open procedure, spatial read routine, and spectral read routine as described in Save Custom File Readers.

If the open procedure also contains a custom_reader_init procedure, ENVI will automatically detect the open procedure upon startup and add it to the menu.

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us