Skip to content

Commit

Permalink
Merge pull request #385 from schorschinho/develop
Browse files Browse the repository at this point in the history
v.2.0.0
  • Loading branch information
HJZollner authored Mar 25, 2022
2 parents 95822b9 + b1a9a57 commit 39a7c51
Show file tree
Hide file tree
Showing 151 changed files with 11,511 additions and 6,997 deletions.
114 changes: 53 additions & 61 deletions GUI/OspreyGUI.m

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion GUI/osp_FitTabChangeFcn.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,27 @@ function osp_FitTabChangeFcn(src,~,gui)
% 2020-01-16: First version of the code.
%%% 1. GET HANDLES %%%
% User selected tab refreshs plot
MRSCont = getappdata(gui.figure,'MRSCont');

gui.fit.Selected = src.Selection;

gui.info.nXvoxels = 1;
gui.controls.act_x = 1;
gui.controls.b_left_y.Enable = 'off';
gui.controls.b_left_z.Enable = 'off';
gui.controls.b_right_y.Enable = 'off';
gui.controls.b_right_z.Enable = 'off';
gui.info.nYvoxels = size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,3);
gui.controls.act_y = 1;
gui.info.nZvoxels = size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,1);
gui.controls.act_z = 1;
if size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,3) > 1
gui.controls.b_left_y.Enable = 'on';
gui.controls.b_right_y.Enable = 'on';
end
if size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,1) > 1
gui.controls.b_left_z.Enable = 'on';
gui.controls.b_right_z.Enable = 'on';
end
%%% 2. UPDATE GUI %%%
osp_updateFitWindow(gui);
end
8 changes: 8 additions & 0 deletions GUI/osp_OverviewTabChangedFcn.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ function osp_OverviewTabChangedFcn(src,~,gui)
osp_updateSpecsOvWindow(gui);
set(gui.controls.pop_specsOvPlot, 'value',gui.process.Selected)
case 2
splt_string = strsplit(gui.controls.pop_specsOvPlot.String{gui.process.Selected});
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}));
else
gui.process.Selected = find(contains(gui.controls.pop_meanOvPlot.String,splt_string{3}));
end
end
osp_updatemeanOvWindow(gui);
set(gui.controls.pop_meanOvPlot, 'value',gui.process.Selected)
case 3
Expand Down
15 changes: 15 additions & 0 deletions GUI/osp_ProTabChangeFcn.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,23 @@ function osp_ProTabChangeFcn(src,~,gui)
% HISTORY:
% 2020-01-16: First version of the code.
%%% 1. GET HANDLES %%%
MRSCont = getappdata(gui.figure,'MRSCont');
% User selected tab refreshs plot
gui.process.Selected = src.Selection;

if MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.extras > 0
gui.info.nXvoxels = MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.sz(MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.extras);
else
gui.info.nXvoxels = 1;
end
gui.controls.act_x = 1;
if MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.subSpecs > 0
gui.info.nYvoxels = MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.sz(MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.subSpecs);
else
gui.info.nYvoxels = MRSCont.nDatasets(2);
end
gui.controls.act_y = 1;

% Grid for Plot
gui.layout.proPlot = gui.layout.(gui.layout.proTabhandles{gui.process.Selected});
gui.layout.proPre = gui.layout.proPlot.Children(1).Children(2).Children(2);
Expand Down
222 changes: 124 additions & 98 deletions GUI/osp_SelectionChangedFcn.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,123 +27,149 @@ function osp_SelectionChangedFcn(src,~,gui)
% Get MRSCont from hidden container in gui class
MRSCont = getappdata(gui.figure,'MRSCont');
% User selected tab refreshs plot
OldValue = src.Selection;
OldValue = gui.controls.Tab;
switch OldValue
case 1 %Load tab
spec = gui.load.Selected;
if ~(spec == 2 || spec ==3)
gui.fit.Selected = 1;
else
if spec == 2
gui.fit.Selected = 2;
else
gui.fit.Selected = 3;
end
tab = gui.layout.rawTab.TabTitles{gui.load.Selected};
switch tab
case {'metabolites','MM'}
gui.process.Selected = gui.load.Selected;
gui.fit.Selected = gui.load.Selected;
case {'reference'}
gui.process.Selected = find(strcmp(gui.layout.proTab.TabTitles,'ref'));
gui.process.Selected = find(strcmp(gui.layout.fitTab.TabTitles,'ref'));
case {'water'}
gui.process.Selected = find(strcmp(gui.layout.proTab.TabTitles,'w'));
gui.process.Selected = find(strcmp(gui.layout.fitTab.TabTitles,'w'));
case {'MM reference'}
gui.process.Selected = find(strcmp(gui.layout.proTab.TabTitles,'mm_ref'));
end
case 2 %Process tab
spec = gui.process.Selected;

if MRSCont.flags.isHERMES || MRSCont.flags.isHERCULES
if ~(spec == 5 || spec == 6)
gui.load.Selected = 1;
gui.fit.Selected = 1;
else
if spec == 5
gui.load.Selected = 2;
gui.fit.Selected = 4;
else
gui.load.Selected = 3;
gui.fit.Selected = 5;
end
end
elseif MRSCont.flags.isMEGA
if ~(spec == 3 || spec == 4)
gui.load.Selected = 1;
gui.fit.Selected = 1;
else
if spec == 3
gui.load.Selected = 2;
gui.fit.Selected = 3;
else
gui.load.Selected = 3;
gui.fit.Selected = 4;
end
end
elseif MRSCont.flags.isUnEdited
gui.load.Selected = spec;
gui.fit.Selected = spec;
tab = gui.layout.proTab.TabTitles{gui.process.Selected};
switch tab
case {'metab','mm'}
gui.load.Selected = gui.load.Selected;
gui.fit.Selected = gui.load.Selected;
case {'ref'}
gui.load.Selected = find(strcmp(gui.layout.rawTab.TabTitles,'reference'));
gui.process.Selected = find(strcmp(gui.layout.fitTab.TabTitles,'ref'));
case {'w'}
gui.load.Selected = find(strcmp(gui.layout.rawTab.TabTitles,'water'));
gui.process.Selected = find(strcmp(gui.layout.fitTab.TabTitles,'w'));
case {'mm_ref'}
gui.load.Selected = find(strcmp(gui.layout.rawTab.TabTitles,'MM reference'));
end


case 4 %Fit Tab
if (strcmp(gui.fit.Names{gui.fit.Selected},'off') || strcmp(gui.fit.Names{gui.fit.Selected},'diff1')||...
strcmp(gui.fit.Names{gui.fit.Selected},'diff2') || strcmp(gui.fit.Names{gui.fit.Selected},'sum'))
spec = 1;
else
if strcmp(gui.fit.Names{gui.fit.Selected},'w')
spec = 3;
else
spec = 2;
end
end
if MRSCont.flags.isHERMES || MRSCont.flags.isHERCULES
if ~(spec == 2 || spec == 3)
gui.load.Selected = 1;
gui.process.Selected = 1;
else
if spec == 2
gui.load.Selected = 2;
gui.process.Selected = 5;
else
gui.load.Selected = 3;
gui.process.Selected = 6;
end
end
elseif MRSCont.flags.isMEGA
if ~(spec == 2 || spec == 3)
gui.load.Selected = 1;
gui.process.Selected = 1;
else
if spec == 2
gui.load.Selected = 2;
gui.process.Selected = 3;
else
gui.load.Selected = 3;
gui.process.Selected = 4;
end
end
elseif MRSCont.flags.isUnEdited
gui.load.Selected = spec;
gui.process.Selected = spec;
case 3 %Fit Tab
tab = gui.layout.fitTab.TabTitles{gui.fit.Selected};
switch tab
case {'metab','mm'}
gui.load.Selected = gui.load.Selected;
gui.fit.Selected = gui.load.Selected;
case {'ref'}
gui.load.Selected = find(strcmp(gui.layout.rawTab.TabTitles,'reference'));
gui.process.Selected = find(strcmp(gui.layout.fitTab.TabTitles,'ref'));
case {'w'}
gui.load.Selected = find(strcmp(gui.layout.rawTab.TabTitles,'water'));
gui.process.Selected = find(strcmp(gui.layout.fitTab.TabTitles,'w'));
end
case 5 %Quantify tab?

otherwise
idx = 1;
spec = 1;
end

Exp = 1;
SubSpec = 1;
Basis = 1;
gui.controls.Tab = gui.layout.tabs.Selection;
%%% 2. UPDATE GUI %%%
switch gui.layout.tabs.Selection
case 1 %Load tab
gui.layout.ListBox.Enable = 'on';
set(gui.layout.rawTab, 'selection', gui.load.Selected);
osp_updateLoadWindow(gui);
gui.layout.ListBox.Enable = 'on';
set(gui.layout.rawTab, 'Selection', gui.load.Selected);
gui.info.nXvoxels = MRSCont.nDatasets(2);
gui.controls.act_x = Exp;
osp_updateLoadWindow(gui);
case 2 %Process tab
gui.layout.ListBox.Enable = 'on';
gui.Plot.pro = gui.layout.(gui.layout.proTabhandles{gui.process.Selected});
set(gui.layout.proTab, 'selection', gui.process.Selected);
osp_updateProWindow(gui);
gui.layout.ListBox.Enable = 'on';
gui.InfoText.pro = gui.upperBox.pro.Info{gui.process.Selected}.Children;
gui.Plot.pro = gui.layout.(gui.layout.proTabhandles{gui.process.Selected});
set(gui.layout.proTab, 'Selection', gui.process.Selected);
if MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.extras > 0
gui.info.nXvoxels = MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.sz(MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.extras);
else
gui.info.nXvoxels = 1;
end
gui.controls.act_x = Exp;
if MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.subSpecs > 0
gui.info.nYvoxels = MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.sz(MRSCont.processed.(gui.process.Names{gui.process.Selected}){gui.controls.Selected}.dims.subSpecs);
else
gui.info.nYvoxels = MRSCont.nDatasets(2);
end
gui.controls.act_y = SubSpec;
osp_updateProWindow(gui);
case 3 %Fit tab
gui.layout.ListBox.Enable = 'on';
set(gui.layout.fitTab, 'selection', gui.fit.Selected);
osp_updateFitWindow(gui);
gui.layout.ListBox.Enable = 'on';
set(gui.layout.fitTab, 'Selection', gui.fit.Selected);
gui.info.nXvoxels = 1;
gui.controls.act_x = Exp;
gui.controls.b_left_y.Enable = 'off';
gui.controls.b_left_z.Enable = 'off';
gui.controls.b_right_y.Enable = 'off';
gui.controls.b_right_z.Enable = 'off';
gui.info.nYvoxels = size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,3);
gui.controls.act_y = 1;
gui.info.nZvoxels = size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,1);
gui.controls.act_z = 1;
if size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,3) > 1
gui.controls.b_left_y.Enable = 'on';
gui.controls.b_right_y.Enable = 'on';
end
if size(MRSCont.fit.results.(gui.fit.Names{gui.fit.Selected}).fitParams,1) > 1
gui.controls.b_left_z.Enable = 'on';
gui.controls.b_right_z.Enable = 'on';
end
osp_updateFitWindow(gui);
case 4 %Coreg Tab
gui.layout.ListBox.Enable = 'on';
gui.InfoText.coreg = gui.layout.(gui.layout.proTabhandles{gui.load.Selected}).Children(2).Children;
osp_updateCoregWindow(gui);
gui.layout.ListBox.Enable = 'on';
gui.InfoText.coreg = gui.layout.(gui.layout.proTabhandles{gui.load.Selected}).Children(2).Children;
osp_updateCoregWindow(gui);
case 5 % Quantify tab
gui.layout.ListBox.Enable = 'on';
osp_updateQuantifyWindow(gui);
gui.layout.ListBox.Enable = 'on';
gui.controls.act_x = Exp;
gui.controls.b_left_y.Enable = 'off';
gui.controls.b_left_z.Enable = 'off';
gui.controls.b_right_y.Enable = 'off';
gui.controls.b_right_z.Enable = 'off';
gui.info.nYvoxels = size(MRSCont.fit.results.metab.fitParams,3);
gui.controls.act_y = 1;
gui.info.nZvoxels = size(MRSCont.fit.results.metab.fitParams,1);
gui.controls.act_z = 1;
if size(MRSCont.fit.results.metab.fitParams,3) > 1
gui.controls.b_left_y.Enable = 'on';
gui.controls.b_right_y.Enable = 'on';
end
if size(MRSCont.fit.results.metab.fitParams,1) > 1
gui.controls.b_left_z.Enable = 'on';
gui.controls.b_right_z.Enable = 'on';
end
osp_updateQuantifyWindow(gui);
case 6 %Overview tab
gui.layout.ListBox.Enable = 'off';
gui.layout.ListBox.Enable = 'off';
gui.controls.act_x = Exp;
gui.controls.b_left_x.Enable = 'off';
gui.controls.b_left_z.Enable = 'off';
gui.controls.b_right_x.Enable = 'off';
gui.controls.b_right_z.Enable = 'off';
gui.info.nXvoxels = 1;
gui.controls.act_x = 1;
gui.info.nZvoxels = size(MRSCont.fit.results.metab.fitParams,1);
gui.controls.act_z = 1;
if size(MRSCont.fit.results.metab.fitParams,1) > 1
gui.controls.b_left_z.Enable = 'on';
gui.controls.b_right_z.Enable = 'on';
end
end
end
2 changes: 1 addition & 1 deletion GUI/osp_Toolbox_Check.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
% 2020-05-15: First version of the code.
%%
%%% 1. GET SPMPATH AND TOOLBOXES%%%
OspreyVersion = 'Osprey 1.2.0';
OspreyVersion = 'Osprey 2.0.0';
fprintf(['Timestamp %s ' OspreyVersion ' ' Module '\n'], datestr(now,'mmmm dd, yyyy HH:MM:SS'));
addons = matlab.addons.installedAddons;
available = cellstr(table2cell(addons(:,1)));
Expand Down
7 changes: 4 additions & 3 deletions GUI/osp_check_distrOv_Call.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ function osp_check_distrOv_Call(src,~,gui)
metab = get(gui.controls.pop_distrOvMetab, 'Value');
Selection = gui.quant.popMenuNames{gui.quant.Selected.Quant};
if ~strcmp(Selection,'Quality')
split_Selection = strsplit(Selection,'-');
if strcmp(split_Selection{2},'AlphaCorrWaterScaled') || strcmp(split_Selection{2},'AlphaCorrWaterScaledGroupNormed')
split_Selection = strsplit(Selection,'-');
ind = find(strcmp(MRSCont.overview.FitSpecNamesStruct.(split_Selection{1}),split_Selection{2}));
if strcmp(split_Selection{3},'AlphaCorrWaterScaled') || strcmp(split_Selection{3},'AlphaCorrWaterScaledGroupNormed')
set(gui.controls.pop_distrOvMetab, 'String', {'GABA'});
set(gui.controls.pop_distrOvMetab, 'Value', gui.quant.idx.GABA);
set(gui.controls.pop_distrOvMetab, 'Enable', 'off');
else
set(gui.controls.pop_distrOvMetab, 'String', MRSCont.quantify.metabs.(split_Selection{1}));
set(gui.controls.pop_distrOvMetab, 'String', MRSCont.quantify.names.(split_Selection{1}){1,ind});
set(gui.controls.pop_distrOvMetab, 'Value', metab);
set(gui.controls.pop_distrOvMetab, 'Enable', 'on');
end
Expand Down
Loading

0 comments on commit 39a7c51

Please sign in to comment.