1234567891011121314151617181920212223 |
- function frame_data = readFrames_fromBin(binFile,allsignalsFile,firstFrame,numFrames)
- % input
- % binFile = full file path to binary file for the experiment.f
- % matFile = full file path to the 'allsignals.mat' file.
- % firstFrame = position of the first frame to be read. For example, if
- % you want to pull one of the files, you can enter one of the values in
- % config.fileInfo.starFrame.
- % numFrames = number of frames from the firstFrame to be read.
- % output
- % frame_data = matrix of intensity values for the frames that was
- % specificed. The first two dimensions are the size of the field of view
- % in pixels, and the third dimension is the frames. The format of the
- % data is in unsigned 16-bit integer.
- %
- load(allsignalsFile)
- fid = fopen(binFile);
- Ly = config.imageDimension(2);
- Lx = config.imageDimension(1);
- fseek(fid,Ly*Lx*(firstFrame-1)*2,'bof'); % position the data cursor right before the first of the frame to be read
- frame_data = fread(fid,Ly*Lx*numFrames,'*uint16');% read the specified frames from the binary
- frame_data = reshape(frame_data,Ly,Lx,[]);% reshape the data into final form;
- fclose(fid);% close the file before exiting
|