Commit 150061c6 authored by jayd1860's avatar jayd1860
Browse files

v1.47.0

-- Fix mlAct in hmrR_tCCA.m
-- In PlotProbeGUI get condition dynamically from parent gui, that is MainGUI
-- In PlotProbeGUI.m add back ability to display OD HRF and also any data type that is currently selected in MainGUI
parent 5d3d66e0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -616,6 +616,9 @@ classdef DataClass < FileLoadSaveClass
        
        % ---------------------------------------------------------
        function SetInactiveChannelData(obj)
            if obj.IsEmpty()
                return
            end
            for iMeas = 1:size(obj.dataTimeSeries,2)
                % We set the criteria for deciding if a channel is inactive if ALL it's 
                % data points are zero. Is this a safe assumption? Maybe we should create 
+5 −1
Original line number Diff line number Diff line
@@ -12,7 +12,11 @@ elseif isvector(mlAct0) && (length(mlAct0) > length(k))
elseif size(mlAct0,1) == length(k)
    mlAct = mlAct0;
elseif size(ml,2) == 2
    if ~isempty(mlAct0)
        mlAct = mlAct0;
    else
        mlAct = [ ml(k,1:2), ones(size(ml(k,:),1),2) ];
    end        
else
    mlAct = [ ml(k,1:2), ones(size(ml(k,:),1),1), ml(k,4) ];
end
+3 −7
Original line number Diff line number Diff line
@@ -126,13 +126,9 @@ if flagtCCA
        fq = 1/(t(2)-t(1));
                
        % get  a list of active channels
        if isempty(mlActMan{iBlk})
            mlActMan{iBlk} = ones(size(ml,1)*2,1);
        end
        if isempty(mlActAuto{iBlk})
            mlActAuto{iBlk} = ones(size(ml,1)*2,1);
        end
        MeasListAct = mlActMan{iBlk} & mlActAuto{iBlk};
        mlActMan{iBlk} = mlAct_Initialize(mlActMan{iBlk}, ml);
        mlActAuto{iBlk} = mlAct_Initialize(mlActAuto{iBlk}, ml);
        MeasListAct = mlActMan{iBlk}(:,3) & mlActAuto{iBlk}(:,3);
        
        %% find the list of short and long distance channels
        lst = 1:size(ml,1);
+1 −0
Original line number Diff line number Diff line
@@ -30,4 +30,5 @@ elseif plotConcVal && ~plotHRFVal
elseif plotConcVal && plotHRFVal
    datatype      = c.CONC_HRF;
end
maingui.datatype = datatype;
 
+78 −130
Original line number Diff line number Diff line
@@ -46,10 +46,15 @@ plotprobe.condition = [];
plotprobe.pos = [];

% Rest of the parameters 
plotprobe.datatypeVals = struct('RAW',1, 'RAW_HRF',2, 'OD',4, 'OD_HRF',8, 'CONC',16, 'CONC_HRF',32);
plotprobe.datatype = [];
plotprobe.datatypeVals = [];
plotprobe.name = 'plotprobe';
plotprobe.y = {};
plotprobe.yStd = {};
plotprobe.t = {};
plotprobe.ml = {};
plotprobe.SD = [];

SetGuiControls(handles)

setGuiFonts(handles.figure);
@@ -66,11 +71,49 @@ plotprobe.tMarkShow = get(handles.radiobuttonShowTimeMarkers, 'value');
plotprobe.tMarkUnits  = str2num(get(handles.textTimeMarkersAmpUnits, 'string'));



% ----------------------------------------------------------------------
function ParseArgs(args)
function InheritParentGuiParams()
global plotprobe
global maingui

% Now whichever of the above parameters weren't assigned values
% obtain values either from parent gui or assign default value
if isempty(maingui)
    if isempty(plotprobe.groupDirs)
        plotprobe.groupDirs = filesepStandard({pwd});
    end
    if isempty(plotprobe.format)
        plotprobe.format = 'snirf';
    end
    if isempty(plotprobe.condition)
        plotprobe.condition = 1;
    end
    if isempty(plotprobe.datatypeVals)
        plotprobe.datatypeVals = struct('RAW',1, 'RAW_HRF',2, 'OD',4, 'OD_HRF',8, 'CONC',16, 'CONC_HRF',32);
    end
    if isempty(plotprobe.datatype)
        plotprobe.datatype = plotprobe.datatypeVals.CONC_HRF;
    end
else
    if isempty(plotprobe.groupDirs)
        plotprobe.groupDirs = maingui.groupDirs;
    end
    if isempty(plotprobe.format)
        plotprobe.format = maingui.format;
    end
    plotprobe.condition = maingui.condition;
    plotprobe.datatypeVals = maingui.buttonVals;
    plotprobe.datatype = maingui.datatype;
end




% ----------------------------------------------------------------------
function ParseArgs(args)
global plotprobe

if ~exist('args','var')
    return;
end
@@ -152,32 +195,7 @@ elseif length(varargin)==5
    plotprobe.pos       = varargin{5};                      % PlotProbeGUI(groupDirs, format, datatype, condition, pos)
end

% Now whichever of the above parameters weren't assigned values
% obtain values either from parent gui or assign default value
if isempty(maingui)
    if isempty(plotprobe.groupDirs)
        plotprobe.groupDirs = filesepStandard({pwd});
    end
    if isempty(plotprobe.format)
        plotprobe.format = 'snirf';
    end
    if isempty(plotprobe.condition)
        plotprobe.condition = 1;
    end
else
    if isempty(plotprobe.groupDirs)
        plotprobe.groupDirs = maingui.groupDirs;
    end
    if isempty(plotprobe.format)
        plotprobe.format = maingui.format;
    end
    if isempty(plotprobe.condition)
        plotprobe.condition = maingui.condition;
    end
end
if isempty(plotprobe.datatype)
    plotprobe.datatype = plotprobe.datatypeVals.CONC_HRF;
end
InheritParentGuiParams()



@@ -310,8 +328,6 @@ set(handles.axes1, 'xlim', [0,1], 'ylim', [0,1]);
cla(handles.axes1); 
axis off;

condition = plotprobe.condition;
datatype  = plotprobe.datatype;
currElem  = plotprobe.dataTreeHandle.currElem;

% Load current element data from file
@@ -323,27 +339,7 @@ SetWindowTitle(handles)

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

hold on
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
plotprobe.y = cell(nDataBlks,1);
plotprobe.t = cell(nDataBlks,1);
for iBlk=1:nDataBlks
    if datatype == plotprobe.datatypeVals.OD_HRF
        plotprobe.y{iBlk} = currElem.GetDodAvg(condition, iBlk);
        plotprobe.ystd{iBlk} = plotprobe.dataTree.currElem.GetDodAvgStd(condition, iBlk);
        plotprobe.t{iBlk} = currElem.GetTHRF();
        plotprobe.tMarkUnits='(AU)';
    elseif datatype == plotprobe.datatypeVals.CONC_HRF
        plotprobe.y{iBlk} = currElem.GetDcAvg(condition, iBlk);
        plotprobe.ystd{iBlk} = plotprobe.dataTree.currElem.GetDcAvgStd(condition, iBlk);
        plotprobe.t{iBlk} = currElem.GetTHRF();
        plotprobe.tMarkAmp = plotprobe.tMarkAmp/1e6;
        plotprobe.tMarkUnits = '(micro-molars)';
    end
    plotProbeAndSetProperties(handles, iBlk);
end
hold off
plotProbeAndSetProperties(handles);



@@ -363,10 +359,7 @@ plotprobe.axScl = foo;
ClearAxesData(handles);

set(hObject,'string', sprintf('%0.1f %0.1f', plotprobe.axScl) );
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end
plotProbeAndSetProperties(handles);



@@ -381,11 +374,8 @@ set(hEditScl,'string', sprintf('%0.1f %0.1f', plotprobe.axScl) );

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

nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end



@@ -400,11 +390,7 @@ set(hEditScl,'string', sprintf('%0.1f %0.1f', plotprobe.axScl) );

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

nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end
plotProbeAndSetProperties(handles);



@@ -418,11 +404,7 @@ set(hEditScl,'string', sprintf('%0.1f %0.1f', plotprobe.axScl) );

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

nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end
plotProbeAndSetProperties(handles);



@@ -434,30 +416,29 @@ hEditScl = handles.editPlotProbeAxScl;

plotprobe.axScl(1) = plotprobe.axScl(1) + 0.1;
set(hEditScl,'string', sprintf('%0.1f %0.1f', plotprobe.axScl) );
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();

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

for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end



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

data = getappdata(handles.figure, 'data');
plotprobe.tMarkShow = get(hObject,'value');
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk = 1:nDataBlks
    for iSD = 1:size(data{iBlk},1)
        k = find(data{iBlk}(iSD,4:end)>0);
        if ~isempty(data{iBlk})
            if plotprobe.tMarkShow
            set(data{iBlk}(:,4:end), 'visible', 'on');    
                set(data{iBlk}(iSD,4+k-1), 'visible', 'on');
            else
            set(data{iBlk}(:,4:end), 'visible', 'off');    
                set(data{iBlk}(iSD,4+k-1), 'visible', 'off');
            end
        end
    end
end
@@ -468,21 +449,14 @@ end
function editPlotProbeTimeMarkersAmp_Callback(hObject, ~, handles)
global plotprobe

datatype     = plotprobe.datatype;
datatypeVals = plotprobe.datatypeVals;

plotprobe.tMarkAmp = str2num(get(hObject,'string'));
if datatype == datatypeVals.CONC_HRF
if plotprobe.datatype == plotprobe.datatypeVals.CONC_HRF
    plotprobe.tMarkAmp = plotprobe.tMarkAmp/1e6;
end

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

nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end
plotProbeAndSetProperties(handles);



@@ -505,11 +479,7 @@ set(hObject,'string', sprintf('%0.1f ',plotprobe.tMarkInt) );

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

nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk = 1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end
plotProbeAndSetProperties(handles);



@@ -550,10 +520,7 @@ uicontrol('parent',figures(iNew), 'style','text', 'string',hname.String, 'units'
uipanel('parent',figures(iNew), 'units',hdiv.Units, 'position',hdiv.Position, 'bordertype',hdiv.BorderType);
       
% Display data
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk, length(figures));
end
plotProbeAndSetProperties(handles, length(figures));
rePositionGuiWithinScreen(figures(iNew));


@@ -686,36 +653,16 @@ axes(handles.axes1);
SetWindowTitle(handles)
SetTextFilename(handles);

condition = plotprobe.condition;
datatype  = plotprobe.datatype;

% Load current element data from file
if plotprobe.dataTreeHandle.currElem.IsEmpty()
    plotprobe.dataTreeHandle.currElem.Load();
end

nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
plotprobe.y = cell(nDataBlks,1);
plotprobe.t = cell(nDataBlks,1);

tMarkAmp = str2num(get(handles.editPlotProbeTimeMarkersAmp, 'string'));
for iBlk = 1:nDataBlks
    if datatype == plotprobe.datatypeVals.OD_HRF
        plotprobe.y{iBlk} = plotprobe.dataTreeHandle.currElem.GetDodAvg(condition, iBlk);
        plotprobe.t{iBlk} = plotprobe.dataTreeHandle.currElem.GetTHRF();
        plotprobe.tMarkUnits='(AU)';
    elseif datatype == plotprobe.datatypeVals.CONC_HRF
        plotprobe.y{iBlk} = plotprobe.dataTreeHandle.currElem.GetDcAvg(condition, iBlk);
        plotprobe.t{iBlk} = plotprobe.dataTreeHandle.currElem.GetTHRF();
        plotprobe.tMarkAmp = tMarkAmp/1e6;
        plotprobe.tMarkUnits = '(micro-molars)';
    end
    
% Clear axes of previous data, before redisplaying it
ClearAxesData(handles);
plotProbeAndSetProperties(handles);
figure(handles.figure)
end



@@ -781,9 +728,14 @@ end
% Set name of current processing element and the length of the text box
% framing it
if ~isempty(CondNames)
    if plotprobe.datatype == plotprobe.datatypeVals.CONC_HRF || ...
       plotprobe.datatype == plotprobe.datatypeVals.OD_HRF
        name = sprintf('   %s,    condition: ''%s''', treeNodeName, CondNames{plotprobe.condition});
    else
    name = sprintf('   %s,    condition:  none', treeNodeName, CondNames{plotprobe.condition});
        name = sprintf('   %s,    condition:  N/A', treeNodeName);
    end
else
    name = sprintf('   %s,    condition:  N/A', treeNodeName);
end
n = length(name) + 0.5*length(name);
set(handles.textFilename, 'units','characters');
@@ -795,7 +747,6 @@ p1 = get(handles.textFilename, 'position');
set(handles.textFilenameFrame, 'units','characters');
p2 = get(handles.textFilenameFrame, 'position');
set(handles.textFilenameFrame, 'position',[p2(1), p2(2), p1(3)+(2.5*abs(p1(1)-p2(1))), p2(4)]);
p2 = get(handles.textFilenameFrame, 'position');

% Return to normalized units for textbox
set(handles.textFilename, 'units','normalized');
@@ -836,9 +787,6 @@ end

% --------------------------------------------------------------------
function radiobuttonShowStd_Callback(~, ~, handles)
global plotprobe
ClearAxesData(handles);
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end
plotProbeAndSetProperties(handles);
Loading