forked from MIITT-MRI-Jianglab/Abdominal_MR_Phantom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ksp2img.m
43 lines (42 loc) · 1.62 KB
/
ksp2img.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
function reconimg = ksp2img(mixsamp,opts,cmap)
% Convert 4F phantom k-space to images
%
% INPUTS:
% mixsamp [nx, ny, nc, nz, nt] -> 4D phantom in k-space with phase accumulation and noise
% opts [struct] -> structure for gridding non-Cartesian k-space with the NUFFT
% cmap [nx, ny, nc, nz] -> coil sensitivity maps generated by gencmap.m
%
% OUTPUT:
% reconimg [nx, ny, nz, nt] -> 4D phantom images
%
% -----------------------------------------------------------------------------------------
% Realistic 4D abdominal phantom for magnetic resonance imaging
% Wei-Ching Lo
% wxl317@case.edu
% Case Western Reserve University
% April 2018
% -----------------------------------------------------------------------------------------
[nr, np, nc, npar, nt] = size(mixsamp);
mtx = opts.N;
ksp2immask = true(mtx,mtx);
reconimg = zeros(mtx,mtx,npar,nt,'single');
if strcmp(opts.trajectory,'cartesian')
ktemp = ifft1n(mixsamp,4);
imgtemp = ifft2n(ktemp,1,2);
for itp = 1:nt
reconimg(:,:,:,itp) = squeeze(sum(conj(cmap).*imgtemp(:,:,:,:,itp),3)); % coil combination
end
else
ktemp = ifft1n(mixsamp,4);
imgtemp = zeros(mtx,mtx,nc,npar,nt,'single');
for itp = 1:nt
for c = 1:nc
for ipar = 1:npar
x = zeros(nr,np,'single');
x(:,1:np) = ktemp(:,:,c,ipar,itp);
imgtemp(:,:,c,ipar,itp) = embed(opts.G'*(opts.wib.*x(:)),ksp2immask);
end
end
reconimg(:,:,:,itp) = squeeze(sum(conj(cmap).*imgtemp(:,:,:,:,itp),3)); % coil combination
end
end