%  Name: Hyperspectral reader
%  Date: 2/2009
%  Written: HE

flg=1;
if flg == 0
    pathh='A062503_122721.tif'; samples=676; lines=516; bands=33;
    idx={       2,       7,      12,      17,      22,      29};
    wav={'450 nm','500 nm','550 nm','600 nm','650 nm','700 nm'};
else
    pathh='A062503_125119.tif'; samples=332; lines=248; bands=38;
    idx={       1,       6,      14,      24,      29,       37};
    wav={'650 nm','700 nm','750 nm','800 nm','920 nm','1000 nm'};
end

fid=fopen(pathh,'r');
if(fid ~= -1)
    [im,cnt]=fread(fid,[samples,lines*bands],'int16');
    fclose(fid);
end
im=reshape(im,samples,lines,bands);
figure;
for i=1:length(idx)
   nim=im(:,:,idx{i}); nim=circshift(nim,[-120, 0]);
   subplot(2,3,i); imagesc(nim); colormap(gray); title(['Wavelength:' wav{i}]);
end

