Blame view

matlab/spe2envi.m 825 Bytes
c53a310f   Camille Artur   added support for...
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
33
  function spe2envi(filemask, outfile)
  
      filelist = dir(filemask);
  
      %get a list of date numbers
      datenums = cell2mat({filelist.datenum});
  
      %sort the file order based on acquisition time
      [~, id] = sort(datenums);
  
      %get the number of files
      Y = length(id);                 %size of the image along Y
  
      %load the first file to determine the spectral and X-axis size
      temp = readspe(filelist(1).name);
      X = size(temp, 1);              %size of the image along X
      B = size(temp, 2);              %number of bands in the image
  
      %create the cube
      I = zeros(X, Y, B);
  
      %for each line
      for y = 1:Y
  
          %read a SPE file
          img = readspe(filelist(id(y)).name);
  
          I(:, y, :) = permute(img, [1 3 2]);
      end
  
      enviSaveRaw(single(I), outfile, [outfile '.hdr']);