Newer
Older
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
function [corrz,vol2]=scalVolume(name,x,y,z,num)
vol=edf_read(name);
s=size(vol);
tmp1=zeros(x,y,z);
tmp2=zeros(x,y,z);
tmp3=zeros(y,x,z);
min=round(s(1)/2-100+1);
max=round(s(1)/2+100);
for i=1:z
tmp1(1:x,1:y,i)=vol(1:x,1:y,i);
tmp2(1:x,1:y,i)=vol(s(1)-x+1:s(1),1:y,i);
tmp3(1:y,1:x,i)=vol(min:max,1:x,i);
end
tmp3b=zeros(x,y,z);
if num==3
for i=1:z
im=tmp3(:,:,i);
im2=im';
tmp3b(:,:,i)=im2;
end
tmp=(tmp1+tmp2+tmp3b)/3;
else
tmp=(tmp1+tmp2)/2;
end
corrz=(mean(squeeze(mean(tmp,1)))+mean(squeeze(mean(tmp,2))))/2;
vol2=vol;
for i=1:z
vol2(:,:,i)=vol2(:,:,i)-corrz(i);
end
end