forked from JiadingGai/Impatient-MRI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
display_recon.m
53 lines (47 loc) · 1.69 KB
/
display_recon.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
function dummy = display_recon(fname,Ny,Nx,Nz)
%[nRows,nCols,nDepths] = [Ny,Nx,Nz]
if(nargin<4)
disp('Missing: the dimensions of the image.');
end
fp=fopen([fname '/out.file'],'r');
recon = fread(fp,'single');
len = length(recon);
recon_r = recon(1:len/2);
recon_i = recon(len/2+1:end);
if(Nz==1) % 2D
N = (len/2) ^ 0.5;
gpu_output = reshape(recon_r+1i*recon_i,[N,N]);
figure;
imagesc(abs(gpu_output));
colormap(gray);
colorbar;
axis off;
axis square;
%caxis([0,0.8]);
%save('GPUrecon.mat','gpu_output');
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(recon_r(lIndex)+1i*recon_i(lIndex));
end
end
end
figure;colormap(gray);
for z=1:Nz
imagesc(output(:,:,z));
colormap(gray);
colorbar;
axis on;
axis square;
tmp = [int2str(z) '_Toe.png'];
print('-dpng',tmp);
pause(0.5);
end
end
%[pathstr, name, ext] = fileparts(fname);
%pathstr(find(pathstr==filesep))='_';
%output_file_name = [pathstr(9:end) '_Toeplitz.png'];
%print('-dpng', output_file_name);