Blame view

matlab/LoadENVI.m 758 Bytes
5f3cba02   David Mayerich   initial public co...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  %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);