Skip to content

Commit

Permalink
Merge pull request #793 from e0404/bugfix/dvhwidget
Browse files Browse the repository at this point in the history
DVH Widget Bugfix
  • Loading branch information
amitantony authored Nov 20, 2024
2 parents c55fa64 + 3f50eb7 commit ba37667
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 7 deletions.
13 changes: 11 additions & 2 deletions matRad/gui/widgets/matRad_DVHWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,24 @@ function showDVH(this)
resultGUI = evalin('base','resultGUI');
pln = evalin('base','pln');
cst = evalin('base','cst');
ct = evalin('base','ct');

% Calculate and show DVH
doseCube = resultGUI.(this.selectedCube);
dvh = matRad_calcDVH(cst,doseCube,'cum');

matRad_showDVH(dvh,cst,pln,'axesHandle',this.dvhAx);

if ~isfield(pln,'multScen')
multScen = matRad_NominalScenario(ct);
else
multScen = pln.multScen;
end
multScen = matRad_ScenarioModel.create(multScen,ct);

%check scenarios
if pln.multScen.totNumScen > 1
for i = 1:pln.multScen.totNumScen
if multScen.totNumScen > 1
for i = 1:multScen.totNumScen
scenFieldName = sprintf('%s_scen%d',this.selectedCube,i);
if isfield(resultGUI,scenFieldName)
tmpDvh = matRad_calcDVH(cst,resultGUI.(scenFieldName),'cum'); % Calculate cumulative scenario DVH
Expand Down
2 changes: 1 addition & 1 deletion matRad/planAnalysis/matRad_showDVH.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function matRad_showDVH(dvh,cst,varargin)
pln.bioModel = matRad_BiologicalModel.validate(pln.bioModel,pln.radiationMode);

if strcmp(pln.bioModel.model,'none')
xlabel('Dose [Gy]','FontSize',fontSizeValue);
xlabel(axesHandle,'Dose [Gy]','FontSize',fontSizeValue);
else
xlabel(axesHandle,'RBE x Dose [Gy(RBE)]','FontSize',fontSizeValue);
end
Expand Down
57 changes: 57 additions & 0 deletions test/gui/test_gui_DVHStatsWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,61 @@
delete(h);
close(get(p,'Parent'));

function test_DVHStatsWidget_constructWithPhotonPln
evalin('base','load photons_testData.mat');
h = matRad_DVHStatsWidget();
h.selectedDisplayOption = 'physicalDose';
try
assertTrue(isa(h, 'matRad_DVHStatsWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_DVHStatsWidget_constructWithProtonPln
evalin('base','load protons_testData.mat');
h = matRad_DVHStatsWidget();
try
assertTrue(isa(h, 'matRad_DVHStatsWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_DVHStatsWidget_constructWithCarbonPln
evalin('base','load carbon_testData.mat');
h = matRad_DVHStatsWidget();
try
assertTrue(isa(h, 'matRad_DVHStatsWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_DVHStatsWidget_constructWithHeliumPln
evalin('base','load helium_testData.mat');
h = matRad_DVHStatsWidget();
try
assertTrue(isa(h, 'matRad_DVHStatsWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

%TODO: Test Buttons / visibility depending on data
63 changes: 60 additions & 3 deletions test/gui/test_gui_PlanWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
delete(h);
close(get(p,'Parent'));

function test_PlanWidget_constructWithData
function test_PlanWidget_constructWithTG119
evalin('base','load TG119.mat');
h = matRad_PlanWidget();
try
Expand All @@ -52,6 +52,63 @@
rethrow(ME);
end
evalin('base','clear ct cst pln');
delete(h);
delete(h);

function test_PlanWidget_constructWithPhotonPln
evalin('base','load photons_testData.mat');
h = matRad_PlanWidget();
try
assertTrue(isa(h, 'matRad_PlanWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_PlanWidget_constructWithProtonPln
evalin('base','load protons_testData.mat');
h = matRad_PlanWidget();
try
assertTrue(isa(h, 'matRad_PlanWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_PlanWidget_constructWithCarbonPln
evalin('base','load carbon_testData.mat');
h = matRad_PlanWidget();
try
assertTrue(isa(h, 'matRad_PlanWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_PlanWidget_constructWithHeliumPln
evalin('base','load helium_testData.mat');
h = matRad_PlanWidget();
try
assertTrue(isa(h, 'matRad_PlanWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);


%TODO: Test Buttons / visibility depending on data
%TODO: Test Buttons
14 changes: 14 additions & 0 deletions test/gui/test_gui_exportWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,18 @@
evalin('base','clear ct cst pln');
delete(h);

function test_exportWidget_constructWithCarbonPln
evalin('base','load carbon_testData.mat');
h = matRad_exportWidget();
try
assertTrue(isa(h, 'matRad_exportWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

%TODO: Test Buttons / visibility depending on data
58 changes: 57 additions & 1 deletion test/gui/test_gui_viewingWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
delete(h);
close(get(p,'Parent'));

function test_viewingWidget_constructWithData
function test_viewingWidget_constructWithTG119
evalin('base','load TG119.mat');
h = matRad_ViewingWidget();
try
Expand All @@ -53,4 +53,60 @@
evalin('base','clear ct cst pln');
delete(h);

function test_ViewingWidget_constructWithPhotonPln
evalin('base','load photons_testData.mat');
h = matRad_ViewingWidget();
try
assertTrue(isa(h, 'matRad_ViewingWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_ViewingWidget_constructWithProtonPln
evalin('base','load protons_testData.mat');
h = matRad_ViewingWidget();
try
assertTrue(isa(h, 'matRad_ViewingWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_ViewingWidget_constructWithCarbonPln
evalin('base','load carbon_testData.mat');
h = matRad_ViewingWidget();
try
assertTrue(isa(h, 'matRad_ViewingWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

function test_ViewingWidget_constructWithHeliumPln
evalin('base','load helium_testData.mat');
h = matRad_ViewingWidget();
try
assertTrue(isa(h, 'matRad_ViewingWidget'));
assertTrue(isa(h, 'matRad_Widget'));
catch ME
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);
rethrow(ME);
end
evalin('base','clear ct cst pln stf dij resultGUI');
delete(h);

%TODO: Test Buttons / visibility depending on data

0 comments on commit ba37667

Please sign in to comment.