-
Notifications
You must be signed in to change notification settings - Fork 0
/
validation_fullsampling_ellipsoid_UT.m
78 lines (64 loc) · 1.79 KB
/
validation_fullsampling_ellipsoid_UT.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%% ellipsoid params
%delta_x, delta_y, delta_z, a, b, c, phi, theta, psi, rho
eparm =[0, 0, 0, 0.50, 0.75, 0.30, 0, 0, 0, 1];
%% construct kspace sampling
Nx=64;
Ny=64;
Nz=64;
Lx=2;
Ly=2;
Lz=2;
factor=(Nx*Ny*Nz)/(Lx*Ly*Lz);
k=gengrid(Nx,Ny,Nz,Lx,Ly,Lz);
klin = reshape(k,Nx*Ny*Nz,3);
%% setup loop
% nf=4:2:60;
% nf=60;
nf=10:10:200;
diffl2=[];
diffmax=[];
ndiffmax=[];
nfeff=[];
%% data generation loop
for a=1:length(nf)
a
%% make ellipsoid mesh
[x, y, z] = ellipsoid(0,0,0,eparm(4),eparm(5),eparm(6),nf(a));
% figure;surfl(x, y, z)
% colormap copper
% axis equal
k=convhull(x,y,z);
nfeff(a)=size(k,1);
figure; trisurf(k,x,y,z, 'Facecolor','cyan'); axis equal;
%% write the mesh
writeoff(['ellipsoid_' num2str(nfeff(a)) '.off'],verts,faces);
%% compute polyft
cverts=[x(:) y(:) z(:)]';
cfacescell=k';
singleflag=false;
debug=true;
% [kdata]=polyhedralFT({cverts},{cfacescell},1,klin',singleflag,debug);
[kdata]=polyhedralFT({cverts},{cfacescell},1,klin',singleflag,false);
%% reconstruct ours
kdata2=reshape(kdata,[Nx Ny Nz]);
fn=['optional/ellipsoidFT_64_' num2str(nfeff(a)) '.mat'];
save(fn,'kdata2');
end
%% plot faces verus nf
figure; plot(nf,nfeff);
%% write out the first three and last mesh
for a=[1:3 length(nf)]
a
%% make ellipsoid mesh
[x, y, z] = ellipsoid(0,0,0,eparm(4),eparm(5),eparm(6),nf(a));
% figure;surfl(x, y, z)
% colormap copper
% axis equal
k=convhull(x,y,z);
nfeff(a)=size(k,1);
% figure; trisurf(k,x,y,z, 'Facecolor','cyan'); axis equal;
%% write the mesh
cverts=[x(:) y(:) z(:)]';
cfaces=k';
writeoff(['ellipsoid_' num2str(nfeff(a)) '.off'],cverts,cfaces);
end