%loads an ENVI file without any manipulation (changing orientation) % Scalable Tissue Imaging and Modeling Laboratory % University of Houston % developer: David Mayerich (mayerich@uh.edu) function M = enviLoadRaw(filename, headername) if nargin == 1 headername = [filename '.hdr']; end h = enviLoadHeader(headername); if strcmp(h.interleave, 'bsq') X = h.samples; Y = h.lines; Z = h.bands; elseif strcmp(h.interleave, 'bil') X = h.samples; Y = h.bands; Z = h.lines; else X = h.bands; Y = h.samples; Z = h.lines; end fid = fopen(filename); M = fread(fid, [X, Y*Z], '*float32'); M = reshape(M, [X, Y, Z]); fclose(fid);