Skip to content

Commit c8c5f5f

Browse files
authored
Fix GUI warnings and add missing GUI update in example 2 (#857)
* fix conf3D warnings in GUI * fix issue in pln and stf comparison * typo in conf3D check * Add GUI update in second example
1 parent e9411f8 commit c8c5f5f

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

examples/matRad_example2_photons.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,17 @@
182182
pln.propStf.couchAngles = zeros(1,numel(pln.propStf.gantryAngles));
183183
pln.propStf.numOfBeams = numel(pln.propStf.gantryAngles);
184184

185-
186-
185+
%Let's rerun the dose calculation and optimization
187186
stf = matRad_generateStf(ct,cst,pln);
188187
pln.propStf.isoCenter = vertcat(stf.isoCenter);
189188
dij = matRad_calcDoseInfluence(ct,cst,stf,pln);
190189
resultGUI_coarse = matRad_fluenceOptimization(dij,cst,pln);
191190

191+
%We append the new result to the resultGUI variable (recognized by the GUI)
192+
%using the identifier coarse
193+
resultGUI = matRad_appendResultGUI(resultGUI,resultGUI_coarse,false,'coarse');
194+
%A GUI update ensures the current values are updated
195+
matRadGUI;
192196

193197
%% Visual Comparison of results
194198
% Let's compare the new recalculation against the optimization result.

matRad/gui/widgets/matRad_WorkflowWidget.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ function btnLoadMat_Callback(this, hObject, event)
278278
set(handles.txtInfo,'String','loaded and ready');
279279

280280
if evalin('base','exist(''pln'')')
281-
281+
pln = evalin('base','pln');
282282

283283
% ct cst and pln available; ready for dose calculation
284284
set(handles.txtInfo,'String','ready for dose calculation');
@@ -287,9 +287,10 @@ function btnLoadMat_Callback(this, hObject, event)
287287
set(handles.exportDicomButton,'Enable','on');
288288

289289
% check if stf exists
290-
if evalin('base','exist(''stf'')')
290+
if evalin('base','exist(''stf'')')
291+
stf = evalin('base','stf');
291292
% check if dij, stf and pln match
292-
[plnStfMatch, msg] = matRad_comparePlnStf(evalin('base','pln'),evalin('base','stf'));
293+
[plnStfMatch, msg] = matRad_comparePlnStf(pln,stf);
293294
if plnStfMatch
294295
% plan is ready for optimization
295296
set(handles.txtInfo,'String','ready for dose calculation');
@@ -301,8 +302,11 @@ function btnLoadMat_Callback(this, hObject, event)
301302
end
302303

303304
% check if dij exist
304-
if evalin('base','exist(''dij'')') && plnStfMatch && ~evalin('base','pln.propOpt.conf3D')
305-
[dijStfMatch, msg] = matRad_compareDijStf(evalin('base','dij'),evalin('base','stf'));
305+
conf3D = isfield(pln,'propOpt') && isfield(pln.propOpt,'conf3D') && pln.propOpt.conf3D;
306+
307+
if evalin('base','exist(''dij'')') && plnStfMatch && ~conf3D
308+
dij = evalin('base','dij');
309+
[dijStfMatch, msg] = matRad_compareDijStf(dij,stf);
306310
if dijStfMatch
307311
set(handles.txtInfo,'String','ready for optimization');
308312
set(handles.btnOptimize ,'Enable','on');
@@ -416,7 +420,7 @@ function btnCalcDose_Callback(this, hObject, eventdata)
416420
dij = matRad_calcDoseInfluence(evalin('base','ct'),evalin('base','cst'),stf,pln);
417421

418422
% prepare dij for 3d conformal
419-
if isfield(pln.propOpt,'conf3D') && pln.propOpt.conf3D
423+
if isfield(pln,'propOpt') && isfield(pln.propOpt,'conf3D') && pln.propOpt.conf3D
420424
dij = matRad_collapseDij(dij);
421425
end
422426
% assign results to base worksapce

matRad/util/matRad_comparePlnStf.m

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@
4646
end
4747

4848
%% compare gantry angles in stf and pln
49-
stf_gantryAngles=[stf.gantryAngle];
50-
if ~isfield(pln.propStf,'gantryAngles') || numel(stf_gantryAngles) ~= numel(pln.propStf.gantryAngles) ... % different size
51-
|| ~isempty(find(stf_gantryAngles-pln.propStf.gantryAngles, 1)) % values in stf and pln do not match % values in stf and pln do not match
49+
stfGantryAngles=[stf.gantryAngle];
50+
if ~isfield(pln.propStf,'gantryAngles') || numel(stfGantryAngles) ~= numel(pln.propStf.gantryAngles) ... % different size
51+
|| ~isempty(find(stfGantryAngles-pln.propStf.gantryAngles, 1)) % values in stf and pln do not match % values in stf and pln do not match
5252
allMatch=false;
5353
msg= 'Gantry angles do not match';
5454
return
5555
end
5656

5757
%% compare couch angles in stf and pln
58-
stf_couchAngles=[stf.couchAngle];
59-
if ~isfield(pln.propStf,'couchAngles') || numel(stf_couchAngles) ~= numel(pln.propStf.couchAngles) ... % different size
60-
|| ~isempty(find(stf_couchAngles-pln.propStf.couchAngles, 1)) % values in stf and pln do not match
58+
stfCouchAngles=[stf.couchAngle];
59+
if ~isfield(pln.propStf,'couchAngles') || numel(stfCouchAngles) ~= numel(pln.propStf.couchAngles) ... % different size
60+
|| ~isempty(find(stfCouchAngles-pln.propStf.couchAngles, 1)) % values in stf and pln do not match
6161
allMatch=false;
6262
msg= 'Couch angles do not match';
6363
return
@@ -88,7 +88,12 @@
8888

8989
%% compare isocenter in stf and pln for each gantry angle
9090
for i = 1:numel(pln.propStf.gantryAngles)
91-
if ~isempty(find(stf(i).isoCenter - pln.propStf.isoCenter(i,:) ,1))
91+
if size(pln.propStf.isoCenter,1) == 1
92+
isoCenter = repmat(pln.propStf.isoCenter,numel(stf),1);
93+
else
94+
isoCenter = pln.propStf.isoCenter;
95+
end
96+
if size(isoCenter,1) ~= numel(stf) || any(stf(i).isoCenter - isoCenter(i,:) ~= 0)
9297
allMatch=false;
9398
msg= 'Isocenters do not match';
9499
return

0 commit comments

Comments
 (0)