Commit 54ad7ee8 authored by Jay Dubb's avatar Jay Dubb
Browse files

-- Fix duplicate figure Plot Probe bug

-- Don't disable Plot Probe GUI menu item in MainGUI when HRF checkbox is not checked. We want to keep PlotProbeGUI utility generic for any data not just HRF.
-- Removed some code from includes.m and PrintSystemInfo.m to try to improve Homer3 startup time. Identified in matlab profiler as slightly slowing things down during startup.
-- Get rid of matlab syntax warnings in PlotProbeGUI.m
parent 3af6bfea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ SNIRF
On

% Last Checked For Update
24-Aug-2020 19:29:36
02-Sep-2020 14:50:27

% Check For Updates
on
+0 −4
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ iCondGrp = get(handles.popupmenuConditions, 'value');
CondName = maingui.dataTree.groups(1).CondNames{iCondGrp};
if ~isempty(maingui.dataTree.currElem.GetDodAvg(CondName)) || ~isempty(maingui.dataTree.currElem.GetDcAvg(CondName))
    set(handles.checkboxPlotHRF, 'enable','on');
    set(handles.menuItemPlotProbeGUI, 'enable','on');
    if ~isa(maingui.dataTree.currElem, 'RunClass')
        set(handles.checkboxPlotHRF, 'value',1);
        if ~isempty(maingui.dataTree.currElem.GetDcAvg())
@@ -53,15 +52,12 @@ if ~isempty(maingui.dataTree.currElem.GetDodAvg(CondName)) || ~isempty(maingui.d
        end
    end
elseif raw_enable && raw_checked
    set(handles.menuItemPlotProbeGUI, 'enable','off');
    set(handles.checkboxPlotHRF, 'enable','off');
    set(handles.checkboxPlotHRF, 'value',0);
elseif ~OD_enable && ~Conc_enable
    set(handles.menuItemPlotProbeGUI, 'enable','off');
    set(handles.checkboxPlotHRF, 'enable','off');
    set(handles.checkboxPlotHRF, 'value',0);
else
    set(handles.menuItemPlotProbeGUI, 'enable','off');
    set(handles.checkboxPlotHRF, 'enable','off');
    set(handles.checkboxPlotHRF, 'value',0);    
end
+45 −28
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ end


% -------------------------------------------------------------
function varargout = PlotProbeGUI_OutputFcn(hObject, eventdata, handles)
function varargout = PlotProbeGUI_OutputFcn(~, ~, handles)
handles.updateptr = @PlotProbeGUI_Update;
handles.closeptr = @PlotProbeGUI_Close;
varargout{1} = handles;
@@ -50,7 +50,7 @@ plotprobe.datatypeVals = struct('RAW',1, 'RAW_HRF',2, 'OD',4, 'OD_HRF',8, 'CONC'
plotprobe.name = 'plotprobe';
plotprobe.y = {};
plotprobe.t = {};
plotprobe.handles.data = [];
plotprobe.handles.data = {};
plotprobe.handles.figureDup = [];
SetGuiControls(handles)

@@ -183,7 +183,7 @@ end


% ----------------------------------------------------------------------
function PlotProbeGUI_OpeningFcn(hObject, eventdata, handles, varargin)
function PlotProbeGUI_OpeningFcn(hObject, ~, handles, varargin)
%
%  Syntax:
%
@@ -325,7 +325,7 @@ hold off


% ----------------------------------------------------------------------
function editPlotProbeAxScl_Callback(hObject, eventdata, handles)
function editPlotProbeAxScl_Callback(hObject, ~, handles)
global plotprobe

foo = str2num( get(hObject,'string') );
@@ -348,7 +348,7 @@ end


% ----------------------------------------------------------------------
function pushbuttonPlotProbeYdec_Callback(hObject, eventdata, handles)
function pushbuttonPlotProbeYdec_Callback(~, ~, handles)
global plotprobe 

hEditScl = handles.editPlotProbeAxScl;
@@ -367,7 +367,7 @@ end


% ----------------------------------------------------------------------
function pushbuttonPlotProbeYinc_Callback(hObject, eventdata, handles)
function pushbuttonPlotProbeYinc_Callback(~, ~, handles)
global plotprobe 

hEditScl = handles.editPlotProbeAxScl;
@@ -386,7 +386,7 @@ end


% ----------------------------------------------------------------------
function pushbuttonPlotProbeXdec_Callback(hObject, eventdata, handles)
function pushbuttonPlotProbeXdec_Callback(~, ~, handles)
global plotprobe 
hEditScl = handles.editPlotProbeAxScl;

@@ -404,7 +404,7 @@ end


% ----------------------------------------------------------------------
function pushbuttonPlotProbeXinc_Callback(hObject, eventdata, handles)
function pushbuttonPlotProbeXinc_Callback(~, ~, handles)
global plotprobe 

hEditScl = handles.editPlotProbeAxScl;
@@ -423,20 +423,20 @@ end


% ----------------------------------------------------------------------
function radiobuttonShowTimeMarkers_Callback(hObject, evendata, handles)
function radiobuttonShowTimeMarkers_Callback(hObject, ~, ~)
global plotprobe

plotprobe.tMarkShow = get(hObject,'value');
if plotprobe.tMarkShow
    set(plotprobe.handles.data(:,4:end), 'visible','on');
    set(plotprobe.handles.data{:,4:end}, 'visible','on');
else
    set(plotprobe.handles.data(:,4:end), 'visible','off');    
    set(plotprobe.handles.data{:,4:end}, 'visible','off');    
end



% ----------------------------------------------------------------------
function editPlotProbeTimeMarkersAmp_Callback(hObject, eventdata, handles)
function editPlotProbeTimeMarkersAmp_Callback(hObject, ~, handles)
global plotprobe

datatype     = plotprobe.datatype;
@@ -457,7 +457,7 @@ end


% ----------------------------------------------------------------------
function editPlotProbeTimeMarkersInt_Callback(hObject, eventdata, handles)
function editPlotProbeTimeMarkersInt_Callback(hObject, ~, handles)
global plotprobe

t  = plotprobe.dataTree.currElem.GetTHRF();
@@ -484,7 +484,7 @@ end


% ----------------------------------------------------------------------
function pushbuttonPlotProbeDuplicate_Callback(hObject, eventdata, handles)
function pushbuttonPlotProbeDuplicate_Callback(~, ~, handles) %#ok<*DEFNU>
global plotprobe

if ishandles(plotprobe.handles.figureDup)
@@ -506,7 +506,7 @@ set(plotprobe.handles.figureDup, 'position',pos);

nDataBlks = plotprobe.dataTree.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
    plotProbeAndSetProperties(handles, iBlk, length(plotprobe.handles.data)+1);
end


@@ -544,7 +544,7 @@ pos = [p(1)+offsetX p(2)+offsetY p(3) p(4)];


% ----------------------------------------------------------------------
function radiobuttonShowHiddenMeas_Callback(hObject, eventdata, handles)
function radiobuttonShowHiddenMeas_Callback(hObject, ~, ~)
global plotprobe
plotprobe.hidMeasShow = get(hObject,'value');
nDataBlks = plotprobe.dataTree.currElem.GetDataBlocksNum();
@@ -555,7 +555,7 @@ end


% ----------------------------------------------------------------------
function PlotProbeGUI_Close(hObject, eventdata, handles)
function PlotProbeGUI_Close(~, ~, ~)
global plotprobe
if isempty(plotprobe)
    return
@@ -586,9 +586,6 @@ SetWindowTitle(handles)
condition = plotprobe.condition;
datatype  = plotprobe.datatype;

% Clear axes of previous data, before redisplaying it
ClearAxesData();

% Load current element data from file
if plotprobe.dataTree.currElem.IsEmpty()
    plotprobe.dataTree.currElem.Load();
@@ -597,6 +594,9 @@ end
nDataBlks = plotprobe.dataTree.currElem.GetDataBlocksNum();
plotprobe.y = cell(nDataBlks,1);
plotprobe.t = cell(nDataBlks,1);

hFigs = [handles.figure, plotprobe.handles.figureDup];
    
for iBlk = 1:nDataBlks
    if datatype == plotprobe.datatypeVals.OD_HRF
        plotprobe.y{iBlk} = plotprobe.dataTree.currElem.GetDodAvg(condition, iBlk);
@@ -608,22 +608,39 @@ for iBlk=1:nDataBlks
        plotprobe.tMarkAmp = plotprobe.tMarkAmp/1e6;
        plotprobe.tMarkUnits = '(micro-molars)';
    end
    plotProbeAndSetProperties(handles, iBlk);
    
    for iFig = 1:length(hFigs)
        % Clear axes of previous data, before redisplaying it
        ClearAxesData(iFig);
        
        if ishandles(hFigs(iFig))
            figure(hFigs(iFig))
            plotProbeAndSetProperties(handles, iBlk, iFig);
        end
    end    
end
figure(hFigs(1))



% ----------------------------------------------------------------------
function ClearAxesData()
function ClearAxesData(iFig)
global plotprobe
if ishandles(plotprobe.handles.data)
    delete(plotprobe.handles.data);
    plotprobe.handles.data = [];
if ~exist('iFig','var') || isempty(iFig)
    iFig=1;
end
if isempty(plotprobe.handles.data)
    return
end
if ishandles(plotprobe.handles.data{iFig})
    delete(plotprobe.handles.data{iFig});
    plotprobe.handles.data{iFig} = [];
end



% --------------------------------------------------------------------
function menuItemChangeGroup_Callback(hObject, eventdata, handles)
function menuItemChangeGroup_Callback(~, ~, ~)
pathname = uigetdir(pwd, 'Select a NIRS data group folder');
if pathname==0
    return;
@@ -634,7 +651,7 @@ PlotProbeGUI();


% --------------------------------------------------------------------
function pushbuttonExit_Callback(hObject, eventdata, handles)
function pushbuttonExit_Callback(~, ~, handles)
if ishandles(handles.figure)
    delete(handles.figure);
end
+5 −2
Original line number Diff line number Diff line
function plotProbeAndSetProperties(handles, iBlk)
function plotProbeAndSetProperties(handles, iBlk, iFig)
global plotprobe

if ~exist('iBlk','var') || isempty(iBlk)
    iBlk=1;
end
if ~exist('iFig','var') || isempty(iFig)
    iFig=1;
end

y        = plotprobe.y{iBlk};
t        = plotprobe.t{iBlk};
@@ -16,4 +19,4 @@ SD = plotprobe.dataTree.currElem.GetSDG();
set(handles.textTimeMarkersAmpUnits, 'string',plotprobe.tMarkUnits);
hData = plotProbe( y, t, SD, ch, [], axScl, tMarkInt, tMarkAmp );
showHiddenObjs(iBlk, hData);
plotprobe.handles.data = [plotprobe.handles.data; hData];
plotprobe.handles.data{iFig} = hData;
+6 −5
Original line number Diff line number Diff line
@@ -7,11 +7,12 @@ logger = InitLogger(logger, 'SystemInfo');
logger.Write(sprintf('Running Homer3 v%s\n\n', version2string()));

try
	logger.Write(sprintf('=========\n'))
	logger.Write(sprintf('CPU Info:\n'))
	logger.Write(sprintf('=========\n'))
	pretty_print_struct(cpuinfo, [], [], logger);
	logger.Write(sprintf('\n'))
    % Sep 4, 2020: Removed because it's slowing down Homer3 startup 
% 	logger.Write(sprintf('=========\n'))
% 	logger.Write(sprintf('CPU Info:\n'))
% 	logger.Write(sprintf('=========\n'))
% 	pretty_print_struct(cpuinfo, [], [], logger);
% 	logger.Write(sprintf('\n'))
	
	[~,systemview] = memory();
	logger.Write(sprintf('====\n'))
Loading