Skip to content

Define global popups flag (as user input in GUI) to pass to all functions down the processing #116

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 8 additions & 4 deletions hmri_calc_R2s.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
% group level sensitivity."
% https://doi.org/10.1016/j.neuroimage.2022.119529


% init global popup flag to get access to it
global hmri_popupFlag;

assert(isstruct(weighted_data),'hmri:structError',['inputs must be structs; see help ' mfilename])

Expand Down Expand Up @@ -164,8 +165,10 @@
ver_status = any(ismember(versionCell, 'Optimization Toolbox'));
[license_status,~] = license('checkout', 'Optimization_toolbox');
if ver_status==0 || license_status==0
error('hmri:NoOptimToolbox', "The methods 'nlls_ols','nlls_wls1','nlls_wls2','nlls_wls3' require Optimization Toolbox: either this toolbox and/or its license is missing." + ...
" Please use another method which does not need the Optimization Toolbox such as 'ols','wls1','wls2','wls3'. ")
err_string= "The methods 'nlls_ols','nlls_wls1','nlls_wls2','nlls_wls3' require Optimization Toolbox: either this toolbox and/or its license is missing." + ...
" Please use another method which does not need the Optimization Toolbox such as 'ols','wls1','wls2','wls3'. ";
hmri_log(char(strcat("ERROR: ", err_string)),hmri_popupFlag);
error('hmri:NoOptimToolbox', err_string)
end

% Check for NLLS case, where specification of the log-linear
Expand Down Expand Up @@ -195,7 +198,8 @@
beta(:,n)=lsqcurvefit(@(x,D)expDecay(x,D),beta0(:,n),D,y(:,n),[],[],opt);
end
otherwise
error(['method ' method ' not recognised'])
hmri_log([' ERROR: ' 'method ' method ' not recognised'],hmri_popupFlag);
error('hmri:MissingR2Method', ['method ' method ' not recognised'])
end

%% Output
Expand Down
6 changes: 6 additions & 0 deletions hmri_run_create.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
'PopUp',job.subj.popup,'ComWin',true);
flags = job.subj.log.flags;
flags.PopUp = false;

% introduce global popup flag for use of other functions further down
% the processing
global hmri_popupFlag;
hmri_popupFlag = job.subj.log.flags;

hmri_log(sprintf('\t============ CREATE hMRI MAPS MODULE - %s.m (%s) ============', mfilename, datetime('now')),flags);

if newrespath
Expand Down