-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_shim_prediction_TXfct.m
118 lines (96 loc) · 4.3 KB
/
show_shim_prediction_TXfct.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
function fighandle = show_shim_prediction_TXfct(shimset, b1p, roi, varargin)
%% ************************************************************************
%
% Plots the shim prediction based on the shimset (can be phase and
% magnitude)
%
% Author: S.Schmitter
% Date: Jan 2016
%
%
% dependencies:
% - multiprod
% - parseVariableInputs
% - catstruct
%
% INPUT: [unit]
% ----------------------------------------------------------------
% shimset coplex vector of phase shim values
% b1p b1+ maps
% roi region of interest
%
% Options (with standard prefs) [unit]
% ----------------------------------------------------------------
%
%
% OUTPUT:
% ----------------------------------------------------------------
% ValueStruct Struct containing the quantified values
%
%% ************************************************************************
optsdef.TEST = 0;
optsdef.SAVEMAPS = 0;
optsdef.ROTATE = 0;
optsdef.COLORMAP = 'thermal'; %uses the cmocean colormaps
optsdef.COLORMAPEFF = 'solar';
opts = catstruct(optsdef,parseVariableInputs(varargin));
shimvec = makeColVec(shimset);
b1pat_post = abs(multiprod(b1p,shimvec,4,1));
b1pat_pre = abs(multiprod(b1p,ones(size(shimvec)),4,1));
b1pat_both = cat(3,b1pat_pre,b1pat_post);
b1sumofmag = multiprod(abs(b1p),abs(shimvec),4,1);
Eff_pre = abs(b1pat_pre)./b1sumofmag;
Eff_post = abs(b1pat_post)./b1sumofmag;
Eff_both = cat(3,Eff_pre,Eff_post);
%plot the prediction before and after shimming
roi_bot = cat(3,roi,roi);
tmp_pre = abs(b1pat_pre(~~roi));
tmp_post = abs(b1pat_post(~~roi));
CV_pre = std(tmp_pre(:))/mean(tmp_pre(:));
CV_post = std(tmp_post(:))/mean(tmp_post(:));
MeanEff_pre = mean(Eff_pre(~~roi));
MeanEff_post = mean(Eff_post(~~roi));
lNoOfSlices = size(b1p,3);
%added 20181130: handle rotation
if(opts.ROTATE == 270)
b1pat_both=rot270(b1pat_both);
roi_bot=rot270(roi_bot);
Eff_both = rot270(Eff_both);
end
if(opts.ROTATE == 180)
b1pat_both=rot180(b1pat_both);
roi_bot=rot180(roi_bot);
Eff_both = rot180(Eff_both);
end
if(opts.ROTATE == 90)
b1pat_both=rot90m(b1pat_both);
roi_bot=rot90m(roi_bot);
Eff_both = rot90(Eff_both);
end
%show the b1 prediction
propout = show3dWithMaskm((b1pat_both),(roi_bot),2,lNoOfSlices);
cc = colorbar();
cc.Label.String = 'B1+ in a.u.';
colormap(cmocean(optsdef.COLORMAP));
%caxis([0 90]);
% axis off;
axis image; %enforce equal image aspect ratio
title({'B1+ prediction';...
['Before shim (first row): CV = ', num2str(CV_pre*100,'%.1f'),'% Mean efficiency: ', num2str(MeanEff_pre*100,'%.1f'),'% Min. B1+: ', num2str(min(tmp_pre(:)),'%.1f')];...
['After shim (second row): CV = ', num2str(CV_post*100,'%.1f'),'% Mean efficiency: ', num2str(MeanEff_post*100,'%.1f'),'% Min. B1+: ', num2str(min(tmp_post(:)),'%.1f')]});
% ['Before shim (first row): CV = ', num2str(CV_pre*100,'%.1f'),'% Mean efficiency: ', num2str(MeanEff_pre*100,'%.1f'),'%'];...
% ['After shim (second row): CV = ', num2str(CV_post*100,'%.1f'),'% Mean efficiency: ', num2str(MeanEff_post*100,'%.1f'),'%']});
propout2 = show3dWithMaskm((Eff_both),(roi_bot),2,lNoOfSlices);
cc = colorbar();
cc.Label.String = 'Efficiency';
colormap(jet);%cmocean(optsdef.COLORMAPEFF));
% colormap(cmocean(optsdef.COLORMAP));
caxis([0 1]);
% axis off;
axis image; %enforce equal image aspect ratio
title({'RF efficiency';...
['Before shim (first row): CV = ', num2str(CV_pre*100,'%.1f'),'% Mean efficiency: ', num2str(MeanEff_pre*100,'%.1f'),'% Min. B1+: ', num2str(min(tmp_pre(:)),'%.1f')];...
['After shim (second row): CV = ', num2str(CV_post*100,'%.1f'),'% Mean efficiency: ', num2str(MeanEff_post*100,'%.1f'),'% Min. B1+: ', num2str(min(tmp_post(:)),'%.1f')]});
fighandle(1) = propout.fighandle;
fighandle(2) = propout2.fighandle;
end