Home > eeg > egis > petr_dirtier > load_interp_stack.m

load_interp_stack

PURPOSE ^

function [interp_stack,nimg,plot_res]=load_interp_stack(fname, scaling_factor);

SYNOPSIS ^

function [interp_stack,nimg,plot_res]=load_interp_stack(fname, scaling_factor)

DESCRIPTION ^

 function [interp_stack,nimg,plot_res]=load_interp_stack(fname, scaling_factor);

  interp_stack is a 3D array which is plot_resXplot_resXnum_images

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [interp_stack,nimg,plot_res]=load_interp_stack(fname, scaling_factor)
0002 % function [interp_stack,nimg,plot_res]=load_interp_stack(fname, scaling_factor);
0003 %
0004 %  interp_stack is a 3D array which is plot_resXplot_resXnum_images
0005 %
0006 
0007 % 01/25/00  PJ  modified to return 3D structure
0008 % 06/11/00  PJ  Fixed orientation problem.  Following the last modification,
0009 %               were not being transposed before being placed on the stack.
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 % Determine the number of images in the file
0031 fseek(fid,0,'eof');
0032 nbytes = ftell(fid);
0033 nimg = (nbytes-12)/(ncolumn*nrow*4);
0034 fseek(fid,12,'bof');
0035 
0036 %
0037 % Original (presumed correct) formulation
0038 %
0039 
0040 %for iimg = 1:nimg
0041 %  temp = fread(fid,[ncolumn,nrow],'float');
0042 %  interp_stack(:,(iimg-1)*ncolumn+1:iimg*ncolumn) = temp' / scaling_factor;
0043 %end
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

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003