Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev class GUI a dicom import bug #625

Merged
merged 23 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cb5a94c
Fixes for couch angle update, (cst,ct ) loaded message, CBTplanning
amitantony Mar 24, 2022
5f4da57
Sequencing wrapper function that accepts highlevel matRad structures
amitantony Mar 29, 2022
16beca5
update of new referencing to sequencing in matRad and example scripts
amitantony Mar 29, 2022
7204af4
Added sequencing drop down menu to the GUI
amitantony Apr 4, 2022
baa9182
bug fix : enabling and disabling sequencing options
amitantony Apr 21, 2022
13d35e0
encoding to UTF8
amitantony Apr 22, 2022
eae4a47
bug fix : iso line update problem for "Saved Results" of ResultGUI i…
amitantony Apr 27, 2022
d17ecb2
Input Parser for DVH and statistics widget
amitantony Apr 29, 2022
657ef2b
Merge branch 'dev_classGUI_a' of https://github.com/amitantony/matRad…
amitantony Jun 9, 2022
a216bd1
[bug fix] DVH updates with the selected cube for display
amitantony Jul 29, 2022
d8c58e0
[bugfix] errors while running the basic matrad script
amitantony Jul 29, 2022
e4ad063
Merge branch 'dev_clean' into dev_classGUI_a : runs basic examples
amitantony Jul 29, 2022
b80323c
Merge branch 'dev_classGUI_a' of https://github.com/amitantony/matRad…
amitantony Jul 29, 2022
2d41f12
1. Documentation for newer widget functions
amitantony Oct 24, 2022
a1c8743
DVHStatswidget object stored in main gui
amitantony Oct 27, 2022
3fe5660
Gamma Widget skeleton
amitantony Oct 27, 2022
c711bdc
first working prototype
amitantony Nov 4, 2022
8c9f8ee
documentation
amitantony Nov 10, 2022
ecc6e0c
Merge branch 'dev_classGUI' into dev_classGUI_a
amitantony Jan 4, 2023
260bd66
Merge branch 'dev_classGUI_a' of https://github.com/amitantony/matRad…
amitantony Jan 20, 2023
5084863
Code style comments addressed (MB review)
amitantony Jan 27, 2023
ef55778
Class GUI dicom import bugs resolve to return atleast 1 DICOM patient…
amitantony May 26, 2023
72d5d3c
Merge branch 'dev_classGUI' into dev_classGUI_a_DicomImportBug
wahln May 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MatRad_Config.m
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function setDefaultPropertiesForEduMode(obj)

obj.devMode = false;
obj.eduMode = true;

end

function setDefaultGUIProperties(obj)
Expand Down
23 changes: 21 additions & 2 deletions dicom/matRad_importDicom.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%[env, ~] = matRad_getEnvironment();
[env, ~] = matRad_getEnvironment();


%%
if ~exist('dicomMetaBool','var')
Expand All @@ -54,7 +55,7 @@
resolution.z = files.resz; % [mm] / lps coordinate system
if files.useDoseGrid && isfield(files,'rtdose')
% get grid from dose cube
if verLessThan('matlab','9')
if isOctave || verLessThan('matlab','9')
doseInfo = dicominfo(files.rtdose{1,1});
else
doseInfo = dicominfo(files.rtdose{1,1},'UseDictionaryVR',true);
Expand Down Expand Up @@ -161,3 +162,21 @@
resultGUI.w = [resultGUI.w; [stf(i).ray.weight]'];
end
end


%% save ct, cst, pln, dose
matRadFileName = [files.ct{1,3} '.mat']; % use default from dicom
[FileName,PathName] = uiputfile('*','Save as...',matRadFileName);
if ischar(FileName)
% delete unnecessary variables
switch env
case 'MATLAB'
clearvars -except ct cst pln stf resultGUI FileName PathName;
save([PathName, FileName], '-regexp', '^(?!(FileName|PathName)$).','-v7');
case 'OCTAVE'
clear -x ct cst pln stf resultGUI FileName PathName;
save([PathName, FileName],'-v6');
end
% save all except FileName and PathName

end
22 changes: 15 additions & 7 deletions dicom/matRad_importDicomRtss.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if nargin < 3
visBool = 0;
end

matRad_cfg = MatRad_Config.instance();
env = matRad_getEnvironment();
matRad_checkEnvDicomRequirements(env);
isOctave = strcmp(env,'OCTAVE');
Expand All @@ -52,9 +52,17 @@
end

% list the defined structures
listOfDefStructs = fieldnames(structInfo.StructureSetROISequence);
try
listOfDefStructs = fieldnames(structInfo.StructureSetROISequence);
catch
matRad_cfg.dispError('StructureSetROISequence not defined ')
end
% list of contoured structures
listOfContStructs = fieldnames(structInfo.ROIContourSequence);
try
listOfContStructs = fieldnames(structInfo.ROIContourSequence);
catch
matRad_cfg.dispError('ROIContourSequence not defined ')
end

%% process structure data
numOfDefStructs = numel(listOfDefStructs);
Expand Down Expand Up @@ -86,11 +94,11 @@
listOfSlices = fieldnames(structInfo.ROIContourSequence.(...
listOfContStructs{i}).ContourSequence);
else
warning(['Contour ' structures(i).structName ' is empty'])
matRad_cfg.dispWarning(['Contour ' structures(i).structName ' is empty'])
continue;
end
else
warning(['Contour ' structures(i).structName ' is empty'])
matRad_cfg.dispWarning(['Contour ' structures(i).structName ' is empty'])
continue;
end

Expand All @@ -113,12 +121,12 @@

% sanity check 1
if numel(unique(structZ)) > 1
error('Detected contour points outside of single slice\n');
matRad_cfg.dispError('Detected contour points outside of single slice\n');
end

% sanity check 2
if unique(structZ) > max(dicomInfo.SlicePositions) || unique(structZ) < min(dicomInfo.SlicePositions)
warning(['Omitting contour data for ' structures(i).structName ' at slice position ' num2str(unique(structZ)) 'mm - no ct data available.\n']);
matRad_cfg.dispWarning(['Omitting contour data for ' structures(i).structName ' at slice position ' num2str(unique(structZ)) 'mm - no ct data available.\n']);
else
structures(i).item(j).points = [structX, structY, structZ];
end
Expand Down
1 change: 1 addition & 0 deletions dicom/matRad_scanDicomImportFolder.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

% dicom import needs image processing toolbox -> check if available
available = matRad_checkEnvDicomRequirements();
isOctave = strcmp(matRad_cfg.env,'OCTAVE');

if ~available
matRad_cfg.dispError('Image processing toolbox / packages not available!');
Expand Down
2 changes: 1 addition & 1 deletion examples/matRad_example2_photons.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
%%
% Enable sequencing and disable direct aperture optimization (DAO) for now.
% A DAO optimization is shown in a seperate example.
pln.propOpt.runSequencing = 1;
pln.propSeq.runSequencing = 1;
pln.propOpt.runDAO = 0;

%%
Expand Down
6 changes: 3 additions & 3 deletions examples/matRad_example3_photonsDAO.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

%%
% Enable sequencing and direct aperture optimization (DAO).
pln.propOpt.runSequencing = 1;
pln.propOpt.runDAO = 1;
pln.propSeq.runSequencing = true;
pln.propOpt.runDAO = true;

%% Generate Beam Geometry STF
stf = matRad_generateStf(ct,cst,pln);
Expand All @@ -90,7 +90,7 @@
% order to modulate the intensity of the beams with multiple static
% segments, so that translates each intensity map into a set of deliverable
% aperture shapes.
resultGUI = matRad_siochiLeafSequencing(resultGUI,stf,dij,5);
resultGUI = matRad_sequencing(resultGUI,stf,dij,pln);

%% DAO - Direct Aperture Optimization
% The Direct Aperture Optimization is an optimization approach where we
Expand Down
2 changes: 1 addition & 1 deletion examples/matRad_example4_photonsMC.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
pln.propStf.bixelWidth = 10;
pln.propStf.numOfBeams = numel(pln.propStf.gantryAngles);
pln.propStf.isoCenter = ones(pln.propStf.numOfBeams,1) * matRad_getIsoCenter(cst,ct,0);
pln.propOpt.runSequencing = 0;
pln.propSeq.runSequencing = 0;
pln.propOpt.runDAO = 0;

% dose calculation settings
Expand Down
2 changes: 1 addition & 1 deletion examples/matRad_example5_protons.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
pln.propStf.numOfBeams = numel(pln.propStf.gantryAngles);
pln.propStf.isoCenter = ones(pln.propStf.numOfBeams,1) * matRad_getIsoCenter(cst,ct,0);
pln.propOpt.runDAO = 0;
pln.propOpt.runSequencing = 0;
pln.propSeq.runSequencing = 0;

% dose calculation settings
pln.propDoseCalc.doseGrid.resolution.x = 3; % [mm]
Expand Down
2 changes: 1 addition & 1 deletion examples/matRad_example6_protonsNoise.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
pln.propStf.numOfBeams = numel(pln.propStf.gantryAngles);
pln.propStf.isoCenter = ones(pln.propStf.numOfBeams,1) * matRad_getIsoCenter(cst,ct,0);
pln.propOpt.runDAO = 0;
pln.propOpt.runSequencing = 0;
pln.propSeq.runSequencing = 0;

% dose calculation settings
pln.propDoseCalc.doseGrid.resolution.x = 3; % [mm]
Expand Down
2 changes: 1 addition & 1 deletion examples/matRad_example7_carbon.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
pln.propStf.numOfBeams = numel(pln.propStf.gantryAngles);
pln.propStf.isoCenter = ones(pln.propStf.numOfBeams,1) * matRad_getIsoCenter(cst,ct,0);
pln.propOpt.runDAO = 0;
pln.propOpt.runSequencing = 0;
pln.propSeq.runSequencing = 0;

% dose calculation settings
pln.propDoseCalc.doseGrid.resolution.x = 3; % [mm]
Expand Down
Binary file added gui/icons8-gamma-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gui/matRad_MainGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
StructureVisibilityWidget
InfoWidget
ViewingWidget
DVHStatsWidget
eventListeners

matRad_cfg = MatRad_Config.instance();
Expand Down
23 changes: 23 additions & 0 deletions gui/matRad_Widget.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
classdef matRad_Widget < handle

% matRad_Widget Main Class for GUI widget generation
% Describes a standard fluence optimization problem by providing the
% implementation of the objective & constraint function/gradient wrappers
% and managing the mapping and backprojection of the respective dose-
% related quantity
%
% References
% -
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2020 the matRad development team.
%
% This file is part of the matRad project. It is subject to the license
% terms in the LICENSE file found in the top-level directory of this
% distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
% of the matRad project, including this file, may be copied, modified,
% propagated, or distributed except according to the terms contained in the
% LICENSE file.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


properties (GetAccess = public , SetAccess = protected)
widgetHandle %Holds parent widget handle
Expand Down
24 changes: 23 additions & 1 deletion gui/widgets/matRad_3DWidget.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
classdef matRad_3DWidget < matRad_ViewingWidget


% matRad_3DWidget class to generate GUI widget for 3D plan visualization
% Describes a standard fluence optimization problem by providing the
% implementation of the objective & constraint function/gradient wrappers
% and managing the mapping and backprojection of the respective dose-
% related quantity
%
% References
% -
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2020 the matRad development team.
%
% This file is part of the matRad project. It is subject to the license
% terms in the LICENSE file found in the top-level directory of this
% distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
% of the matRad project, including this file, may be copied, modified,
% propagated, or distributed except according to the terms contained in the
% LICENSE file.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

properties
viewingWidgetHandle;
end
Expand Down
Loading