Skip to content

Commit

Permalink
NUCLEUSinv & NUCLEUSmod update:
Browse files Browse the repository at this point in the history
1. new feature: added a new color theme: *black*
2. adjusted the dark color theme to new darker background colors
3. several minor improvements under the hood

NUCLEUSinv

1. extended the BAM NMR tomograph import filter (takes care now also of background measurements)
2. new feature: the Matlab internal `lsqnonneg` is now the default multi-exponential LSQ option even if the Optimization Toolbox is availabe
3. new feature: If the Optimization Toolbox is available the user can choose between `lsqnonneg` and `lsqlin` otherwise see point 2
4. bug fix: `lsqlin` was not working properly (default settings adjusted)
5. bug fix: the tool tips were not properly updated when the solver or regularization option changed (fixed now)
  • Loading branch information
ThoHiller committed Jul 9, 2019
1 parent 7ab6650 commit 39117cc
Show file tree
Hide file tree
Showing 114 changed files with 7,506 additions and 5,995 deletions.
6 changes: 3 additions & 3 deletions NUCLEUSinv/NUCLEUSinv.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
if ~isempty(h0); close(h0); end

%% GUI 'header' info and defaults
myui.version = '0.1.7';
myui.date = '27.06.2019';
myui.version = '0.1.8';
myui.date = '08.07.2019';
myui.author = 'Thomas Hiller';
myui.email = 'thomas.hiller[at]leibniz-liag.de';
myui.fontsize = 10;
Expand Down Expand Up @@ -76,7 +76,7 @@
Mver = ver;
for i = 1:size(Mver,2)
if strcmp(Mver(i).Name,'Optimization Toolbox')
data.info.optim = 'on';
data.info.has_optim = 'on';
end
if strfind(Mver(i).Name,'Statistics')
data.info.stat = 'on';
Expand Down
23 changes: 16 additions & 7 deletions NUCLEUSinv/NUCLEUSinv_createGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ function NUCLEUSinv_createGUI(h,wbon)
% NUCLEUSinv_createGUI(gcf,1)
%
% Other m-files required:
% changeColorTheme.m
% NUCLEUSinv_createMenus.m
% NUCLEUSinv_createPanelData.m
% NUCLEUSinv_createPanelProcess.m
% NUCLEUSinv_createPanelPetro
% NUCLEUSinv_createPanelInversionStd.m
% NUCLEUSinv_createPanelInversionJoint.m
% NUCLEUSinv_createPanelPlots.m
% NUCLEUSinv_createPanelInfo
% NUCLEUSinv_createStatusbar
% NUCLEUSinv_createPanelInfo.m
% NUCLEUSinv_createStatusbar.m
% switchToolTips.m
% updateStatusInformation.m
% updateToolTips.m
%
% Subfunctions:
% none
Expand Down Expand Up @@ -71,18 +75,19 @@ function NUCLEUSinv_createGUI(h,wbon)
if wbon
waitbar(1/steps,hwb,'loading GUI elements - menus');
end
gui = NUCLEUSinv_createMenus(gui);
gui = NUCLEUSinv_createMenus(data,gui);

%% MAIN GUI "BOX"
% make everything invisible during creation
gui.main = uix.VBox('Parent',gui.figh,'Visible','off');
% gui.main = uix.VBox('Parent',gui.figh);

% top part for settings and plots
gui.top = uix.HBoxFlex('Parent',gui.main,'Spacing',5);
gui.top = uix.HBoxFlex('Parent',gui.main,'Spacing',0);
% bottom part for the statusbar
gui.bottom = uix.HBox('Parent',gui.main);
set(gui.main,'Heights',[-1 20]);
% minimum heights of main elements
set(gui.main,'Heights',[-1 20],'MinimumHeights',[250+4*22 20]);

% all control panels are on the left inside a vertically scrollable panel
gui.left = uix.ScrollingPanel('Parent',gui.top);
Expand Down Expand Up @@ -117,7 +122,7 @@ function NUCLEUSinv_createGUI(h,wbon)
% panel header is always 22 high
set(gui.panels.main,'Heights',myui.heights(2,:),...
'MinimumHeights',[250 22 22 22 22]);
set(gui.left,'Heights',-1,'MinimumHeights',593);
set(gui.left,'Heights',-1,'MinimumHeights',250+109+22+190+22);

% 1. data panel
if wbon
Expand Down Expand Up @@ -149,7 +154,7 @@ function NUCLEUSinv_createGUI(h,wbon)
end
% adjust the default joint inversion method depending on Optimization
% toolbox availability
switch data.info.optim
switch data.info.has_optim
case 'on'
data.invjoint.invtype = 'free';
case 'off'
Expand Down Expand Up @@ -187,11 +192,14 @@ function NUCLEUSinv_createGUI(h,wbon)
set(gui.panels.invjoint.main,'Minimized',true);
set(gui.center,'Heights',[-1 -1 22]);
set(gui.plots.CPSPanel,'Minimized',true);
% minimum size of bottom status bar
set(gui.bottom,'MinimumWidths',610);

% make the GUI visible again; "gui" needs to be saved because
% otherwise "fixAxes" throws an error (in NUCLEUSmod); strangely here it
% also works without it, but I put it for consistency reasons
setappdata(h,'gui',gui);
% changeColorTheme('INV',myui.colors.theme);
set(gui.main,'Visible','on');

%% enable all menus
Expand All @@ -208,6 +216,7 @@ function NUCLEUSinv_createGUI(h,wbon)
setappdata(h,'data',data);
displayStatusText(gui,'NUCLEUSinv successfully started');
updateStatusInformation;
updateToolTips;

end

Expand Down
72 changes: 49 additions & 23 deletions NUCLEUSinv/NUCLEUSinv_createMenus.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
function gui = NUCLEUSinv_createMenus(gui)
function gui = NUCLEUSinv_createMenus(data,gui)
%NUCLEUSinv_createMenus creates all GUI menus
%
% Syntax:
% gui = NUCLEUSinv_createMenus(gui)
% gui = NUCLEUSinv_createMenus(gui,data)
%
% Inputs:
% data - figure data structure
% gui - figure gui elements structure
%
% Outputs:
Expand Down Expand Up @@ -215,7 +216,27 @@
set(gui.menu.extra_expert_off,'Checked','on');
end

% 2.2 joint inversion (on/off)
% 2.2 optimization toolbox (on/off)
switch gui.myui.inidata.expertmode
case 'on'
switch data.info.has_optim
case 'on'
gui.menu.extra_solver = uimenu(gui.menu.extra,...
'Label','LSQ Solver','Enable','on');
case 'off'
gui.menu.extra_solver = uimenu(gui.menu.extra,...
'Label','LSQ Solver','Enable','off');
end
case 'off'
gui.menu.extra_solver = uimenu(gui.menu.extra,...
'Label','LSQ Solver','Enable','off');
end
gui.menu.extra_solver_lsqlin = uimenu(gui.menu.extra_solver,...
'Label','LSQLIN (Optim. TB)','Callback',@onMenuSolver);
gui.menu.extra_solver_lsqnonneg = uimenu(gui.menu.extra_solver,...
'Label','LSQNONNEG (default)','Checked','on','Callback',@onMenuSolver);

% 2.3 joint inversion (on/off)
switch gui.myui.inidata.expertmode
case 'on'
gui.menu.extra_joint = uimenu(gui.menu.extra,...
Expand All @@ -230,11 +251,11 @@
'Label','Off','Checked','on','Callback',@onMenuJointInversion);


% 2.3 settings
% 2.4 settings
gui.menu.extra_settings = uimenu(gui.menu.extra,...
'Label','Settings');

% 2.3.1 inversion info (on/off)
% 2.4.1 inversion info (on/off)
gui.menu.extra_settings_invinfo = uimenu(gui.menu.extra_settings,...
'Label','Inversion Display');
gui.menu.extra_settings_invinfo_on = uimenu(gui.menu.extra_settings_invinfo,...
Expand All @@ -248,7 +269,7 @@
set(gui.menu.extra_settings_invinfo_off,'Checked','on');
end

% 2.3.2 tooltips (on/off)
% 2.4.2 tooltips (on/off)
gui.menu.extra_settings_tooltips = uimenu(gui.menu.extra_settings,...
'Label','Tooltips');
gui.menu.extra_settings_tooltips_on = uimenu(gui.menu.extra_settings_tooltips,...
Expand All @@ -262,75 +283,80 @@
set(gui.menu.extra_settings_tooltips_off,'Checked','on');
end

% 2.3.3 INFO fields in plot panels (on/off)
% 2.4.3 INFO fields in plot panels (on/off)
gui.menu.extra_settings_infofields = uimenu(gui.menu.extra_settings,...
'Label','INFO fields');
gui.menu.extra_settings_infofields_on = uimenu(gui.menu.extra_settings_infofields ,...
'Label','On','Callback',@onMenuExtraShow);
gui.menu.extra_settings_infofields_off = uimenu(gui.menu.extra_settings_infofields,...
'Label','Off','Checked','on','Callback',@onMenuExtraShow);

% 2.3.4 color theme
% 2.4.4 color theme
gui.menu.extra_settings_theme = uimenu(gui.menu.extra_settings,...
'Label','Color Theme');
% 2.3.4.1 default color theme
% 2.4.4.1 default color theme
gui.menu.extra_settings_theme_standard = uimenu(gui.menu.extra_settings_theme,...
'Label','standard','Callback',@onMenuExtraColor);
% 2.3.4.2 basic color theme
% 2.4.4.2 basic color theme
gui.menu.extra_settings_theme_basic = uimenu(gui.menu.extra_settings_theme,...
'Label','basic','Callback',@onMenuExtraColor);
% 2.3.4.3 dark color theme
% 2.4.4.3 dark color theme
gui.menu.extra_settings_theme_dark = uimenu(gui.menu.extra_settings_theme,...
'Label','dark','Callback',@onMenuExtraColor);
% 2.4.4.4 black color theme
gui.menu.extra_settings_theme_black = uimenu(gui.menu.extra_settings_theme,...
'Label','black','Callback',@onMenuExtraColor);
switch gui.myui.inidata.colortheme
case 'standard'
set(gui.menu.extra_settings_theme_standard,'Checked','on');
case 'basic'
set(gui.menu.extra_settings_theme_basic,'Checked','on');
case 'dark'
set(gui.menu.extra_settings_theme_dark,'Checked','on');
case 'black'
set(gui.menu.extra_settings_theme_black,'Checked','on');
end

% 2.3.5 joint inversion settings
% 2.4.5 joint inversion settings
gui.menu.extra_settings_joint = uimenu(gui.menu.extra_settings,...
'Label','Joint Inversion','Enable','off','Separator','on');
% 2.3.5.1 joint inversion settings
% 2.4.5.1 joint inversion settings
gui.menu.extra_settings_joint_rhobounds = uimenu(gui.menu.extra_settings_joint,...
'Label','Surface relaxivity bounds','Callback',@onMenuExtraRhoBounds);

% 2.4 figures
% 2.5 figures
gui.menu.extra_graphics = uimenu(gui.menu.extra,...
'Label','Figures');
% 2.4.1 parameter file info
% 2.5.1 parameter file info
gui.menu.extra_graphics_parinfo = uimenu(gui.menu.extra_graphics,...
'Label','Parameter Info','Callback',@onMenuExtraShow);
% 2.4.2 fit statistics
% 2.5.2 fit statistics
gui.menu.extra_graphics_stats = uimenu(gui.menu.extra_graphics,...
'Label','Fit statistics','Callback',@onMenuExtraGraphics);
switch gui.myui.inidata.expertmode
case 'on'
% 2.4.3 amplitude over time
% 2.5.3 amplitude over time
gui.menu.extra_graphics_amp = uimenu(gui.menu.extra_graphics,...
'Label','AMP-TLGM-SNR','Callback',@onMenuExtraGraphics);
% 2.4.4 amplitude vs tlgm
% 2.5.4 amplitude vs tlgm
gui.menu.extra_graphics_amp2 = uimenu(gui.menu.extra_graphics,...
'Label','AMP vs TLGM','Callback',@onMenuExtraGraphics);
% 2.4.5 relaxation time distribution over time
% 2.5.5 relaxation time distribution over time
gui.menu.extra_graphics_rtd = uimenu(gui.menu.extra_graphics,...
'Label','RTD','Callback',@onMenuExtraGraphics);
case 'off'
% 2.4.3 amplitude over time
% 2.5.3 amplitude over time
gui.menu.extra_graphics_amp = uimenu(gui.menu.extra_graphics,...
'Label','AMP-TLGM-SNR','Enable','off','Callback',@onMenuExtraGraphics);
% 2.4.4 amplitude vs tlgm
% 2.5.4 amplitude vs tlgm
gui.menu.extra_graphics_amp2 = uimenu(gui.menu.extra_graphics,...
'Label','AMP vs TLGM','Enable','off','Callback',@onMenuExtraGraphics);
% 2.4.5 relaxation time distribution over time
% 2.5.5 relaxation time distribution over time
gui.menu.extra_graphics_rtd = uimenu(gui.menu.extra_graphics,...
'Label','RTD','Enable','off','Callback',@onMenuExtraGraphics);
end

% 2.5 PhaseView
% 2.6 PhaseView
gui.menu.extra_phaseview = uimenu(gui.menu.extra,...
'Label','PhaseView','Callback',@PhaseView);

Expand Down
2 changes: 1 addition & 1 deletion NUCLEUSinv/NUCLEUSinv_createPanelInversionJoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
'String','inversion method');
tstr = 'tba';

switch data.info.optim
switch data.info.has_optim
case 'on'
gui.popup_handles.invjoint_InvType = uicontrol('Parent',gui.panels.invjoint.HBox1,...
'Style','popup','FontSize',myui.fontsize,...
Expand Down
91 changes: 10 additions & 81 deletions NUCLEUSinv/NUCLEUSinv_createPanelInversionStd.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,55 +59,13 @@
gui.text_handles.invstd_InvType = uicontrol('Parent',gui.panels.invstd.HBox1,...
'Style','text','FontSize',myui.fontsize,'HorizontalAlignment','center',...
'String','inversion method');
switch data.info.optim
case 'on'
switch data.info.ExpertMode
case 'on'
tstr = ['<HTML>Choose between different inversion (fitting) methods.<br><br>',...
'<u>Available options:</u><br>',...
'<b>Mono exp.</b> Mono-exponential fitting.<br>',...
'<b>X free exp.</b> Multi-exponential fitting with up to 5 free relaxation times.<br>',...
'<b>Multi exp. (LSQLIN)</b> Multi-exponential fitting with Optimization Toolbox.<br>',...
'<b>Multi exp. (ILA)</b> Multi-exponential fitting using an Inverse Laplace transform.<br><br>',...
'Depending on the chosen method there are additional options available.<br><br>',...
'<u>Default value:</u><br>',...
'<b>Multi exp. (LSQLIN)</b><br>'];
istring = {'Mono exp.','Several free exp. (2-5)','Multi exp. (LSQLIN)','Multi exp. (InvLaplace)'};
case 'off'
tstr = ['<HTML>Choose between different inversion (fitting) methods.<br><br>',...
'<u>Available options:</u><br>',...
'<b>Mono exp.</b> Mono-exponential fitting.<br>',...
'<b>X free exp.</b> Multi-exponential fitting with up to 5 free relaxation times.<br>',...
'<b>Multi exp. (LSQLIN)</b> Multi-exponential fitting with Optimization Toolbox.<br>',...
'Depending on the chosen method there are additional options available.<br><br>',...
'<u>Default value:</u><br>',...
'<b>Multi exp. (LSQLIN)</b><br>'];
istring = {'Mono exp.','Several free exp. (2-5)','Multi exp. (LSQLIN)'};
end
switch data.info.ExpertMode
case 'on'
tstr = ' ';
istring = {'Mono exp.','Several free exp. (2-5)','Multi exp. (LSQ)','Multi exp. (InvLaplace)'};
case 'off'
switch data.info.ExpertMode
case 'on'
tstr = ['<HTML>Choose between different inversion (fitting) methods.<br><br>',...
'<u>Available options:</u><br>',...
'<b>Mono exp.</b> Mono-exponential fitting.<br>',...
'<b>Several free exp.</b> Multi-exponential fitting with up to 5 free relaxation times.<br>',...
'<b>Multi exp. (NNLS)</b> Multi-exponential fitting with Non Negative Least Squares (NNLS).<br>',...
'<b>Multi exp. (ILA)</b> Multi-exponential fitting using an Inverse Laplace transform.<br><br>',...
'Depending on the chosen method there are additional options available.<br><br>',...
'<u>Default value:</u><br>',...
'<b>Multi exp. (NNLS)</b><br>'];
istring = {'Mono exp.','Several free exp. (2-5)','Multi exp. (NNLS)','Multi exp. (InvLaplace)'};
case 'off'
tstr = ['<HTML>Choose between different inversion (fitting) methods.<br><br>',...
'<u>Available options:</u><br>',...
'<b>Mono exp.</b> Mono-exponential fitting.<br>',...
'<b>Several free exp.</b> Multi-exponential fitting with up to 5 free relaxation times.<br>',...
'<b>Multi exp. (NNLS)</b> Multi-exponential fitting with Non Negative Least Squares (NNLS).<br>',...
'Depending on the chosen method there are additional options available.<br><br>',...
'<u>Default value:</u><br>',...
'<b>Multi exp. (NNLS)</b><br>'];
istring = {'Mono exp.','Several free exp. (2-5)','Multi exp. (NNLS)'};
end
tstr = ' ';
istring = {'Mono exp.','Several free exp. (2-5)','Multi exp. (LSQ)'};
end
gui.popup_handles.invstd_InvType = uicontrol('Parent',gui.panels.invstd.HBox1,...
'Style','popup','String',istring,'FontSize',myui.fontsize,'Enable','off','Value',3,...
Expand Down Expand Up @@ -140,40 +98,11 @@
'String','regularization options');
switch data.info.ExpertMode
case 'on'
tstr = ['<HTML>Choose additional options depending on the chosen inversion (fitting) method.<br><br>',...
'<u>Available options:</u><br>',...
'<font color="red">Mono exp.:<br>',...
'<font color="black"><b>none</b><br>',...
'<font color="red">X free exp.:<br>',...
'<font color="black"><b>1-5</b> choose how many free relaxation times to use.<br>',...
'<font color="red">Multi exp.:<br>',...
'<font color="black"><b>Manual</b> Manual regularization.<br>',...
'<font color="black"><b>IterChi2</b> Find Chi2=1 iteratively.<br>',...
'<font color="black"><b>Tikhonov (GCV)</b> Tikhonov regularization (SVD-Toolbox).<br>',...
'<font color="black"><b>TSVD (GCV)</b> Regularization via Truncated SVD (SVD-Toolbox).<br>',...
'<font color="black"><b>DSVD (GCV)</b> Regularization via Damped SVD (SVD-Toolbox).<br>',...
'<font color="black"><b>Discrep.</b> Regularization according to discrepancy principle (SVD-Toolbox).<br>',...
'<font color="black"><b>L-curve</b> Perform the L-curve test to find optimal regularization parameter lambda.<br>',...
'<font color="red">Multi exp. (ILA):<br>',...
'<font color="black"><b>Manual</b> Manual regularization.<br>',...
'<font color="black"><b>Automatic</b> Automatic regularization.<br><br>',...
'<u>Default value:</u><br>',...
'<b>Manual</b><br>'];
tstr = ' ';
rstring = {'Manual','Iterative Chi2','Tikhonov (SVD)','TSVD (SVD)',...
'DSVD (SVD)','Discrep. (SVD)','L-curve'};
case 'off'
tstr = ['<HTML>Choose additional options depending on the chosen inversion (fitting) method.<br><br>',...
'<u>Available options:</u><br>',...
'<font color="red">Mono exp.:<br>',...
'<font color="black"><b>none</b><br>',...
'<font color="red">X free exp.:<br>',...
'<font color="black"><b>1-5</b> choose how many free relaxation times to use.<br>',...
'<font color="red">Multi exp.:<br>',...
'<font color="black"><b>Manual</b> Manual regularization.<br>',...
'<font color="black"><b>IterChi2</b> Find Chi2=1 iteratively.<br>',...
'<font color="black"><b>L-curve</b> Perform the L-curve test to find optimal regularization parameter lambda.<br><br>',...
'<u>Default value:</u><br>',...
'<b>Manual</b><br>'];
tstr = ' ';
rstring = {'Manual','Iterative Chi2','L-curve'};
end
gui.popup_handles.invstd_InvTypeOpt = uicontrol('Parent',gui.panels.invstd.HBox3,...
Expand All @@ -187,9 +116,9 @@
'HorizontalAlignment','center','String','smoothness constraint (L-order)');
tstr = ['<HTML>Choose the smoothness constraint for the multi-exponential fitting routines.<br><br>',...
'<u>Available options:</u><br>',...
'<font color="red">Mono exp. | X free exp.:<br>',...
'<font color="red">Mono exp. | Several free exp. (2-5):<br>',...
'<font color="black"><b>none</b><br>',...
'<font color="red">Multi exp. (NNLS/LSQLIN) | Multi exp. (ILA):<br>',...
'<font color="red">Multi exp. (LSQ) | Multi exp. (ILA):<br>',...
'<font color="black">',...
'<b>0</b> Zeroth-order smoothness constraint.<br>',...
'<b>1</b> First-order smoothness constraint.<br>',...
Expand Down
Loading

0 comments on commit 39117cc

Please sign in to comment.