Code covered by the BSD License  

Highlights from
read_envihdr

Be the first to rate this file! 26 Downloads (last 30 days) File Size: 3.19 KB File ID: #38500

read_envihdr

by

 

Robust reader of ENVI header files.

| Watch this File

File Information
Description

INFO = READ_ENVIHDR('HDR_FILE') reads the ASCII ENVI-generated image header file and returns all the information in a structure of parameters. Usefull in combination with MATLAB multibandread function capable of reading ENVI binary files.

The file is a result of frustration with other ENVI header readers found on MATLAB File Exchange, which I could never get to work properly.

Output:
* Info - struct with fields provided in the ENVI file. ENVI header format requires the following fields (if other fields are provided then they will also be included.
* samples - number of samples in the image (columns)
* lines - number of lines in the image (rows)
* bands - number of bands in the image. If all 3 dimensions are provided than info.size will be created holding [info.lines info.samples info.bands]
* data_type - data type of the image stored as an integer in 1-15 range. If provided than info.format will be created holding string with Matlab's type name.
* interleave - file band interleave type; either bip, bsq, or bil are possible
* byte_order - byte order (0 is little endian [least significant byte first], 1 is big endian [most significant byte first]). If provided than info.machine will be created holding either 'ieee-le' or 'ieee-be' string.

Example 1:
>> info = read_envihdr('my_envi_image.hdr')
   info =
          description: [1x101 char]
              samples: 658
                lines: 749
                bands: 3
                 size: [749 658 3]
        header_offset: 0
            file_type: 'ENVI Standard'
            data_type: 4
              format : 'single'
           interleave: 'bsq'
          sensor_type: 'Unknown'
           byte_order: 0
             map_info: [1x1 struct]
      projection_info: [1x102 char]
     wavelength_units: 'Unknown'
           pixel_size: [1x1 struct]
           band_names: [1x154 char]
Example 2:
>> info = read_envihdr('my_envi_image.hsi');
>> Z = multibandread('my_envi_image.hsi', info.size, [info.format '=>double'], info.header_offset, info.interleave, info.machine);

MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us