-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadDBL_Full.m
More file actions
32 lines (26 loc) · 806 Bytes
/
readDBL_Full.m
File metadata and controls
32 lines (26 loc) · 806 Bytes
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
function image = readDBL_Full(filename)
% read data from a .dbl file in Matlab
% images have 128 byte headers
% read 4D data stack
%
% Header format should be Z, Y, X, T
%
% originally copied from Edward Allgeyer
fid = fopen(filename, 'r');
try
pxsize = fread(fid, 4, 'uint16', 'b');
fseek(fid, 128, -1);
image = single(zeros(pxsize(2), pxsize(3), pxsize(4), pxsize(1)));
for time = 1:pxsize(4)
for z = 1:pxsize(1)
try
image(:, :, time, z) = fread(fid, [pxsize(2), pxsize(3)], 'single', 'l');
catch
fprintf(1, 'Error reading from file %s\n', filename);
end;
end;
end;
catch
fprintf(1, 'Error reading from file %s\n', filename);
end;
fclose(fid);