Code covered by the BSD License  

Highlights from
ENVI file reader, updated 2/9/2010

4.66667

4.7 | 4 ratings Rate this file 36 Downloads (last 30 days) File Size: 3.36 KB File ID: #15629
image thumbnail

ENVI file reader, updated 2/9/2010

by Ian Howat

 

19 Jul 2007 (Updated 09 Feb 2010)

Read ENVI raster files. Supports all interleaves, data types (except complex) and byte orders.

| Watch this File

File Information
Description

I = ENVIREAD(FILENAME) Reads an ENVI binary file into an array using the information from the corresponding header file FILENAME.hdr. The output structure I contains fields I.x, I.y, I.z and I.info containing the x-coordinate vector, y-coordinate vector, images data and header info, respectively. I.z will be in whatever number format (double, int, etc.) as in the envi file.

I= ENVIREAD(FILENAME,HEADERFILE); Uses the header information in headerfile.
'
Thanks to Yushin Ahn for his modifications.
NOTES:
-Geo-registration does not currently support rotated images.
- No support for importing complex data .

Acknowledgements
This submission has inspired the following:
ENVI file reader/writer, geotiff reader
MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
20 Jul 2007 Ian Howat

Notice (7/19/2007) There's a bug in the current version that keeps it from loading 1-band images correctly. I've uploaded an update, so you'll want to wait and download when the system posts the revised version on 7/20/2007.

25 Jul 2007 Ian Howat

If the map/image coordinates in the map info in the header are not the upper left corner (1.5,1.5), the program will not create the correct X Y vectors. I've uploaded a fix for this.

18 Jan 2008 Cuneyt Utku

Very useful. Code is easy to follow.
I downloaded it on Jan 18, 2008. It is version 1, dated 11-Jul-2007 and apparently still has the bugs mentioned above.

26 Oct 2009 Carlos Esquerre

It works pretty good. I made a small modification to read files without geographical information since I work with hyperspectral image of mushrooms.

22 Mar 2010 Niek Sanders

To make enviread play nice with files lacking geolocation, I had to modify line 38 to be:

if isfield(info,'map_info') && ...
   isfield(info.map_info,'mapx') && isfield(info.map_info,'mapy')

Note the first isfield() to check if the datastructure even exists.

06 Apr 2010 Niek Sanders  
06 Apr 2010 Niek Sanders  
18 Jan 2012 Jaroslaw Tuszynski

A better option is to use MATLAB's multibandread function

Please login to add a comment or rating.
Updates
20 Jul 2007

updated description and added screen shot

20 Jul 2007

Fixed bug that prevented single-band files from loading correctly.

26 Jul 2007

-Fixed problem with reading image coordinates when a point other than the upper left corner is in the header. The fields info.map_info.ulx and uly are now mapx and mapy to reflect this.

02 Aug 2007

Added support for all formats except complex and double complex.

02 Aug 2007

Fixed summary.

06 Nov 2009

-Inserted envireadhdr function as a subfunction.
-changes output to be structure format
-modified fread loop to handle larger files.

09 Feb 2010

- Restored functionality for reading BIL and BIP interleave formats.

Tag Activity for this File
Tag Applied By Date/Time
data import Ian Howat 22 Oct 2008 09:19:43
data export Ian Howat 22 Oct 2008 09:19:43
envi Ian Howat 22 Oct 2008 09:19:43
import Ian Howat 22 Oct 2008 09:19:43
io Ian Howat 22 Oct 2008 09:19:43
read Ian Howat 22 Oct 2008 09:19:43

Contact us at files@mathworks.com