forked from MIITT-MRI-Jianglab/Abdominal_MR_Phantom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model2voximg.m
43 lines (40 loc) · 1.39 KB
/
model2voximg.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 imPall = model2voximg(phanimg,sigevo)
% Set phantom signal
%
% INPUTS:
% phanimg [nx, ny, nz, nt] -> 3D phantom with respiratory motion generated by mesh2model.m
% sigevo [Nex x cnt x 2] -> signal evolution generated by gensigevo.m
%
% OUTPUT:
% imPall [nx, ny, nz, Nex] -> 4D phantom images
%
% -----------------------------------------------------------------------------------------
% Realistic 4D abdominal phantom for magnetic resonance imaging
% Wei-Ching Lo
% wxl317@case.edu
% Case Western Reserve University
% April 2018
% -----------------------------------------------------------------------------------------
[tps,tpn,wfcomp] = size(sigevo);
[nx,ny,nz,nt] = size(phanimg);
imPall = zeros(nx,ny,nz,wfcomp,tps,'single');
for itp = 1:tps
im = phanimg(:,:,:,mod(itp-1,nt)+1);
if wfcomp == 1 % water only
imW = zeros(nx,ny,nz,'single');
for param1 = 1:tpn
imW(im == param1) = sigevo(itp,param1,1);% water
end
imPall(:,:,:,1,itp) = imW;
else % water and fat
imW = zeros(nx,ny,nz,'single');
imF = zeros(nx,ny,nz,'single');
for param1 = 1:tpn
imW(im == param1) = sigevo(itp,param1,1);% water
imF(im == param1) = sigevo(itp,param1,2);% fat
end
imPall(:,:,:,1,itp) = imW;
imPall(:,:,:,2,itp) = imF;
end
end
end