Skip to content

Commit

Permalink
Merge pull request #427 from schorschinho/develop
Browse files Browse the repository at this point in the history
Prepare v.2.2.0 release
  • Loading branch information
HJZollner authored Jun 8, 2022
2 parents 998aeda + f3fed1d commit fcbbb92
Show file tree
Hide file tree
Showing 88 changed files with 3,537 additions and 920 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve Osprey
title: "[BUG]"
title: "[BUG] - Description of Issue - function with main changes - Submitter"
labels: bug
assignees: ''

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Feature request
about: Suggest a function that Osprey should have
title: "[FEATURE REQUEST]"
title: "[FEATURE REQUEST] - Description of feature - function with main changes - Submitter"
labels: enhancement, help wanted
assignees: ''

Expand Down
8 changes: 4 additions & 4 deletions GUI/Osprey.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
% HISTORY:
% 2019-07-11: First version of the code.
%% Check for available add-ons
[~] = osp_Toolbox_Check ('OspreyGUI',0);
[~,~] = osp_Toolbox_Check ('OspreyGUI',0);
%% Set up Layout
%Here we set up the color layout
%default colormap and fonts
Expand All @@ -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.0.0','Date', 'April 12, 2022',...
gui.d = uiw.dialog.About('Name', 'Osprey','Version','2.2.0','Date', 'April 12, 2022',...
'Timeout', 3,'CustomText', 'Osprey is provided by Johns Hopkins University.',...
'ContactInfo', '[email protected]','LogoCData', logoBanner);

Expand Down Expand Up @@ -79,7 +79,7 @@
set(gui.CreateJob,'Callback',{@onCreateJob});
% JobFile input button
gui.LoadJob = uicontrol('Parent', gui.Buttons,'Style','PushButton','String','Load Job file','ForegroundColor', gui.colormap.Foreground,...
'TooltipString', 'Load a Job (.m or .csv-file)');
'TooltipString', 'Load a Job (.m, .json or .csv-file) Osprey Standalone Supports .json and .csv files only');
set(gui.LoadJob,'Units','Normalized','Position',[0.1 0.75 0.8 0.08], 'FontSize', 16, 'FontName', gui.font, 'FontWeight', 'Bold');
set(gui.LoadJob,'Callback',{@onLoadJob});
% MRSCont input button
Expand Down Expand Up @@ -161,7 +161,7 @@ function onCreateJob( ~, ~) %Callback Create Job button

function onLoadJob( ~, ~) %Callback Load Job button
% User wants to quit out of the application
gui.out = uipickfiles('FilterSpec',[ospFolder], 'REFilter', '\.m$|\.csv$','NumFiles',1,'Prompt','Select Osprey job file (.m or .csv-file)');
gui.out = uipickfiles('FilterSpec',[ospFolder], 'REFilter', '\.m$|\.csv$|\.json$','NumFiles',1,'Prompt','Select Osprey job file (.m, .json or .csv-file)');
if iscell(gui.out)
loadJob(gui);
end
Expand Down
32 changes: 16 additions & 16 deletions GUI/OspreyGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@
end
end
diary off

% This is for the compiled GUI
MRSCont.flags.hasSPM = 1;

% Toolbox check
if isfield(MRSCont.flags,'isToolChecked')
[MRSCont.flags.hasSPM,MRSCont.ver.CheckOsp] = osp_Toolbox_Check ('OspreyGUI',MRSCont.flags.isToolChecked);
else
[MRSCont.flags.hasSPM,MRSCont.ver.CheckOsp] = osp_Toolbox_Check ('OspreyGUI',0);
MRSCont.flags.isToolChecked = 1;
end
if MRSCont.flags.hasSPM
load(fullfile(gui.folder.ospFolder,'GUI','SPMpath.mat'),'SPMpath')
gui.folder.spmversion = SPMpath;
end

% Show warning if the version is different
if ~strcmp(MRSCont.ver.Osp,MRSCont.ver.CheckOsp)
Expand Down Expand Up @@ -150,7 +150,7 @@
end

%Setting up remaining values in dependence of the conducted processing steps
if MRSCont.flags.didLoadData %Get variables regarding the loading
if MRSCont.flags.didLoad %Get variables regarding the loading
if ~isempty(MRSCont.raw{1,gui.controls.Selected}.seq)
if strcmp(sprintf('\n'),MRSCont.raw{1,gui.controls.Selected}.seq(end)) %Clean up Sequence Name if needed
gui.load.Names.Seq = MRSCont.raw{1,gui.controls.Selected}.seq(1:end-1);
Expand Down Expand Up @@ -266,7 +266,7 @@
end

end
gui.waitbar.overall = MRSCont.flags.didLoadData+MRSCont.flags.didProcess+MRSCont.flags.didFit+MRSCont.flags.didCoreg+MRSCont.flags.didSeg+MRSCont.flags.didQuantify+MRSCont.flags.didOverview;
gui.waitbar.overall = MRSCont.flags.didLoad+MRSCont.flags.didProcess+MRSCont.flags.didFit+MRSCont.flags.didCoreg+MRSCont.flags.didSeg+MRSCont.flags.didQuantify+MRSCont.flags.didOverview;
gui.waitbar.step = 1/ gui.waitbar.overall;

%Version check and updating log file
Expand Down Expand Up @@ -333,7 +333,7 @@
gui.layout.b_load = uicontrol('Parent', gui.layout.p2,'Style','PushButton','String','Load data','Enable','on','ForegroundColor', gui.colormap.Foreground);
set(gui.layout.b_load,'Units','Normalized','Position',[0.1 0.75 0.8 0.08], 'FontSize', 16, 'FontName', gui.font, 'FontWeight', 'Bold','Tag','LoadButton');

if (MRSCont.flags.didLoadData == 1 && isfield(MRSCont, 'raw'))
if (MRSCont.flags.didLoad == 1 && isfield(MRSCont, 'raw'))
sz_raw = size(MRSCont.raw);
if (gui.controls.nDatasets(1) >= sz_raw(end))
gui.layout.b_load.Enable = 'off';
Expand All @@ -346,7 +346,7 @@
set(gui.layout.b_proc,'Units','Normalized','Position',[0.1 0.75 0.8 0.08], 'FontSize', 16, 'FontName', gui.font, 'FontWeight', 'Bold','Tag','ProcButton');
if (MRSCont.flags.didProcess == 1 && isfield(MRSCont, 'raw') && (gui.controls.nDatasets(1) >= length(MRSCont.processed.metab)))
gui.layout.b_proc.Enable = 'off';
else if ~(MRSCont.flags.didLoadData == 1 && isfield(MRSCont, 'raw') && (gui.controls.nDatasets(1) >= sz_raw(end)))
else if ~(MRSCont.flags.didLoad == 1 && isfield(MRSCont, 'raw') && (gui.controls.nDatasets(1) >= sz_raw(end)))
gui.layout.b_proc.Enable = 'off';
end
end
Expand All @@ -364,7 +364,7 @@
% Coregister button
gui.layout.b_coreg = uicontrol('Parent', gui.layout.p2,'Style','PushButton','String','CoRegister','Enable','off','ForegroundColor', gui.colormap.Foreground);
set(gui.layout.b_coreg,'Units','Normalized','Position',[0.1 0.59 0.8 0.08], 'FontSize', 16, 'FontName', gui.font, 'FontWeight', 'Bold','Tag','CoregButton');
if MRSCont.flags.hasSPM == 1 && ~isempty(MRSCont.files_nii) && ~(MRSCont.flags.didCoreg == 1 && isfield(MRSCont, 'coreg') && (gui.controls.nDatasets(1) >= length(MRSCont.coreg.vol_image))) && (MRSCont.flags.didLoadData == 1 && isfield(MRSCont, 'raw') && (gui.controls.nDatasets(1) >= length(MRSCont.raw)))
if MRSCont.flags.hasSPM == 1 && ~isempty(MRSCont.files_nii) && ~(MRSCont.flags.didCoreg == 1 && isfield(MRSCont, 'coreg') && (gui.controls.nDatasets(1) >= length(MRSCont.coreg.vol_image))) && (MRSCont.flags.didLoad == 1 && isfield(MRSCont, 'raw') && (gui.controls.nDatasets(1) >= length(MRSCont.raw)))
if ~(isfield(MRSCont.flags,'addImages') && (MRSCont.flags.addImages == 0) && MRSCont.flags.moved)
gui.layout.b_coreg.Enable = 'on';
end
Expand Down Expand Up @@ -411,14 +411,14 @@
gui.layout.controlPanel = uix.Panel('Parent', gui.layout.leftMenu, 'Title', 'MRS Container','BackgroundColor',gui.colormap.Background);
set(gui.layout.controlPanel,'Units','Normalized','Position',[0.5 0 0.66 0.1], 'FontSize', 16, 'FontName', gui.font, 'FontWeight', 'Bold',...
'ForegroundColor',gui.colormap.Foreground, 'HighlightColor',gui.colormap.Foreground, 'ShadowColor',gui.colormap.Foreground,'Tag','SubjectListPanel');
gui.layout.fileList = MRSCont.files;
gui.layout.fileList = MRSCont.files(1,:);
if ~MRSCont.flags.moved
[~, ~] = osp_detDataType(MRSCont);
end
SepFileList = cell(1,length(MRSCont.files));
gui.layout.RedFileList = cell(1,length(MRSCont.files));
gui.layout.OnlyFileList = cell(1,length(MRSCont.files));
for i = 1 : length(MRSCont.files) %find last two subfolders and file names
SepFileList = cell(1,MRSCont.nDatasets(1));
gui.layout.RedFileList = cell(1,MRSCont.nDatasets(1));
gui.layout.OnlyFileList = cell(1,MRSCont.nDatasets(1));
for i = 1 : MRSCont.nDatasets(1) %find last two subfolders and file names
SepFileList{i} = split(gui.layout.fileList(i), filesep);
if length(SepFileList{i}) == 1
SepFileList{i} = split(gui.layout.fileList(i), '\');
Expand Down Expand Up @@ -470,7 +470,7 @@
% been completed:
gui.controls.waitbar = waitbar(0,'Start','Name','Loading your MRS Container');
waitbar(0,gui.controls.waitbar,'Loading your raw spectra')
if (MRSCont.flags.didLoadData == 1 && isfield(MRSCont, 'raw') && (gui.controls.nDatasets(1) >= sz_raw(end))) % Was data loaded at all that can be looked at?
if (MRSCont.flags.didLoad == 1 && isfield(MRSCont, 'raw') && (gui.controls.nDatasets(1) >= sz_raw(end))) % Was data loaded at all that can be looked at?
set(gui.layout.tabs, 'Visible','on');
osp_iniLoadWindow(gui);
if MRSCont.flags.isMRSI
Expand Down Expand Up @@ -528,7 +528,7 @@
set(gui.controls.b_save_meanOvTab,'Callback',{@osp_onPrint,gui});
end
gui.layout.tabs.Selection = 1;
if ~MRSCont.flags.didLoadData %Turn of Listbox if data has not been loaded
if ~MRSCont.flags.didLoad %Turn of Listbox if data has not been loaded
gui.layout.ListBox.Enable = 'off';
end
set(gui.layout.tabs, 'Visible','on');
Expand Down
2 changes: 1 addition & 1 deletion GUI/osp_OverviewTabChangedFcn.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function osp_OverviewTabChangedFcn(src,~,gui)
if strcmp(splt_string{2},'ref') || strcmp(splt_string{2},'w')
gui.process.Selected = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{2}));
else
gui.process.Selected = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{3}));
gui.process.Selected = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{1}));
end
end
osp_updatemeanOvWindow(gui);
Expand Down
61 changes: 24 additions & 37 deletions GUI/osp_Toolbox_Check.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
%
% HISTORY:
% 2020-05-15: First version of the code.
%%
%%% 1. GET SPMPATH AND TOOLBOXES%%%
OspreyVersion = 'Osprey 2.0.0';
%% % 1. SAVE OSPREY VERSION%%%
%%% 1. SAVE OSPREY VERSION%%%
OspreyVersion = 'Osprey 2.2.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%%%
warning('off','MATLAB:javaclasspath:jarAlreadySpecified');
addons = matlab.addons.installedAddons;
available = cellstr(table2cell(addons(:,1)));
for tl = 1 : size(addons,1)
Expand All @@ -42,6 +45,7 @@
catch
end
end
addons = matlab.addons.installedAddons;
lic = strcmp({'Enabled'}, addons.Properties.VariableNames);
if ~isempty(lic)
enabled = table2cell(addons(:,lic==1));
Expand All @@ -53,24 +57,8 @@
allFolders = strsplit(settingsFolder, filesep);
ospFolder = strjoin(allFolders(1:end-1), filesep); % parent folder (= Osprey folder)

% SPM
if isfile(fullfile(ospFolder,'GUI','SPMpath.mat')) % Load path to SPM
load(fullfile(ospFolder,'GUI','SPMpath.mat'),'SPMpath')
if exist(SPMpath, 'dir')
spmversion = SPMpath;
else %This isn't the right SPM path (maybe it was copied from another machine)
spmversion = uipickfiles('FilterSpec',ospFolder,'REFilter', '\','NumFiles',1,'Prompt','Select your SPM-folder (Will be saved in SPMpath.mat file in the GUI folder)');
spmversion = spmversion{1};
SPMpath = spmversion;
save(fullfile(ospFolder,'GUI','SPMpath.mat'),'SPMpath');
end
else %Set path to SPM
spmversion = uipickfiles('FilterSpec',ospFolder,'REFilter', '\','NumFiles',1,'Prompt','Select your SPM-folder (Will be saved in SPMpath.mat file in the GUI folder)');
spmversion = spmversion{1};
SPMpath = spmversion;
save(fullfile(ospFolder,'GUI','SPMpath.mat'),'SPMpath');
end
% Check if SPM12 is installed
% 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')
Expand All @@ -81,15 +69,14 @@
available{end+1} = 'SPM12';
enabled{end+1} = true;
hasSPM = 1;
rmpath(genpath([spmversion filesep 'external' filesep 'fieldtrip' filesep 'external' filesep 'stats' filesep 'finv.m']));
end

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

%%% 2. CHECK AVAILABILTY %%%
%%% 3. CHECK AVAILABILTY %%%
switch Module
case 'OspreyGUI'
ModuleString = 'fully run \bfOsprey';
Expand Down Expand Up @@ -129,39 +116,39 @@
missingSpecific = setdiff(neededSpecific,available);
missing = setdiff(neededGlobal,available);

%%% 3. CREATE WARNING MESSAGES %%%
%%% 4. CREATE WARNING MESSAGES %%%
if ~ToolChecked
warning = cellstr({});
warningMsg = cellstr({});
warning_count = 1;
if ~isempty(missing) || ~isempty(missingSpecific)
opts.Interpreter = 'tex';
opts.WindowStyle = 'modal';
warning{1} = ['The following toolboxes are missing to ' ModuleString '\rm:'];
warningMsg{1} = ['The following toolboxes are missing to ' ModuleString '\rm:'];
for i = 1 : length(missing)
warning{i+1} = ['\bf' missing{i} '\rm'];
warningMsg{i+1} = ['\bf' missing{i} '\rm'];
end
warning_count = warning_count +length(missing) + 1;
warning{warning_count} = ['Please install them to ' ModuleString '\rm'];
warningMsg{warning_count} = ['Please install them to ' ModuleString '\rm'];
warning_count = warning_count + 1;
if ~isempty(missingSpecific)
warning{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)
warning{warning_count + i} = ['\bf' missingSpecific{i} '\rm'];
warningMsg{warning_count + i} = ['\bf' missingSpecific{i} '\rm'];
warningc = [warningc ' ' missingSpecific{i}];
end
warning{warning_count + length(missingSpecific) + 1} = ['Please install them to use \bf' Module '\rm'];
warndlg(warning,'Missing Toolboxes',opts);
warningMsg{warning_count + length(missingSpecific) + 1} = ['Please install them to use \bf' Module '\rm'];
warndlg(warningMsg,'Missing Toolboxes',opts);
error(warningc);
end
warndlg(warning,'Missing Toolboxes',opts);
warndlg(warningMsg,'Missing Toolboxes',opts);
end
end

catch %If the MATLAB version pre-dates the inmplementation of matlab.addons.installedAddons
warning = cellstr({});
warning{1} = 'Your current MATLAB version does not allow the automated toolbox check. We assume that all required toolboxes are available.';
warndlg(warning,'Automated toolbox check not working.',opts);
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

warning('on','MATLAB:javaclasspath:jarAlreadySpecified');
end
4 changes: 2 additions & 2 deletions GUI/osp_WindowKeyDown.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ function osp_WindowKeyDown(~,EventData,gui)
OldValue = get( gui.layout.ListBox,'value');
gui.controls.KeyPress = 1;
if OldValue == 1
set(gui.layout.ListBox, 'value', MRSCont.nDatasets );
set(gui.layout.ListBox, 'value', MRSCont.nDatasets(1));
else
set(gui.layout.ListBox, 'value', OldValue-1 );
end
end
if strcmp(EventData.Key, 'downarrow') % scrolling down
OldValue = get( gui.layout.ListBox,'value');
gui.controls.KeyPress = 1;
if OldValue == MRSCont.nDatasets
if OldValue == MRSCont.nDatasets(1)
set(gui.layout.ListBox, 'value', 1 );
else
set(gui.layout.ListBox, 'value', OldValue+1 );
Expand Down
2 changes: 2 additions & 0 deletions GUI/osp_iniCoregWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function osp_iniCoregWindow(gui)
% 2020-01-16: First version of the code.
%%% 1. GET HANDLES %%%
% This function creates the initial coreg/seg window
warning('off','MATLAB:handle_graphics:exceptions:SceneNode');
MRSCont = getappdata(gui.figure,'MRSCont'); % Get MRSCont from hidden container in gui class
gui.layout.tabs.TabEnables{4} = 'on';
gui.layout.tabs.Selection = 4;
Expand Down Expand Up @@ -179,5 +180,6 @@ function osp_iniCoregWindow(gui)
close(h(ff))
end
end
warning('on','MATLAB:handle_graphics:exceptions:SceneNode');
setappdata(gui.figure,'MRSCont',MRSCont); % Write MRSCont into hidden container in gui class
end
7 changes: 0 additions & 7 deletions GUI/osp_iniLoadWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ function osp_iniLoadWindow(gui)
gui.load.Names.Spec{3} = 'reference';
gui.load.Names.Spec{4} = 'MM reference';
gui.load.Names.Spec{5} = 'water';
otherwise
gui.controls.Number = gui.controls.Number + 4;
gui.load.Names.Spec{2} = 'spectra 1';
gui.load.Names.Spec{3} = 'spectra 2';
gui.load.Names.Spec{4} = 'spectra 3';
gui.load.Names.Spec{5} = 'spectra 4';
end

gui.layout.tabs.TabEnables{1} = 'on';
Expand Down Expand Up @@ -345,7 +339,6 @@ function osp_iniLoadWindow(gui)
%%% 4. VISUALIZATION PART OF THIS TAB %%%
%osp_plotLoad is used to visualize the raw data. Number of subplots
%depends on the number of subspectra of the seuqence
temp = figure( 'Visible', 'off' );
switch gui.load.Names.Spec{t}
case 'metabolites'
temp = osp_plotLoad(MRSCont, gui.controls.Selected,'mets');
Expand Down
6 changes: 5 additions & 1 deletion GUI/osp_onGit.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ function osp_onGit( ~, ~)
% 2020-01-16: First version of the code.
%%% 1. Visit websites %%%

web('https://github.com/schorschinho/osprey', '-browser'); %Github Link
try
web('https://github.com/schorschinho/osprey', '-browser'); %Github Link
catch
system('open "https://github.com/schorschinho/osprey"'); %for compiled Osprey
end
end
Loading

0 comments on commit fcbbb92

Please sign in to comment.