Skip to content

Commit

Permalink
Further improvements to the GUI widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
nellyabbani committed Jun 30, 2020
1 parent 4f69fa4 commit 5694ffd
Show file tree
Hide file tree
Showing 14 changed files with 648 additions and 844 deletions.
23 changes: 21 additions & 2 deletions IO/matRad_Widget.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
this.widgetHandle = handleParent;
this.createLayout();
this.initialize();

[env, ~] = matRad_getEnvironment();

% only enable in matlab
%strcmp(env,'MATLAB') &&
if strcmp(env,'MATLAB') && strcmp(get(handleParent,'type'),'figure')
set(this.widgetHandle,'ButtonDownFcn',@(src,hEvent) update(this));
set(this.widgetHandle,'KeyPressFcn',@(src,hEvent) update(this));
end
end

function set.handles(obj,handles)
Expand All @@ -37,7 +46,7 @@
%}

function handles = showError(this,Message,ME)
global matRad_cfg; matRad_cfg = MatRad_Config.instance();
matRad_cfg = MatRad_Config.instance();
handles = this.handles;
if nargin == 3
%Add exception message
Expand All @@ -60,7 +69,7 @@
end

function showWarning(this,Message,ME)
global matRad_cfg; matRad_cfg = MatRad_Config.instance();
matRad_cfg = MatRad_Config.instance();

handles = this.handles;
if nargin == 3
Expand Down Expand Up @@ -89,6 +98,16 @@ function showWarning(this,Message,ME)
% notify(this,'workspaceChanged',workSpaceVariables);
%end

function enableWindowCallback(this,enable)

if strcmp(get(this.widgetHandle,'type'),'figure') && enable
set(this.widgetHandle,'ButtonDownFcn',@(src,hEvent) update(this));
set(this.widgetHandle,'KeyPressFcn',@(src,hEvent) update(this));
else
set(this.widgetHandle,'ButtonDownFcn','');
set(this.widgetHandle,'KeyPressFcn','');
end
end
end

%methods (Abstract)
Expand Down
23 changes: 23 additions & 0 deletions MatRad_Config.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
keepLog = false;

disableGUI = false;
devMode = false;
eduMode = false;
end

properties (SetAccess = private)
Expand Down Expand Up @@ -63,6 +65,8 @@ function setDefaultProperties(obj)
obj.propMC.MCsquare_defaultHistories = 1e6;
obj.propMC.direct_defaultHistories = 2e4;
obj.disableGUI = false;
obj.devMode = false;
obj.eduMode = false;
end

%%For testing
Expand All @@ -78,7 +82,26 @@ function setDefaultPropertiesForTesting(obj)
obj.propMC.MCsquare_defaultHistories = 100;
obj.propMC.direct_defaultHistories = 100;
obj.disableGUI = true;
obj.devMode = false;
obj.eduMode = false;
end

%%for edu mode
function setDefaultPropertiesForEduMode(obj)
obj.logLevel = 1;
obj.propStf.defaultLongitudinalSpotSpacing = 20;
obj.propStf.defaultAddMargin = true; %expand target for beamlet finding
obj.propDoseCalc.defaultResolution = struct('x',5,'y',6,'z',7); %[mm]
obj.propDoseCalc.defaultGeometricCutOff = 20;
obj.propDoseCalc.defaultLateralCutOff = 0.8;
obj.propOpt.defaultMaxIter = 10;
obj.propMC.ompMC_defaultHistories = 100;
obj.propMC.MCsquare_defaultHistories = 100;
obj.propMC.direct_defaultHistories = 100;
obj.disableGUI = false;
obj.devMode = false;
obj.eduMode = false;
end

function dispDebug(obj,formatSpec,varargin)
%dispDebug wrapper for debug messages forwarded to displayToConsole
Expand Down
1 change: 0 additions & 1 deletion gui/matRad_3DWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
end

this = this@matRad_ViewingWidget(handleParent);
set(this.widgetHandle,'ButtonDownFcn',@(src,hEvent) update(this));

if nargin>=1
this.viewingWidgetHandle=viewingWidgetHandle;
Expand Down
9 changes: 4 additions & 5 deletions gui/matRad_DVHWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@

end

this = this@matRad_Widget(handleParent);
set(this.widgetHandle,'ButtonDownFcn',@(src,hEvent) update(this));
this = this@matRad_Widget(handleParent);

end

function this=initialize(this)
if evalin('base','exist(''resultGUI'')')
this.showDVH();
end
end

function this=initialize(this)
end

function this=update(this)
if evalin('base','exist(''resultGUI'')')
this.showDVH();
Expand Down
45 changes: 23 additions & 22 deletions gui/matRad_InfoWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,29 @@

function btnAbout_Callback(this, hObject, event)
handles = this.handles;
msgbox({'https://github.com/e0404/matRad/' 'email: [email protected]'},'About');
% handles.eduMode = logical(parsedInput.eduMode);
% [~,matRadVer] = matRad_version;
%
% msg{1} = ['matRad ''' matRadVer.name '''']; %Name
% if handles.eduMode
% msg{1} = [msg{1} ' Educational'];
% end
% msg{end+1} = sprintf('v%d.%d.%d',matRadVer.major,matRadVer.minor,matRadVer.patch); %Version Number
% if isdeployed
% msg{end+1} = 'Standalone Version';
% elseif ~isempty(matRadVer.branch) && ~isempty(matRadVer.commitID)
% msg{end+1} = sprintf('Git: Branch %s, commit %s',matRadVer.branch,matRadVer.commitID(1:8));
% end
%
% [env,envver] = matRad_getEnvironment();
% msg{end+1} = sprintf('Environment: %s v%s %s',env,envver,version('-release'));
%
% msg{end+1} = 'Web: www.matrad.org';
% msg{end+1} = 'E-Mail: [email protected]';
%
% msgbox(msg,'About matRad');
%msgbox({'https://github.com/e0404/matRad/' 'email: [email protected]'},'About');

matRad_cfg = MatRad_Config.instance();
[~,matRadVer] = matRad_version;

msg{1} = ['matRad ''' matRadVer.name '''']; %Name
if matRad_cfg.eduMode
msg{1} = [msg{1} ' Educational'];
end
msg{end+1} = sprintf('v%d.%d.%d',matRadVer.major,matRadVer.minor,matRadVer.patch); %Version Number
if isdeployed
msg{end+1} = 'Standalone Version';
elseif ~isempty(matRadVer.branch) && ~isempty(matRadVer.commitID)
msg{end+1} = sprintf('Git: Branch %s, commit %s',matRadVer.branch,matRadVer.commitID(1:8));
end

[env,envver] = matRad_getEnvironment();
msg{end+1} = sprintf('Environment: %s v%s %s',env,envver,version('-release'));

msg{end+1} = 'Web: www.matrad.org';
msg{end+1} = 'E-Mail: [email protected]';

msgbox(msg,'About matRad');


this.handles = handles;
Expand Down
Loading

0 comments on commit 5694ffd

Please sign in to comment.