0001 function [interp_stack,nimg,plot_res]=load_interp_stack(fname, scaling_factor)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 byte_sex = 'ieee-be';
0012
0013 if nargin < 1
0014 fid = get_fid('r','*');
0015 if fid == -1
0016 disp('Invalid fid in load_interp_stack'),return
0017 end
0018 scaling_factor = 500;
0019 else
0020 fid = fopen(fname,'rb',byte_sex);
0021 if fid == -1, disp(['Could not open file <' fname '>']),end
0022 end
0023
0024 if nargin < 2, scaling_factor = 500, end
0025
0026 nrow = fread(fid, 1, 'float');
0027 ncolumn = fread(fid,1,'float');
0028 plot_res = fread(fid,1,'float');
0029
0030
0031 fseek(fid,0,'eof');
0032 nbytes = ftell(fid);
0033 nimg = (nbytes-12)/(ncolumn*nrow*4);
0034 fseek(fid,12,'bof');
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 interp_stack = zeros(nrow,ncolumn,nimg);
0046
0047 for iimg = 1:nimg
0048 temp = fread(fid,[ncolumn,nrow],'float');
0049 interp_stack(:,:,iimg) = temp' / scaling_factor;
0050 end
0051
0052 fclose(fid);
0053
0054 return