-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_bin_test.m
51 lines (42 loc) · 989 Bytes
/
read_bin_test.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%%
nFrames = 3000;
iplane = 2;
nPlanes = 4;
Lx = 512;
Ly = 512;
data = zeros(Ly,Lx,nFrames,'uint16');
precision = [num2str(Ly*Lx) '*uint16'];
skip = 2*Ly*Lx*(nPlanes-1);
fname = 'E:\Data\Henry\20180705\20180705_L494_t-006.bin';
fid = fopen(fname);
fread(fid,2,'uint16');
tic
fread(fid,(iplane-1)*Lx*Ly,'uint16');
for i = 1:nFrames
temp = fread(fid,[Ly,Lx],precision,skip);
data(:,:,i) = permute(temp, [2 1 3]);
end
toc
%%
fname = 'E:\Data\Henry\20180705\20180705_L494_t-006.bin';
fid = fopen(fname);
fread(fid,2,'uint16');
tic;
temp = fread(fid,Ly*Lx*nFrames*nPlanes,'uint16');
temp = reshape(temp, Lx, Ly, []);
data = permute(temp, [2 1 3]);
data = data(:,:,1:nPlanes:end);
toc
%%
nPlanes = 4;
Lx = 512;
Ly = 512;
figure
for iPlane = 1
fname = 'E:\Data\Henry\20180705\20180705_L494_t-006.bin';
fid = fopen(fname);
fread(fid,2,'uint16');
[data] = read_bin(fid,Lx,Ly,nFrames,iPlane,nPlanes);
subplot(1,nPlanes,iPlane)
imshow(mean(data,3),[])
end