Skip to content

Commit

Permalink
Merge pull request #753 from schorschinho/develop
Browse files Browse the repository at this point in the history
Release Osprey v2.6.0
  • Loading branch information
HJZollner authored Jul 15, 2024
2 parents 5702d1d + 440f108 commit f8738e7
Show file tree
Hide file tree
Showing 97 changed files with 5,553 additions and 1,302 deletions.
2 changes: 1 addition & 1 deletion GUI/Osprey.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
logoFcn = @()imread('osprey.png', 'BackgroundColor', gui.colormap.Background);
logoBanner = uiw.utility.loadIcon(logoFcn);
% Here the intro banner is created
gui.d = uiw.dialog.About('Name', 'Osprey','Version','2.5.0','Date', 'April 7, 2023',...
gui.d = uiw.dialog.About('Name', 'Osprey','Version','2.6.0','Date', 'July 15, 2024',...
'Timeout', 3,'CustomText', 'Osprey is provided by Johns Hopkins University.',...
'ContactInfo', 'gabamrs@gmail.com','LogoCData', logoBanner);

Expand Down
22 changes: 21 additions & 1 deletion GUI/OspreyGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@
gui.controls.Tab = 1;
gui.controls.Number = 1;
gui.controls.KeyPress = 0;
%Manual manipulation like phasing performed
gui.process.ManualManipulation = 0;
%File selections for each sub function
gui.load.Selected = 1;
gui.process.Selected = 1;
Expand Down Expand Up @@ -440,7 +442,25 @@
gui.layout.ListBox = uicontrol('Style', 'list','BackgroundColor', 'w','FontName', gui.font,'BackgroundColor',gui.colormap.Background, ...
'Parent', gui.layout.controlPanel, 'String',gui.layout.RedFileList(:) , ...
'Value', gui.controls.Selected, 'Interruptible', 'on', 'BusyAction', 'cancel', ...
'ForegroundColor',gui.colormap.Foreground, 'TooltipString', 'Select a file you want to inspect.','Tag','SubjectListBox');
'ForegroundColor',gui.colormap.Foreground, 'TooltipString', sprintf(['Select a file you want to inspect.\n\r\n' ...
'Other intersting key presses after clicking are:\n' ...
'left arrow - remove data\n' ...
'right arrow - add data\n\r\n' ...
'In the Processed Tab you can manipulate the averaged spectrum as follows:\n' ...
'a - Subtract 5 degree from ph0\n' ...
'd - Add 5 degree to ph0\n' ...
'q - Subtract 0.00001 s from ph1\n' ...
'e - Add 0.00001 s to ph1\n' ...
's - Subtract 1 Hz from f\n' ...
'w - Add 1 Hz to f\n' ...
'f - Add 180 degree to ph0\n\r\n' ...
'You can change the axis of the processed plot as follows:\n' ...
'r - Reset y-axis limits\n' ...
'z - Zoom out y-axis\n' ...
'x - Zoom in y-axis\n' ...
'c - Move y-axis center down\n' ...
'v - Move y-axis center up' ...
]),'Tag','SubjectListBox');
if MRSCont.flags.isMRSI
gui.layout.MRSILocPanel = uix.Panel('Parent', gui.layout.leftMenu, 'Title', 'Voxel Location','BackgroundColor',gui.colormap.Background);
set(gui.layout.MRSILocPanel,'Units','Normalized','Position',[0.5 0 0.66 0.1], 'FontSize', 16, 'FontName', gui.font, 'FontWeight', 'Bold',...
Expand Down
14 changes: 11 additions & 3 deletions GUI/osp_OverviewTabChangedFcn.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,23 @@ function osp_OverviewTabChangedFcn(src,~,gui)
NewValue= src.Selection;
switch NewValue
case 1
splt_string = strsplit(gui.controls.pop_meanOvPlot.String{gui.overview.Selected.Spec});
if length(splt_string) > 1
if length(splt_string) == 2
gui.overview.Selected.Spec = find(contains(gui.controls.pop_specsOvPlot.String,splt_string{1}) & contains(gui.controls.pop_specsOvPlot.String,splt_string{2}));
else
gui.overview.Selected.Spec = find(contains(gui.controls.pop_specsOvPlot.String,splt_string{1}) & contains(gui.controls.pop_specsOvPlot.String,splt_string{2})& contains(gui.controls.pop_specsOvPlot.String,splt_string{3}));
end
end
osp_updateSpecsOvWindow(gui);
set(gui.controls.pop_specsOvPlot, 'value',gui.overview.Selected.Spec)
case 2
splt_string = strsplit(gui.controls.pop_specsOvPlot.String{gui.overview.Selected.Spec});
if length(splt_string) > 1
if strcmp(splt_string{2},'ref') || strcmp(splt_string{2},'w')
gui.process.Selected = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{2}));
if length(splt_string) == 2
gui.overview.Selected.Spec = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{1}) & contains(gui.controls.pop_meanOvPlot.String,splt_string{2}));
else
gui.process.Selected = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{1}));
gui.overview.Selected.Spec = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{1}) & contains(gui.controls.pop_meanOvPlot.String,splt_string{2})& contains(gui.controls.pop_meanOvPlot.String,splt_string{3}));
end
end
osp_updatemeanOvWindow(gui);
Expand Down
92 changes: 55 additions & 37 deletions GUI/osp_Toolbox_Check.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
% OspreyFit
% OspreyCoreg
% OspreySeg
% ToolChecked = Flag whether Toolboxes have been checked before.
% ToolChecked = Flag whether Toolboxes have been checked before.
%
% OUTPUTS:
% hasSPM = SPM flag.
Expand All @@ -32,51 +32,49 @@
% 2020-05-15: First version of the code.
%% % 1. SAVE OSPREY VERSION%%%
%%% 1. SAVE OSPREY VERSION%%%
OspreyVersion = 'Osprey 2.5.0';
OspreyVersion = 'Osprey 2.6.0';
fprintf(['Timestamp %s ' OspreyVersion ' ' Module '\n'], datestr(now,'mmmm dd, yyyy HH:MM:SS'));
hasSPM = 1; % For the compiled GUI
%% % 2. GET SPMPATH AND TOOLBOXES%%%
if ~(ismcc || isdeployed)
warning('off','MATLAB:javaclasspath:jarAlreadySpecified');
addons = matlab.addons.installedAddons;
available = cellstr(table2cell(addons(:,1)));
for tl = 1 : size(addons,1)
try
matlab.addons.enableAddon(addons.Name{tl});
catch
end
end
addons = matlab.addons.installedAddons;
lic = strcmp({'Enabled'}, addons.Properties.VariableNames);

% older Matlab versions require identifier rather than name; create a map for this:
identifiers = containers.Map( addons.Name, addons.Identifier );

if ~isempty(lic)
enabled = table2cell(addons(:,lic==1));
enabled=table2array(addons(:,lic));
else
enabled = table2cell(addons(:,1));
% If for some reason we can't determine the "Enabled" state, assume NOT
% enabled and later try to enable on demand
enabled = zeros(length(available),1);
end

[settingsFolder,~,~] = fileparts(which('OspreySettings.m'));
allFolders = strsplit(settingsFolder, filesep);
ospFolder = strjoin(allFolders(1:end-1), filesep); % parent folder (= Osprey folder)

% Get SPM folder and check if SPM12 is installed
spmversion = fileparts(which(fullfile('spm.m')));
if isempty(spmversion)
hasSPM = 0;
elseif strcmpi(spmversion(end-3:end),'spm8')
available{end+1} = 'SPM8';
enabled{end+1} = false;
enabled(end+1) = false;
hasSPM = 0;
else
available{end+1} = 'SPM12';
enabled{end+1} = true;
enabled(end+1) = true;
hasSPM = 1;
end

end

opts.Interpreter = 'tex';
opts.WindowStyle = 'modal';

try
if ~isempty(lic)
available(find(cellfun(@(a)~isempty(a)&&a<1,enabled)), :) = [];
end

%%% 3. CHECK AVAILABILTY %%%
switch Module
case 'OspreyGUI'
Expand All @@ -86,7 +84,7 @@
case 'OspreyProcess'
ModuleString = 'run \bfOspreyProcess';
neededGlobal = {'Optimization Toolbox', 'Statistics and Machine Learning Toolbox','SPM12'};
neededSpecific = {'Optimization Toolbox', 'Statistics and Machine Learning Toolbox'};
neededSpecific = {'Optimization Toolbox', 'Statistics and Machine Learning Toolbox'};
case 'OspreyFit'
ModuleString = 'run \bfOspreyFit';
neededGlobal = {'Optimization Toolbox', 'Statistics and Machine Learning Toolbox','SPM12'};
Expand All @@ -98,32 +96,52 @@
case 'OspreySeg'
ModuleString = 'run \bfOspreySeg';
neededGlobal = {'Optimization Toolbox', 'Statistics and Machine Learning Toolbox','SPM12'};
neededSpecific = {'SPM12'};
neededSpecific = {'SPM12'};
otherwise
ModuleString = ['run \bf' Module];
neededGlobal = {'Optimization Toolbox', 'Statistics and Machine Learning Toolbox','SPM12'};
neededSpecific = cellstr({});
end


neededAll=union(neededGlobal,neededSpecific);

%To account for the re-naming of new downloads of the Widget Toolbox
%for Matlab versions earlier than 2020b, while maintaining
%functionality for older downloads, we need to check for all naming
%conventions of the Widgets Toolbox HZ
for tb = 1 : length(available)
if contains(available{tb},'Widgets Toolbox')
available{tb} = 'Widgets Toolbox';
wtNeededIndex = find(strcmp(neededAll,'Widgets Toolbox'),1,'first');
if ~isempty(wtNeededIndex)
wtAvailableIndex = find(contains(available,'Widgets Toolbox'),1,'first');
if ~isempty(wtAvailableIndex)
widgetsName=available{wtAvailableIndex};
neededAll{wtNeededIndex} = widgetsName; % adopt name of the available variant
neededGlobal(strcmp(neededGlobal,'Widgets Toolbox')) = {widgetsName};
neededSpecific(strcmp(neededSpecific,'Widgets Toolbox')) = {widgetsName};
end
end
missingSpecific = setdiff(neededSpecific,available);
missing = setdiff(neededGlobal,available);


% First, check dependencies which may be available but not enabled:
tryEnable=intersect(available, setdiff(neededAll, available(enabled)));

for tl = 1: size(tryEnable,1)
try
name=tryEnable{tl};
identifier = identifiers(tryEnable{tl});
matlab.addons.enableAddon(identifier);
enabled(find(strcmp(available,name),1,'first')) = matlab.addons.isAddonEnabled(identifier);
catch
end
end

missingSpecific = setdiff(neededSpecific,available(enabled));
missing = setdiff(neededGlobal,available(enabled));


%%% 4. CREATE WARNING MESSAGES %%%
if ~ToolChecked
warningMsg = cellstr({});
warning_count = 1;
if ~isempty(missing) || ~isempty(missingSpecific)
opts.Interpreter = 'tex';
opts.WindowStyle = 'modal';
warningMsg{1} = ['The following toolboxes are missing to ' ModuleString '\rm:'];
for i = 1 : length(missing)
warningMsg{i+1} = ['\bf' missing{i} '\rm'];
Expand All @@ -132,7 +150,7 @@
warningMsg{warning_count} = ['Please install them to ' ModuleString '\rm'];
warning_count = warning_count + 1;
if ~isempty(missingSpecific)
warningMsg{warning_count} = ['The following toolboxes are missing to run ' Module ':'];
warningMsg{warning_count} = ['The following toolboxes are missing to run ' Module ':'];
warningc = ['Please install and include the following toolboxes to use ' Module ':'];
for i = 1 : length(missingSpecific)
warningMsg{warning_count + i} = ['\bf' missingSpecific{i} '\rm'];
Expand All @@ -141,16 +159,16 @@
warningMsg{warning_count + length(missingSpecific) + 1} = ['Please install them to use \bf' Module '\rm'];
warndlg(warningMsg,'Missing Toolboxes',opts);
error(warningc);
end
end
warndlg(warningMsg,'Missing Toolboxes',opts);
end
end

catch %If the MATLAB version pre-dates the inmplementation of matlab.addons.installedAddons
warningMsg = cellstr({});
warningMsg{1} = 'Your current MATLAB version does not allow the automated toolbox check. We assume that all required toolboxes are available.';
warndlg(warningMsg,'Automated toolbox check not working.',opts);
end
end
warning('on','MATLAB:javaclasspath:jarAlreadySpecified');
end
end
end
Loading

0 comments on commit f8738e7

Please sign in to comment.