12345678910111213141516171819202122 |
- % Loads a beamlet batch into a cell array of sparse matrices
- function beamlets = open_beamlet_batch(batchname)
- fid = fopen(batchname,'rb');
- Nbeamlets = fread(fid,1,'int'); % number of beamlets in this file
- beamlets = cell(1,Nbeamlets);
- for k=1:Nbeamlets
- beamlets{k}.num = fread(fid,1,'int');
- beamlets{k}.x_count = fread(fid,1,'int');
- beamlets{k}.y_count = fread(fid,1,'int');
- beamlets{k}.z_count = fread(fid,1,'int');
- Nind = fread(fid,1,'int'); % number of non-zero values
- beamlets{k}.non_zero_indices = fread(fid,Nind,'int');
- beamlets{k}.non_zero_values = fread(fid,Nind,'float');
- % add unity to the indices to convert them from C to Matlab style
- % indexing:
- beamlets{k}.non_zero_indices = beamlets{k}.non_zero_indices + 1;
- end
- fclose(fid);
|