function [masknum, levels, boundstepsize]=maskdecode(mask);

maxval=[2000 500 300 200 200 200 200 200
500 300 200 200 200 200 200 200
300 200 200 200 200 200 200 200
200 200 200 200 200 200 200 200
200 200 200 200 200 200 200 200
200 200 200 200 200 200 200 200
200 200 200 200 200 200 200 200
200 200 200 200 200 200 200 200];

switch mask(1,1)
     case 4, masknum=1;
     case 8, masknum=2;
     case 12, masknum=3;
     case 16, masknum=4;
     case 32, masknum=5;
end
     
zmask=find(mask==0);
mask(zmask)=NaN;     
levels=2.^mask;
boundstepsize=2*maxval./levels;
