Skip to content
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

Prepare Osprey compilation - Helge #410

Merged
merged 1 commit into from
May 23, 2022
Merged
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
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.1.0','Date', 'April 12, 2022',...
'Timeout', 3,'CustomText', 'Osprey is provided by Johns Hopkins University.',...
'ContactInfo', 'gabamrs@gmail.com','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
22 changes: 11 additions & 11 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 @@ -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
14 changes: 8 additions & 6 deletions GUI/osp_Toolbox_Check.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
%
% HISTORY:
% 2020-05-15: First version of the code.
%%
%%% 1. GET SPMPATH AND TOOLBOXES%%%
warning('off','MATLAB:javaclasspath:jarAlreadySpecified');
OspreyVersion = 'Osprey 2.0.0';
%% % 1. SAVE OSPREY VERSION%%%
%%% 1. SAVE OSPREY VERSION%%%
OspreyVersion = 'Osprey 2.1.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 Down Expand Up @@ -90,7 +92,7 @@
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 @@ -130,7 +132,7 @@
missingSpecific = setdiff(neededSpecific,available);
missing = setdiff(neededGlobal,available);

%%% 3. CREATE WARNING MESSAGES %%%
%%% 4. CREATE WARNING MESSAGES %%%
if ~ToolChecked
warningMsg = cellstr({});
warning_count = 1;
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
6 changes: 4 additions & 2 deletions GUI/osp_onPub.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ function osp_onPub( ~, ~)
% 2020-01-16: First version of the code.
%%% 1. Visit websites %%%

try

web('https://www.ncbi.nlm.nih.gov/sites/myncbi/1lo2w1io3qTgqH/collections/59221405/public/', '-browser'); %HERCULES paper will create a pubmed collection for referencing all papers

web('https://www.ncbi.nlm.nih.gov/sites/myncbi/1lo2w1io3qTgqH/collections/59221405/public/', '-browser'); %HERCULES paper will create a pubmed collection for referencing all papers
catch
system('open "https://www.ncbi.nlm.nih.gov/sites/myncbi/1lo2w1io3qTgqH/collections/59221405/public/"'); % for the compiled version of Osprey
end
3 changes: 1 addition & 2 deletions coreg/OspreyCoreg.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@

warning('off','all');
% Checking for version, toolbox, and previously run modules
osp_CheckRunPreviousModule(MRSCont, 'OspreyCoreg');
[~,MRSCont.ver.CheckOsp ] = osp_Toolbox_Check ('OspreyCoreg',MRSCont.flags.isGUI);
[~,MRSCont.ver.CheckOsp ] = osp_CheckRunPreviousModule(MRSCont, 'OspreyCoreg');


% Set up saving location
Expand Down
3 changes: 1 addition & 2 deletions fit/OspreyFit.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

% ----- Load fit settings and fit the metabolite data -----
% Checking for version, toolbox, and previously run modules
osp_CheckRunPreviousModule(MRSCont, 'OspreyFit');
[~,MRSCont.ver.CheckOsp ] = osp_Toolbox_Check('OspreyFit',MRSCont.flags.isGUI);
[~,MRSCont.ver.CheckOsp ] = osp_CheckRunPreviousModule(MRSCont, 'OspreyFit');
% Start timer
MRSCont.runtime.Fit = 0;

Expand Down
Binary file modified job/CreateOspreyJob.mlapp
Binary file not shown.
Loading