forked from evanlev/cpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemoCPDAll.m
106 lines (93 loc) · 4.02 KB
/
demoCPDAll.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
%% Complementary Poisson-Disc Sampling
%
% (c) Evan G. Levine ([email protected]) 2014.
%
% <http://med.stanford.edu/bmrgroup.html BMR page>.
%
% <https://github.com/evanlev/cpd.git Download> the demos and sampling functions
%%
%% References
% 1) EG Levine, M Saranathan, and B Hargreaves. “Complementary Poisson-Disc Sampling” Proceedings of ISMRM, Milan, Italy, May 2014
%
% 2) EG Levine, B Quist, B Daniel, B Hargreaves, and M Saranathan. “View-sharing and Compressed Sensing in Two-Point Dixon-based DCE-MRI” Proceedings of ISMRM, Milan, Italy, May 2014
%
% 3) EG Levine, B Hargreaves, B Daniel, S Vasanawala, and M Saranathan. "3D Cartesian MRI with Compressed Sensing and Variable View Sharing Using Complementary Poisson-disc Sampling" Magnic Resonance in Medicine 2016
%%
%% Setup
% For Examples 1-3, uniform density sampling patterns will contain a fully-sampled
% central region and annular region with 2x1 regular under-sampling.
%%
clear, close all;
cd('src');
makeMex;
cd('..');
addpath('utils/');
addpath('src/');
FOVRatio = 0.4; % FOVz / FOVy
nt = 4; % # temporal phases
ny = 180; % y-dimension
nz = 60; % z-dimension
% create a fully-sampled central region
Areg = zpad(removeCorners(ones(24,24)), [ny nz]);
% Annular region with 2x1 regular under-sampling
F = removeCorners(ones(ny, nz) - Areg);
F(1:2:end,:) = 0;
%% Example 1: Variable density CPD sampling by region-wise UD-CPD
%%
Ry = sqrt(ny*nz / sum(sum(F/nt)));
Rz = Ry;
R = [Ry Rz]; % Ry = Rz
shapeOpt = 'cross'; % Union of a line along k = 0 and an ellipse at t = 0
distRelaxationOpt = 'k'; % Only relax k-space min. distance constraint
vd_exp = 1; % 1/kr^1 density
Rmax = 22; % reduction factor at kr = kmax
tic;
M1 = genVDCPD(nt,Rmax,vd_exp,FOVRatio,F,shapeOpt,0,1);
toc;
figure(1);
imshow( [reshape(M1, [ny nz*nt]), sum(M1,3)/nt]);
title('Uniform density CPD sampling patterns from "genVDCPD.m" and sum');
%% Example 2: Variable density random sampling by region-wise UD random
%%
Ry = sqrt(ny*nz / sum(sum(F/nt)));
Rz = Ry;
R = [Ry Rz]; % Ry = Rz
shapeOpt = 'cross'; % Union of a line along k = 0 and an ellipse at t = 0
distRelaxationOpt = 'k'; % Only relax k-space min. distance constraint
vd_exp = 1; % 1/kr^1 density
Rmax = 22; % reduction factor at kr = kmax
tic;
M1r = genVDCPD(nt,Rmax,vd_exp,FOVRatio,F,shapeOpt,0,1,0);
toc;
figure(2);
imshow( [reshape(M1r, [ny nz*nt]), sum(M1r,3)/nt]);
title('Uniform density random sampling patterns from "genVDCPD.m" and sum');
%% Example 3: Efficient uniform density CPD implementation
% Uniform density sampling is efficiently implemented with a
% random queue and requires little tuning.
%%
tic;
C = 0.5;
M2 = genUDCPD(nt,FOVRatio,F,shapeOpt) + repmat(Areg, [1 1 nt]);
toc;
figure(3);
imshow( [reshape(M2, [ny nz*nt]), sum(M2,3)/nt]);
title('Uniform density CPD sampling patterns from "genUDCPD.m" and sum');
%% Example 4: Use of min. distance criterion for temporal phase combination
% Combining multiple phases should preserve the uniformity and incoherence of
% the Poisson-disc sample distribution. Here different min. distance criteria are
% compared. The 'cross' parameter generates an ellipse in k-space around any sample
% drawn and a line through the ellipse along the time axis, fixed at the sample k-space.
% Subsequent samples are drawn from the region of k-t space outside of the ellipse and
% line. Parameters 'ellipsoid', 'l1 ball', and 'cones' correspond to other shapes
% that better preserve the sampling properties after combining temporal phases, as
% shown in this example.
%%
figure(4);
nt = 20;
F = removeCorners(ones(100,100));
M3= genUDCPD(nt,FOVRatio,F,'cross'); %+ repmat(Areg, [1 1 nt]);
M6= genUDCPD(nt,FOVRatio,F,'cones'); % + repmat(Areg, [1 1 nt]);
nVS = 4; % View-share this many phases
imshow( [M3(:,:,1), sum(M3(:,:,1:2),3), sum(M3(:,:,1:4),3); M6(:,:,1) sum(M6(:,:,1:2),3), sum(M6(:,:,1:4),3)]);
title({'Logical OR of 1,2,and 4 sequential patterns with ', '''cross'' (top),''cones'' (bottom) shapes (left to right)'});