-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHeart_GUI_preset.m
More file actions
324 lines (297 loc) · 11.9 KB
/
Heart_GUI_preset.m
File metadata and controls
324 lines (297 loc) · 11.9 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
function Heart_GUI_preset(outputs)
close all
%% GUI
global outputs
global ConfigGUI
%% Get the display
pos = get(0, 'screensize'); %get the screensize
W=0.8*pos(3);
H=0.8*pos(4);
x0=50;
y0=50;
WIDTH=W-50-x0;
HEIGHT=H-100-y0;
%[left bottom width height],the most outer frame
ConfigGUI.Handle=figure('Units', 'Pixels', 'Position', [x0 y0 WIDTH HEIGHT],...
'Resize','off','Name','Heart Model Set up','NumberTitle','Off',...
'Tag','GUI');
% General model settings
ConfigGUI.model_settings = uipanel('Parent',ConfigGUI.Handle,...
'Units','normalized',...
'Position',[0.05 0.25 0.45 0.65],...
'Title','General Model Settings',...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'HandleVisibility','callback',...
'Tag','modelPanel');
% Pacemaker specific settings
ConfigGUI.pacemaker_settings = uipanel('Parent',ConfigGUI.Handle,...
'Units','normalized',...
'Position',[0.5 0.25 0.45 0.65],...
'Title','Pacemaker Settings',...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'HandleVisibility','callback',...
'Tag','pacemakerPanel');
% Parameter settings --- Drop Down
% parasMulti:
% Bradycardia+AV block+premature ventricular complex (PVC), RBBB (slow velocity):
% % SA BCL=1400; the automaticity of Node 24 (RBB) enabled (para48=0); path 10 backward enabled (para7=1.0); Path 15 cv=0.04, path 27 cv=0.4;
% parasMulti2: PVC introduces PMT
% Bradycardia+AV block+premature ventricular complex (PVC), RBBB (complete blockage, i.e.,cv=0):
% % SA BCL=1400; the automaticity of Node 24 (RBB) enabled (para48=0); path 10 backward enabled (para7=1.0); Path 15 cv=0.04, path 27 cv=0;
% parasMulti3: extra VP introduces AVNRT
% % SA BCL=814; CS BCL=1194 enabled (para48=0); path 10 backward enabled (para7=0.8); ppR5
% cfg=[814,1194,2,0,0.100000000000000,0.250000000000000,278,0.0146200000000000,0.00872000000000000,2300,2,1,0.100000000000000,0.250000000000000,1.100000000000000,0.0700000000000000,0.0700000000000000,0.0700000000000000,0.0700000000000000];
%%parasNormal Normal but slight AV delay compared to device AVI.
uicontrol('Parent',ConfigGUI.model_settings,...
'Style','text',...
'Units','normalized',...
'Position',[0.05 0.8 0.25 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String','Parameter choice:',...
'HandleVisibility','callback');
ConfigGUI.parameterchoice = uicontrol('Parent',ConfigGUI.model_settings,...
'Style','popupmenu',...
'Units','normalized',...
'Position',[0.3 0.8 0.25 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String',{'Normal', 'parasMulti', 'parasMulti2', 'parasMulti3', 'Bradycardia'},...
'HandleVisibility','callback',...
'Tag','paramchoice');
uicontrol('Parent',ConfigGUI.model_settings,...
'Style','text',...
'Units','normalized',...
'Position',[0.05 0.7 0.25 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String','Unit choice:',...
'HandleVisibility','callback');
ConfigGUI.unitchoice = uicontrol('Parent',ConfigGUI.model_settings,...
'Style','popupmenu',...
'Units','normalized',...
'Position',[0.3 0.7 0.25 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String',{'Milliseconds','Seconds'},...
'HandleVisibility','callback',...
'Callback',@unitchange,...
'Tag','unitchoice');
%%%% Notes in the TO ADD section
% uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','text',...
% 'Units','normalized',...
% 'Position',[0.6 0.3 0.35 0.15],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String','These plots are currently not set up to change anything in the network GUI',...
% 'HandleVisibility','callback');
% Anymore model settings?
% - tutorial for the different node types
% - directly selecting a model to implant into the CLS system
% - model creation from scratch
% Whether to edit the existing model structure (opens the Heart Editing GUI after this one closes)
ConfigGUI.editmodel = uicontrol('Parent',ConfigGUI.model_settings,...
'Style','checkbox',...
'Units','normalized',...
'Position',[0.05 0.0 0.35 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String','Edit Model Network',...
'HandleVisibility','callback',...
'Tag','editmodel');
% User decides if they want a tutorial
ConfigGUI.tutorial = uicontrol('Parent',ConfigGUI.model_settings,...
'Style','checkbox',...
'Units','normalized',...
'Position',[0.35 0.0 0.35 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String','Tutorial',...
'HandleVisibility','callback',...
'Tag','tutorial');
%
% strings = {'Plot 1:','Plot 2:', 'Plot 3:', 'Plot 4:', 'Plot 5:', 'Plot 6:'};
% left_positions = [0.05 0.05 0.05 0.05 0.05 0.05];
% bot_positions = [0.6 0.5 0.4 0.3 0.2 0.1];
% w_positions = [0.1 0.1 0.1 0.1 0.1 0.1];
% h_positions = [0.15 0.15 0.15 0.15 0.15 0.15];
% for idx = 1:length(strings)
% uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','text',...
% 'Units','normalized',...
% 'Position',[left_positions(idx) bot_positions(idx) w_positions(idx) h_positions(idx)],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String',strings{idx},...
% 'HandleVisibility','callback');
% end
% ConfigGUI.plot0 = uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','popupmenu',...
% 'Units','normalized',...
% 'Position',[0.15 0.6 0.25 0.15],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String',{'AEGM', 'None', 'VEGM', 'Aget/Vget', 'AP/VP', 'AS/VS', 'AR/VR'},...
% 'HandleVisibility','callback');
% ConfigGUI.plot1 = uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','popupmenu',...
% 'Units','normalized',...
% 'Position',[0.15 0.5 0.25 0.15],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String',{'VEGM', 'None', 'AEGM', 'Aget/Vget', 'AP/VP', 'AS/VS', 'AR/VR'},...
% 'HandleVisibility','callback');
% ConfigGUI.plot2 = uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','popupmenu',...
% 'Units','normalized',...
% 'Position',[0.15 0.4 0.25 0.15],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String',{'Aget/Vget', 'None','AEGM', 'VEGM', 'AP/VP', 'AS/VS', 'AR/VR'},...
% 'HandleVisibility','callback');
% ConfigGUI.plot3 = uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','popupmenu',...
% 'Units','normalized',...
% 'Position',[0.15 0.3 0.25 0.15],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String',{'AP/VP', 'None', 'AEGM', 'VEGM', 'Aget/Vget', 'AS/VS', 'AR/VR'},...
% 'HandleVisibility','callback');
% ConfigGUI.plot4 = uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','popupmenu',...
% 'Units','normalized',...
% 'Position',[0.15 0.2 0.25 0.15],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String',{'AS/VS','None', 'AEGM', 'VEGM', 'Aget/Vget', 'AP/VP', 'AR/VR'},...
% 'HandleVisibility','callback');
% ConfigGUI.plot5 = uicontrol('Parent',ConfigGUI.model_settings,...
% 'Style','popupmenu',...
% 'Units','normalized',...
% 'Position',[0.15 0.1 0.25 0.15],...
% 'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
% 'String',{ 'AR/VR', 'None', 'AEGM', 'VEGM', 'Aget/Vget', 'AP/VP', 'AS/VS'},...
% 'HandleVisibility','callback');
ConfigGUI.closebutton = uicontrol('Parent',ConfigGUI.Handle,...
'Style','pushbutton',...
'Units','normalized',...
'Position',[0.25 0.05 0.5 0.15],...
'String','Close this GUI with the current settings on display',...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'HandleVisibility','callback',...
'Callback',@closeGUI,...
'Tag','closeButton');
% Pacemaker Settings
% 1. Whether to have a pacemaker at all in the modelling
% -- decides whether to use the rest of this GUI section
uicontrol('Parent',ConfigGUI.pacemaker_settings,...
'Style','text',...
'Units','normalized',...
'Position',[0.05 0.8 0.1 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String','Model Type:',...
'HandleVisibility','callback');
ConfigGUI.pacemaker = uicontrol('Parent',ConfigGUI.pacemaker_settings,...
'Style','popupmenu',...
'Units','normalized',...
'Position',[0.2 0.8 0.2 0.15],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String',{'Full CLSfixed', 'Pacemaker', 'No Pacemaker'},...
'HandleVisibility','callback',...
'Callback',@deviceChange,...
'Tag','editmodel');
% 2. What type of pacemaker TO ADD
% https://www.ncbi.nlm.nih.gov/books/NBK556011/ ---??????
% DDT
% Dual chamber/single chamber
% Resp Modulation (future work)
% 3. Pacemaker settings
%% desired (from CLSfixed/cfgs/Scfgf)
xa=1;
xc=0.05;
xc1=0.1;
xd=1;
xe=0.1;
avd=100;
vad=100;
uni_a=1;
Sens_a=0.6;
Amp_ap=500;
uni_v=1;
Sens_v=2.8;
Amp_vp=500;
strings = {'LRI (ms):', 'AVI (ms):', 'URI (ms):', 'VRP (ms):', 'PVARP (ms):'};
left_positions = [0.05 0.05 0.05 0.05 0.05];
bot_positions = [0.7 0.6 0.5 0.4 0.3];
h_positions = [0.1 0.1 0.1 0.1 0.1];
w_positions = [0.1 0.1 0.1 0.1 0.1];
for idx = 1:length(strings)
uicontrol('Parent',ConfigGUI.pacemaker_settings,...
'Style','text',...
'Units','normalized',...
'Position',[left_positions(idx) bot_positions(idx) w_positions(idx) h_positions(idx)],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String',strings{idx},...
'HandleVisibility','callback');
end
left_positions = [0.2 0.2 0.2 0.2 0.2];
bot_positions = [0.7 0.6 0.5 0.4 0.3];
h_positions = [0.1 0.1 0.1 0.1 0.1];
w_positions = [0.1 0.1 0.1 0.1 0.1];
string =[1000 170 500 230 250];
tags = {'lri', 'avi', 'uri', 'vrp', 'pvarp'};
for idx = 1:length(strings)
uicontrol('Parent',ConfigGUI.pacemaker_settings,...
'Style','edit',...
'Units','normalized',...
'Position',[left_positions(idx) bot_positions(idx) w_positions(idx) h_positions(idx)],...
'BackgroundColor',get(ConfigGUI.Handle,'Color'),...
'String',string(idx),...
'HandleVisibility','callback',...
'Tag',tags{idx});
end
waitfor(ConfigGUI.Handle);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function deviceChange(hObject,eventdata)
lri=findobj('tag','lri');
avi=findobj('tag','avi');
uri=findobj('tag','uri');
vrp=findobj('tag','vrp');
pvarp=findobj('tag','pvarp');
if ConfigGUI.pacemaker.Value < 3
lri.Style = 'edit';
avi.Style = 'edit';
uri.Style = 'edit';
vrp.Style = 'edit';
pvarp.Style = 'edit';
else
lri.Style = 'text';
avi.Style = 'text';
uri.Style = 'text';
vrp.Style = 'text';
pvarp.Style = 'text';
end
end
function unitchange(hObject,eventdata)
ConfigGUI.parameterchoice.Value = 1;
if ConfigGUI.unitchoice.Value == 1
ConfigGUI.parameterchoice.String = {'Normal', 'parasMulti', 'parasMulti2', 'parasMulti3', 'Bradycardia'};
else
ConfigGUI.parameterchoice.String = {'Normal', 'AV Block'};
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function closeGUI(hObject,eventdata)
% outputs.plot0 = ConfigGUI.plot0.String{ConfigGUI.plot0.Value};
% outputs.plot1 = ConfigGUI.plot1.String{ConfigGUI.plot1.Value};
% outputs.plot2 = ConfigGUI.plot2.String{ConfigGUI.plot2.Value};
% outputs.plot3 = ConfigGUI.plot3.String{ConfigGUI.plot3.Value};
% outputs.plot4 = ConfigGUI.plot4.String{ConfigGUI.plot4.Value};
% outputs.plot5 = ConfigGUI.plot5.String{ConfigGUI.plot5.Value};
outputs.param = ConfigGUI.parameterchoice.String{ConfigGUI.parameterchoice.Value};
outputs.units = ConfigGUI.unitchoice.Value;
outputs.editmodel = ConfigGUI.editmodel.Value;
outputs.pacemaker = ConfigGUI.pacemaker.Value;
outputs.tutorial = ConfigGUI.tutorial.Value;
strings = {'LRI', 'AVI', 'URI', 'VRP', 'PVARP'};
base = [1000 170 500 230 250];
for i = 1:length(strings)
q = findobj('tag',lower(strings(i)));
val = str2double(get(q,'String'));
if ~isnan(val)
assignin('base',strings{i},val)
else
assignin('base',strings{i},base(i))
end
end
close all
end
end