diff --git a/BLOCHUS/BLOCHUS.m b/BLOCHUS/BLOCHUS.m index 140ba1e..9564ca4 100644 --- a/BLOCHUS/BLOCHUS.m +++ b/BLOCHUS/BLOCHUS.m @@ -33,8 +33,8 @@ %------------- BEGIN CODE -------------- %% GUI 'header' info and default GUI settings -myui.version = '0.1.2'; -myui.date = '17.05.2020'; +myui.version = '0.1.3'; +myui.date = '22.05.2020'; myui.author = 'Thomas Hiller'; myui.email = 'thomas.hiller[at]leibniz-liag.de'; diff --git a/BLOCHUS/BLOCHUS_createGUI.m b/BLOCHUS/BLOCHUS_createGUI.m index 7c5d72c..d263292 100644 --- a/BLOCHUS/BLOCHUS_createGUI.m +++ b/BLOCHUS/BLOCHUS_createGUI.m @@ -143,9 +143,9 @@ function BLOCHUS_createGUI(h,wbon) set(gui.main,'Visible','on'); %% enable all menus -set(gui.menu.file,'Enable','on'); -set(gui.menu.view,'Enable','on'); -set(gui.menu.help,'Enable','on'); +set(gui.menu_handles.file,'Enable','on'); +set(gui.menu_handles.view,'Enable','on'); +set(gui.menu_handles.help,'Enable','on'); %% update the GUI data gui.myui = myui; diff --git a/BLOCHUS/BLOCHUS_createMenus.m b/BLOCHUS/BLOCHUS_createMenus.m index a11b74c..c0f58ba 100644 --- a/BLOCHUS/BLOCHUS_createMenus.m +++ b/BLOCHUS/BLOCHUS_createMenus.m @@ -30,65 +30,77 @@ %------------- BEGIN CODE -------------- %% 1. File -gui.menu.file = uimenu(gui.figh,... - 'Label','File','Enable','off'); +gui.menu_handles.file = uimenu(gui.figh,... + 'Label','File',... + 'Enable','off'); % 1.1 Import -gui.menu.file_import = uimenu(gui.menu.file,... - 'Label','Import','Enable','on'); - -% 1.1.1 BLOCHUS session file -gui.menu.file_import_session = uimenu(gui.menu.file_import,... - 'Label','Session file','Callback',@onMenuImport); +gui.menu_handles.file_import = uimenu(gui.menu_handles.file,... + 'Label','Import Data',... + 'Callback',@onMenuImport); % 1.2 Export -gui.menu.file_export = uimenu(gui.menu.file,... - 'Label','Export'); - -% 1.2.1 BLOCHUS session file -gui.menu.file_export_session = uimenu(gui.menu.file_export,... - 'Label','Session file','Callback',@onMenuExport); +gui.menu_handles.file_export = uimenu(gui.menu_handles.file,... + 'Label','Export Data',... + 'Callback',@onMenuExport); % 1.3 Restart -gui.menu.file_restart = uimenu(gui.menu.file,... - 'Label','Restart','Separator','on','Callback',@onMenuRestartQuit); +gui.menu_handles.file_restart = uimenu(gui.menu_handles.file,... + 'Label','Restart',... + 'Separator','on',... + 'Callback',@onMenuRestartQuit); % 1.4 Quit -gui.menu.file_quit = uimenu(gui.menu.file,... - 'Label','Quit','Separator','on','Callback',@onMenuRestartQuit); +gui.menu_handles.file_quit = uimenu(gui.menu_handles.file,... + 'Label','Quit',... + 'Callback',@onMenuRestartQuit); %% 2. Extras -gui.menu.view = uimenu(gui.figh,... - 'Label','View','Enable','off'); +gui.menu_handles.view = uimenu(gui.figh,... + 'Label','View',... + 'Enable','off'); + % 2.1 Tooltips (on/off) -gui.menu.view_tooltips = uimenu(gui.menu.view,... - 'Label','Tooltips','Checked','on','Callback',@onMenuViewShow); +gui.menu_handles.view_tooltips = uimenu(gui.menu_handles.view,... + 'Label','Tooltips',... + 'Checked','on',... + 'Callback',@onMenuView); + % 2.2 Figure Toolbar -gui.menu.view_toolbar = uimenu(gui.menu.view,... - 'Label','Figure Toolbar','Callback',@onMenuViewShow); -% 2.3.1 Tigures -gui.menu.view_figures = uimenu(gui.menu.view,... +gui.menu_handles.view_toolbar = uimenu(gui.menu_handles.view,... + 'Label','Figure Toolbar',... + 'Callback',@onMenuView); +% 2.3.1 Figures +gui.menu_handles.view_figures = uimenu(gui.menu_handles.view,... 'Label','Figures','Separator','on'); % 2.3.1.1 current -gui.menu.view_figures_current = uimenu(gui.menu.view_figures,... - 'Label','Current View','Callback',@onMenuViewFigure); +gui.menu_handles.view_figures_current = uimenu(gui.menu_handles.view_figures,... + 'Label','Current View',... + 'Callback',@onMenuViewFigure); % 2.3.1.2 only magnetization -gui.menu.view_figures_mag = uimenu(gui.menu.view_figures,... - 'Label','Magnetization','Callback',@onMenuViewFigure); +gui.menu_handles.view_figures_mag = uimenu(gui.menu_handles.view_figures,... + 'Label','Magnetization',... + 'Callback',@onMenuViewFigure); % 2.3.1.3 only ramp -gui.menu.view_figures_ramp = uimenu(gui.menu.view_figures,... - 'Label','Switch-off Ramp','Enable','off','Callback',@onMenuViewFigure); +gui.menu_handles.view_figures_ramp = uimenu(gui.menu_handles.view_figures,... + 'Label','Switch-off Ramp',... + 'Enable','off',... + 'Callback',@onMenuViewFigure); % 2.3.1.4 only pulse -gui.menu.view_figures_pulse = uimenu(gui.menu.view_figures,... - 'Label','Pulse','Enable','off','Callback',@onMenuViewFigure); +gui.menu_handles.view_figures_pulse = uimenu(gui.menu_handles.view_figures,... + 'Label','Pulse',... + 'Enable','off',... + 'Callback',@onMenuViewFigure); %% 3. Help -gui.menu.help = uimenu(gui.figh,... - 'Label','Help','Enable','off'); +gui.menu_handles.help = uimenu(gui.figh,... + 'Label','Help',... + 'Enable','off'); % 3.1 About -gui.menu.help_about = uimenu(gui.menu.help,... - 'Label','About','Callback',@onMenuHelp); +gui.menu_handles.help_about = uimenu(gui.menu_handles.help,... + 'Label','About',... + 'Callback',@onMenuHelp); return diff --git a/BLOCHUS/BLOCHUS_createPanelPulse.m b/BLOCHUS/BLOCHUS_createPanelPulse.m index 405b09d..db5a666 100644 --- a/BLOCHUS/BLOCHUS_createPanelPulse.m +++ b/BLOCHUS/BLOCHUS_createPanelPulse.m @@ -414,6 +414,8 @@ jh.setVerticalAlignment(javax.swing.JLabel.CENTER) jh = findjobj(gui.text_handles.PulseAxis); jh.setVerticalAlignment(javax.swing.JLabel.CENTER) +jh = findjobj(gui.text_handles.PulsePolarization); +jh.setVerticalAlignment(javax.swing.JLabel.CENTER) jh = findjobj(gui.text_handles.PulseB1Factor); jh.setVerticalAlignment(javax.swing.JLabel.CENTER) jh = findjobj(gui.text_handles.PulseTtau); diff --git a/CHANGELOG.md b/CHANGELOG.md index be506bd..83a8b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.1.3] - 2020-05-22 + +### Added +- Two additional examples that demonstrate the creation of lookup tables (one example for pre-polarization switch-off ramps and one example for adiabatic excitation pulses). + +### Changed +- Minor GUI improvements and consistency clean ups. + ## [0.1.2] - 2020-05-17 ### Changed @@ -24,6 +32,7 @@ Initial Version +[0.1.3]: https://github.com/ThoHiller/nmr-blochus/compare/v0.1.2...v0.1.3 [0.1.2]: https://github.com/ThoHiller/nmr-blochus/compare/v.0.1.1...v0.1.2 [0.1.1]: https://github.com/ThoHiller/nmr-blochus/compare/v.0.1.0...v.0.1.1 [0.1.0]: https://github.com/ThoHiller/nmr-blochus/releases/tag/v.0.1.0 diff --git a/README.md b/README.md index 66673f0..d012435 100644 --- a/README.md +++ b/README.md @@ -85,14 +85,14 @@ In no particular order and without guarantee that it will ever happen :-) : ### Cite as If you use BLOCHUS for your research, please cite it as: -Thomas Hiller. (2020, May 17). ThoHiller/nmr-blochus: v0.1.2 (Version v0.1.2). Zenodo. [https://doi.org/10.5281/zenodo.3829464] +Thomas Hiller. (2020, May 22). ThoHiller/nmr-blochus: v0.1.3 (Version v0.1.3). Zenodo. [https://doi.org/10.5281/zenodo.3829464] Note: Even though the version number might change due to updates, this DOI is permanent (represents all versions) and always links to the latest version. ### References -1. Hiller, T., Dlugosch, R. and Müller-Petke, M., "Utilizing pre-polarization to enhance SNMR signals - effect of imperfect switch-off", Geophysical Journal International **0**(0), p.1-15, 2020, [DOI](https://doi.org/10.1093/gji/ggaa216) +1. Hiller, T., Dlugosch, R. and Müller-Petke, M., "Utilizing pre-polarization to enhance SNMR signals - effect of imperfect switch-off", Geophysical Journal International **222**(2), p.815-826, 2020, [DOI](https://doi.org/10.1093/gji/ggaa216) - - -
MATLAB is a registered trademark of The Mathworks, Inc.
\ No newline at end of file diff --git a/callbacks/checkbox/onCheckPrePolPulse.m b/callbacks/checkbox/onCheckPrePolPulse.m index 60739c8..e5435e3 100644 --- a/callbacks/checkbox/onCheckPrePolPulse.m +++ b/callbacks/checkbox/onCheckPrePolPulse.m @@ -47,8 +47,8 @@ function onCheckPrePolPulse(src,~) data.basic.type = 'std'; % menu settings - set(gui.menu.view_figures_ramp,'Enable','off'); - set(gui.menu.view_figures_pulse,'Enable','off'); + set(gui.menu_handles.view_figures_ramp,'Enable','off'); + set(gui.menu_handles.view_figures_pulse,'Enable','off'); % std settings data.basic.Minit = [1 0 0]; @@ -111,8 +111,8 @@ function onCheckPrePolPulse(src,~) data.basic.type = 'prepol'; % menu settings - set(gui.menu.view_figures_ramp,'Enable','on'); - set(gui.menu.view_figures_pulse,'Enable','off'); + set(gui.menu_handles.view_figures_ramp,'Enable','on'); + set(gui.menu_handles.view_figures_pulse,'Enable','off'); % std settings data.basic.Tsim = data.prepol.Tramp; @@ -173,8 +173,8 @@ function onCheckPrePolPulse(src,~) data.basic.type = 'pulse'; % menu settings - set(gui.menu.view_figures_ramp,'Enable','off'); - set(gui.menu.view_figures_pulse,'Enable','on'); + set(gui.menu_handles.view_figures_ramp,'Enable','off'); + set(gui.menu_handles.view_figures_pulse,'Enable','on'); % std settings data.basic.Tsim = data.pulse.Ttau; @@ -223,8 +223,8 @@ function onCheckPrePolPulse(src,~) data.basic.type = 'prepolpulse'; % menu settings - set(gui.menu.view_figures_ramp,'Enable','on'); - set(gui.menu.view_figures_pulse,'Enable','on'); + set(gui.menu_handles.view_figures_ramp,'Enable','on'); + set(gui.menu_handles.view_figures_pulse,'Enable','on'); % std settings data.basic.Minit = [1 0 0]; diff --git a/callbacks/menus/onMenuHelp.m b/callbacks/menus/onMenuHelp.m index b1c0bcc..e646df8 100644 --- a/callbacks/menus/onMenuHelp.m +++ b/callbacks/menus/onMenuHelp.m @@ -74,7 +74,7 @@ function onMenuHelp(src,~) % create Figure hf = figure('Name','About BLOCHUS',... 'NumberTitle','off','Tag','Help','ToolBar','none','MenuBar','none',... - 'Resize','off','Position',[xp yp ww hh]); + 'Resize','off','Position',[xp yp ww hh],'Visible','off'); v1 = uix.VBox('Parent',hf,'Padding',10,'Spacing',10); % text area @@ -116,6 +116,9 @@ function onMenuHelp(src,~) % text hack jh = findjobj(t1); jh.setVerticalAlignment(javax.swing.JLabel.CENTER) + + % make the figure content visible + set(hf,'Visible','on'); else warndlg({'onMenuHelp:','There is no figure with the BLOCHUS Tag open.'},... diff --git a/callbacks/menus/onMenuViewShow.m b/callbacks/menus/onMenuView.m similarity index 71% rename from callbacks/menus/onMenuViewShow.m rename to callbacks/menus/onMenuView.m index 9bf2c98..d7857f9 100644 --- a/callbacks/menus/onMenuViewShow.m +++ b/callbacks/menus/onMenuView.m @@ -1,8 +1,8 @@ -function onMenuViewShow(src,~) -%onMenuViewShow handles the extra menu entries +function onMenuView(src,~) +%onMenuView handles the extra menu entries % % Syntax: -% onMenuViewShow(src) +% onMenuView(src) % % Inputs: % src - handle of the calling object @@ -11,7 +11,7 @@ function onMenuViewShow(src,~) % none % % Example: -% onMenuViewShow(src,~) +% onMenuView(src,~) % % Other m-files required: % switchToolTips @@ -39,26 +39,25 @@ function onMenuViewShow(src,~) data = getappdata(fig,'data'); switch get(src,'Label') - case 'Tooltips' % switch on/off Tooltips - onoff = get(gui.menu.view_tooltips,'Checked'); - switchToolTips(gui,onoff); - switch onoff - case 'on' - set(gui.menu.view_tooltips,'Checked','off'); + case 'Tooltips' % switch on/off Tooltips + switch get(src,'Checked') + case 'on' % if it is on, switch it off + switchToolTips(gui,'off'); + set(src,'Checked','off'); data.info.ToolTips = 0; case 'off' - set(gui.menu.view_tooltips,'Checked','on'); + switchToolTips(gui,'on'); + set(src,'Checked','on'); data.info.ToolTips = 1; end case 'Figure Toolbar' % switch on/off the default Figure Toolbar - onoff = get(gui.menu.view_toolbar,'Checked'); - switch onoff - case 'on' - set(gui.menu.view_toolbar,'Checked','off'); + switch get(src,'Checked') + case 'on' % if it is on, switch it off + set(src,'Checked','off'); viewmenufcn('FigureToolbar'); case 'off' - set(gui.menu.view_toolbar,'Checked','on'); + set(src,'Checked','on'); viewmenufcn('FigureToolbar'); end end @@ -70,7 +69,7 @@ function onMenuViewShow(src,~) updateStatusInformation(fig); else - warndlg({'onMenuViewShow:','There is no figure with the BLOCHUS Tag open.'},... + warndlg({'onMenuView:','There is no figure with the BLOCHUS Tag open.'},... 'BLOCHUS error'); end diff --git a/callbacks/push/onPushRun.m b/callbacks/push/onPushRun.m index c66f4f6..a9f2c84 100644 --- a/callbacks/push/onPushRun.m +++ b/callbacks/push/onPushRun.m @@ -196,9 +196,9 @@ function onPushRun(src,~) pulseparam.PulseType = data.pulse.Type; % gyromagnetic ratio [rad/s/T] pulseparam.gamma = odeparam.gamma; - % Larmor frequency [rad] + % Larmor frequency [rad/s] pulseparam.omega0 = getOmega0(odeparam.gamma,odeparam.B0); - % pulse amplitude [B0] + % pulse amplitude [T] pulseparam.Amp = odeparam.B0*data.pulse.B1Factor; % pulse frequency modulation [struct] pulseparam.fmod = data.results.pulse.fmod; @@ -263,7 +263,7 @@ function onPushRun(src,~) % set theta for all time steps after the pulse simply to % omega0*t theta(indT) = getOmega0(odeparam.gamma,odeparam.B0).*TT(indT); - % rotate M into rotating frame of reference + % get M(T) in rotating frame of reference Mrot = getMrot(MM,theta,dphi); % get FFT of M in the laboratory frame of reference [Xm,fmx] = getFFT(TT,MM(:,1:2)); @@ -274,7 +274,7 @@ function onPushRun(src,~) set(gui.text_handles.Status,'String','Calculation of excitation pulse & relaxation ... finished.'); pause(0.01); else - % rotate M into rotating frame of reference + % get M(T) in rotating frame of reference Mrot = getMrot(MM,theta); % get FFT of M in the laboratory frame of reference [Xm,fmx] = getFFT(TT,MM(:,1:2)); @@ -518,9 +518,8 @@ function onPushRun(src,~) % set theta for all time steps after the pulse simply to % omega0*t theta(indT) = getOmega0(odeparam.gamma,odeparam.B0).*TT(indT); - % rotate M into rotating frame of reference - % and account for the phase from the wait time before the - % pulse + % get M(T) in rotating frame of reference and account for + % the phase from the wait time before the pulse MM3rot = getMrot(MM,theta,dphi+phiWait); % get FFT of the pulse [Xb,fbx] = getFFT(TT(TT<=Ttau),Bpulse(TT<=Ttau,1:2)); @@ -530,9 +529,8 @@ function onPushRun(src,~) ' & relaxation ... finished.']); pause(0.01); else - % rotate M into rotating frame of reference - % and account for the phase from the wait time before the - % pulse + % get M(T) in rotating frame of reference and account for + % the phase from the wait time before the pulse MM3rot = getMrot(MM,theta,phiWait); % get FFT of the pulse [Xb,fbx] = getFFT(TT,Bpulse(:,1:2)); @@ -555,13 +553,16 @@ function onPushRun(src,~) % combine data from all stages TT = [TT1;TT2;TT3]; MM = [MM1;MM2;MM3]; + % because there is no M in the rotating frame of reference % during the switch-off ramp, use the lab-frame data instead % --- IMPORTANT NOTE: ---------------------------------------- % The pre-polarization switch-off only "lives" in the laboratory % frame of reference. However, for convenience reasons I plot % the lab-frame pre-polarization data also in the rotating - % frame of reference! This is u-n-p-h-y-s-i-c-a-l and pure "eye candy" + % frame of reference! This is u-n-p-h-y-s-i-c-a-l and pure + % "eye candy" + % % MM1 is lab-frame data! % ------------------------------------------------------------- MMrot = [MM1;MM2rot;MM3rot]; diff --git a/doc/blochus/BLOCHUS/BLOCHUS.html b/doc/blochus/BLOCHUS/BLOCHUS.html index f677553..8e28ea9 100644 --- a/doc/blochus/BLOCHUS/BLOCHUS.html +++ b/doc/blochus/BLOCHUS/BLOCHUS.html @@ -105,8 +105,8 @@