-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcluster_scan.m
59 lines (47 loc) · 1.75 KB
/
cluster_scan.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
57
58
59
function cluster_scan(datafile,n)
load(datafile)
addpath(ULTRATRACK_PATH)
addpath([ULTRATRACK_PATH '/URI_FIELD/code']);
addpath([ULTRATRACK_PATH '/URI_FIELD/code/probes']);
addpath(FIELD_PATH);
field_init(-1)
tstep=sscanf(phantom_files(n).name,[phantom_name '%03d']);
if isempty(tstep),
% Warn that we're skipping a file
warning(['Skipping ' phantom_files(n).name]);
else
% Load the phantom
s=[phantom_path phantom_files(n).name];
bungle=load(s); % an hour of pain here. phantom was being
% clobberd by function phantom.
disp(['Processing ' s]);
dog=bungle.phantom;
% Scan the phantom
% Changed to allow for the Rx beam to be offset from the Tx
% beam
% Mark 06/15/05
% Swapped TX offsets for RX offsets and rolled them into beamset
% Pete 2012.11.2
[rf,t0]=uf_scan(probe,beamset,dog);
% Prepend zeros to make all start at zero
rf=[zeros(round(t0*probe.field_sample_freq),beamset.no_beams,beamset.no_beamsy,beamset.no_parallel);rf];
t0=0;
% convert to single precision
rf = single(rf);
t0 = single(t0);
% Save the result
rffile = sprintf('%s%03d',OUTPUT_FILE,n);
save(rffile,'rf','t0');
end; % matches if isempty(tstep)
%delete temporary file if you are the last one to finish.
d = dir([OUTPUT_FILE '*.mat']);
fprintf('%0.0f/%0.0f timesteps completed.',length(d),length(phantom_files));
if length(d)==length(phantom_files)
%fprintf('Last file in. Deleting %s...\n',datafile);
fprintf('Last file in.\n',datafile);
%pause(0.1);
%if exist([datafile '.mat'],'file'); %Attempt to handle tiebreakers...
% delete([datafile '.mat'])
%end
end
field_end