-
Notifications
You must be signed in to change notification settings - Fork 0
/
S4_gen_dataset.m
57 lines (52 loc) · 2 KB
/
S4_gen_dataset.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
52
53
54
55
56
%{
get the ANN training data and ground truth data
CS Sun
Last update: 2022/08/31
%}
clear all
counts = zeros(2808,26);
subject = "ZJ";
mode = ["ground","train"];
sim_index_set=load('thisPC_sim_wl_index.txt');
sds = 6;
do_normalize = 0;
for m=1:size(mode,2)
folder_name = fullfile(subject,mode(m));
mus_table = load(fullfile(subject,mode(m),'mus_table.txt'));
if do_normalize==1
mean_mus_table = mean(mus_table/10);
std_mus_table = std(mus_table/10);
for i=sim_index_set(1):sim_index_set(2)
filename = fullfile(folder_name,['sim_' int2str(i)],'cfg_1.mat');
load(filename)
filename = fullfile(folder_name,['sim_' int2str(i)],'PL_1.mat');
load(filename)
detp.ppath = 10*SDS_detpt_arr{sds};
photon_weight = each_photon_weight_arr(sds);
tof=mcxdettime(detp,cfg.prop);
[tempcounts, idx]=histc(tof,0:cfg.tstep:cfg.tend);
tempcounts = tempcounts';
norm_prop = (cfg.prop(2:5,2)' - mean_mus_table(1:4))./std_mus_table(1:4);
counts(i,:) = [norm_prop,-log((tempcounts+1)/photon_weight)];
end
else
for i=sim_index_set(1):sim_index_set(2)
filename = fullfile(folder_name,['sim_' int2str(i)],'cfg_1.mat');
load(filename)
filename = fullfile(folder_name,['sim_' int2str(i)],'PL_1.mat');
load(filename)
detp.ppath = 10*SDS_detpt_arr{sds};
photon_weight = each_photon_weight_arr(sds);
tof=mcxdettime(detp,cfg.prop);
[tempcounts, idx]=histc(tof,0:cfg.tstep:cfg.tend);
tempcounts = tempcounts';
figure('Name',mode(m),'NumberTitle','off');
plot(0:cfg.tstep:cfg.tend,tempcounts(i,:))
title(mode(m))
counts(i,:) = -log((tempcounts+1)/photon_weight);
end
end
mkdir('ANN_'+ mode(m))
save(fullfile('ANN_'+ mode(m),mode(m)+'.txt'),'counts','-ascii','-tabs')
% plot(0:cfg.tstep:cfg.tend,counts(i,:))
end