forked from JiadingGai/Impatient-MRI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
display_reconBF.m
89 lines (78 loc) · 1.99 KB
/
display_reconBF.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
78
79
80
81
82
83
84
85
86
87
88
function dummy = display_reconBF(fname,Ny,Nx,Nz)
if( ~exist([fname '/output/']) )
error_msg = [fname '/output/' ' not found!'];
disp(error_msg);
return;
end
if( exist([fname '/output/output_gpu_r.dat']) && exist([fname '/output/output_gpu_i.dat']) )
load([fname '/output/output_gpu_r.dat']);
load([fname '/output/output_gpu_i.dat']);
if(Nz==1) %2D
len = length(output_gpu_r);
size_x = len^0.5;
size_y = size_x;
size_z = 1;
gpu_output=reshape(output_gpu_r+1i*output_gpu_i,[size_x size_y size_z]);
figure;
hgpu =imagesc(abs(gpu_output));%axis image off;caxis([0,5e4])
title('Gpuslice');
colormap(gray);
colorbar;
scale = -1;
%print -dpng 'Gpu.png';
else
output = zeros(Ny,Nx,Nz);
for y=1:Ny
for x=1:Nx
for z=1:Nz
lIndex = z + (x-1)*Nz + (y-1)*Nx*Nz;
output(y,x,z) = abs(output_gpu_r(lIndex)+1i*output_gpu_i(lIndex));
end
end
end
figure;colormap(gray);
for z=1:Nz
imagesc(output(:,:,z));
title('Gpuslice');
colormap(gray);
colorbar;
pause(0.5);
end
end
end
if( exist([fname '/output/output_cpu_r.dat']) && exist([fname '/output/output_cpu_i.dat']) )
load([fname '/output/output_cpu_r.dat']);
load([fname '/output/output_cpu_i.dat']);
if(Nz==1) %2D
len = length(output_cpu_r);
size_x = len^0.5;
size_y = size_x;
size_z = 1;
cpu_output=reshape(output_cpu_r+1i*output_cpu_i,[size_x size_y size_z]);
figure;
hcpu =imagesc(abs(cpu_output));%axis image off;caxis([0,5e4])
title('Cpuslice');
colormap(gray);
colorbar;
scale = -1;
%print -dpng 'Gpu.png';
else
output_cpu = zeros(Ny,Nx,Nz);
for y=1:Ny
for x=1:Nx
for z=1:Nz
lIndex = z + (x-1)*Nz + (y-1)*Nx*Nz;
output_cpu(y,x,z) = abs(output_cpu_r(lIndex)+1i*output_cpu_i(lIndex));
end
end
end
figure;colormap(gray);
for z=1:Nz
imagesc(output_cpu(:,:,z));
title('Cpuslice');
colormap(gray);
colorbar;
pause(0.5);
end
end
end