Raw image data in scanbox is contained in *.sbx files. To read these data you can use the sbxread() function.
Here is the documentation from its help section–
function x = sbxread(fname,k,N,varargin) % img = sbxread(fname,k,N,varargin) % % Reads from frame k to k+N-1 in file fname % % fname - the file name (e.g., 'xx0_000_001') % k - the index of the first frame to be read. The first index is 0. % N - the number of consecutive frames to read starting with k. % % If N>1 it returns a 4D array of size = [#pmt rows cols N] % If N=1 it returns a 3D array of size = [#pmt rows cols] % % #pmts is the number of pmt channels being sampled (1 or 2) % rows is the number of lines in the image % cols is the number of pixels in each line % % Note that these images are the raw data, not corrected for motion and % non-uniform sampling % % The function also creates a global 'info' variable with additional % informationi about the file
So, for example, the following lines of code will read images from 0 to 19 (20 total) and display the average of the first (green) PMT channel:
</pre> <pre>>> x = sbxread('gd8_000_000',1,20); >> imagesc(squeeze(mean(x(1,:,:,:),4))), truesize, axis off
And you may get something like this:
Note that these raw data have not yet been corrected for non-uniform sampling. To correct for non-uniform sampling you can post multiply the image with a sparse interpolant matrix stored in the global variable info.S. For example, the following lien computes the mean image of the first 20 and corrects for spatial distortion:
imagesc(squeeze(mean(x(1,:,:,:),4))*info.S), truesize, axis off
…and now you get:
The global info variable contains a number of useful information:
frame: [144x1 double] line: [144x1 double] event_id: [144x1 double] resfreq: 7938 postTriggerSamples: 5000 recordsPerBuffer: 512 bytesPerBuffer: 10240000 channels: 1 ballmotion: [] abort_bit: 0 config: [1x1 struct] messages: {72x1 cell} aligned: [1x1 struct] S: [1250x796 double] nchan: 2 fid: 7 max_idx: 9028
The variables frame, line and event_id, contain the description of TTL events that arrived during the experiment as described here. The variable S, contains the sparse interpolant matrix you can use to correct for non-uniform sampling. The other variables are used internally by sbxread() to understand how the *.sbx file is organized.
sbxread(), the new version…
A few people in my lab are asking questions.
I gather info.S is depreciated in version 2, correct?
If we save 2 PMT channels in a single sbx file, how do we generate a tif series of just the red PMT?
thx!
Yes, the info.S filed is deprecated.in version 2.
sbx2tif() assumes you want to convert the green channel only.
You can either modify the line that reads:
q = squeeze(q(1,:,:));
and replace the 1 with a 2, or modify the function to accept a pmtchan parameter to convert.
A new, improved, set of functions and an analysis GUI are now under development.