-
Notifications
You must be signed in to change notification settings - Fork 1
/
read_logs.m
51 lines (44 loc) · 1.47 KB
/
read_logs.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
function param = read_logs (param)
%% read log files
pathNpattern = sprintf('%s*FrameNumber_%04d_*.log',param.inter,param.m);
logs = dir(pathNpattern);
if isempty(logs)
disp('WTF?');
fprintf('%s\n',pathNpattern);
keyboard
end
content = fileread([logs(1).folder '/' logs(1).name]);
eval(['param.transM = ' get_match('trans',content) ';']);
eval(['param.rotM = ' get_match('rot',content) ';']);
eval(['param.centroidM = ' get_match('centroid',content) ';']);
eval(['param.clipM = ' get_match('clip',content) ';']);
pathNpattern = sprintf('%s*FrameNumber_%04d_*.log',param.inter,param.n);
logs = dir(pathNpattern);
if isempty(logs)
disp('WTF?');
fprintf('%s\n',pathNpattern);
keyboard
end
content = fileread([logs(1).folder '/' logs(1).name]);
eval(['param.transN = ' get_match('trans',content) ';']);
eval(['param.rotN = ' get_match('rot',content) ';']);
eval(['param.centroidN = ' get_match('centroid',content) ';']);
eval(['param.clipN = ' get_match('clip',content) ';']);
if ~isempty(find( (param.clipN-param.clipM) ~= 0))
disp('WTF?');
keyboard
end
param.clip = param.clipN; % equal to clipM
if ~isempty(find( (param.centroidN-param.centroidM) ~= 0))
disp('WTF?');
keyboard
end
param.centroid = param.centroidN ...
+ [param.clip(1)*param.voxel_y param.clip(3)*param.voxel_x 0];
end
function out = get_match (str, content)
expr = ['[^\n]* ' str ':[^\n]*'];
match = regexp(content,expr,'match');
s = regexp(match,'\[.*\]','match');
out = s{1}{1};
end