Commit ccac9479 authored by sstucker's avatar sstucker
Browse files

Channels hidden in MainGUI via right click do not appear at all in the...

Channels hidden in MainGUI via right click do not appear at all in the plotProbe; removed Show hidden channels button; renamed Duplicate Plot 'Export Plot'
parent f7b43f29
Loading
Loading
Loading
Loading
+12.7 KiB (62.4 KiB)

File changed.

No diff preview for this file type.

+10 −18
Original line number Diff line number Diff line
@@ -66,8 +66,6 @@ plotprobe.tMarkInt = str2num(get(handles.editPlotProbeTimeMarkersInt, 'string
plotprobe.tMarkAmp    = str2num(get(handles.editPlotProbeTimeMarkersAmp, 'string'));
plotprobe.tMarkShow   = get(handles.radiobuttonShowTimeMarkers, 'value');
plotprobe.tMarkUnits  = str2num(get(handles.textTimeMarkersAmpUnits, 'string'));
plotprobe.hidMeasShow = get(handles.radiobuttonShowHiddenMeas, 'value');
 


% ----------------------------------------------------------------------
@@ -441,10 +439,16 @@ function radiobuttonShowTimeMarkers_Callback(hObject, ~, ~)
global plotprobe

plotprobe.tMarkShow = get(hObject,'value');
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    ml = plotprobe.dataTree.currElem.GetMeasList(iBlk);
    lst = find(ml.MeasList(:,4)==1);
    mlVis = ml.MeasListVis(lst);
    if plotprobe.tMarkShow
    set(plotprobe.handles.data{1}(:,4:end), 'visible','on');
        set(plotprobe.handles.data{iBlk}(logical(mlVis), 4:end), 'visible','on');
    else
    set(plotprobe.handles.data{1}(:,4:end), 'visible','off');    
        set(plotprobe.handles.data{iBlk}(:,4:end), 'visible','off');    
    end
end


@@ -589,18 +593,6 @@ p = get(haxes,'position');
set(gca, 'position',p)



% ----------------------------------------------------------------------
function radiobuttonShowHiddenMeas_Callback(hObject, ~, ~)
global plotprobe
plotprobe.hidMeasShow = get(hObject,'value');
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks    
    showHiddenObjs(iBlk);
end



% ----------------------------------------------------------------------
function PlotProbeGUI_Close(~, ~, ~)
global plotprobe
+65 −54
Original line number Diff line number Diff line
% h = plotProbe( y, t, SD, ml, ystd, axFactor, tStep, tAmp )
% h = plotProbe( y, t, SD, ml, ystd, axFactor, tStep, tAmp, tVis )
%
% Plot the data in the probe format. If no data is provided,
% this plots the probe geometry given in SD.
@@ -26,6 +26,9 @@
%
% axFactor - [x y] scale the width and height of the subplots. OPTIONAL
%
% tVis - The value of the visible property of the vertical time markers. if
%         'on' 1, they are shown, if 'off' or 0, they are not.
%
% tStep - Time intervals at which to draw vertical time markers, starting at
%         t0 (stim onset).  tStep has be within the range of 5 <= tStep <= t.
%         OPTIONAL
@@ -38,7 +41,7 @@
% toggle nearest neighbors
% assuming y is concentration data... need to check dimensions

function h = plotProbe( y, t, SD, ch, ystd, axFactor, tStep, tAmp )
function h = plotProbe( y, t, SD, ch, ystd, axFactor, tStep, tAmp, tVis)

h=[];

@@ -49,8 +52,14 @@ end
if ~exist('ystd','var')
    ystd = [];
end
if ~exist('ystd','var')
    ystd = [];
if ~exist('tVis','var')
    tVis = 'on';
else
    if tVis == 1
        tVis = 'on';
    elseif tVis == 0
        tVis = 'off';
    end 
end
if ~exist('axFactor','var')
    axFactor = [1,1];
@@ -112,6 +121,10 @@ axHgt = axFactor(2) * 1/nUp;
axXoff=mean([sPos(:,1);dPos(:,1)])-.5;
axYoff=mean([sPos(:,2);dPos(:,2)])-.5;

ml    = ch.MeasList;
lst   = find(ch.MeasList(:,4)==1);
mlAct = (ch.MeasListActMan(lst) & ch.MeasListActAuto(lst)) * 1;
mlAct(~ch.MeasListVis(lst)) = -1;  % -1 if channel is hidden

%This is the plotting routine
try
@@ -120,10 +133,6 @@ try
    % error ocurred.
    idx = 0;

    ml    = ch.MeasList;
    lst   = find(ch.MeasList(:,4)==1);
    mlAct = ch.MeasListActMan(lst);

    if ndims(y)==3
        color=[
               1.00 0.00 0.00;
@@ -193,6 +202,9 @@ try
        
        for idx=1:length(lstW1)
            
            % Record line graphics properties based on the object type
            [lc,lv,lw,ls] = setLineProperties(lc,lv,lw,ls,idx,mlAct,color,nDataTypes,nTSteps);
            
            xa = (sPos(ml(lstW1(idx),1),1) + dPos(ml(lstW1(idx),2),1))/2 - axXoff;
            ya = (sPos(ml(lstW1(idx),1),2) + dPos(ml(lstW1(idx),2),2))/2 - axYoff;
            hold on
@@ -207,12 +219,12 @@ try

            
            % Plot data curves
            h(idx,1)=plot( xT, AvgT(:,1),'color',color(1,:));
            h(idx,1)=plot( xT, AvgT(:,1),'color',color(1,:), 'visible',lv{idx, 1});
            if size(AvgT,2)>1
                h(idx,2)=plot( xT, AvgT(:,2),'color',color(2,:));
                h(idx,2)=plot( xT, AvgT(:,2),'color',color(2,:), 'visible',lv{idx, 2});
            end
            if size(AvgT,2)>2
                h(idx,3)=plot( xT, AvgT(:,3),'color',color(3,:));
                h(idx,3)=plot( xT, AvgT(:,3),'color',color(3,:), 'visible',lv{idx, 3});
            end

            
@@ -244,9 +256,14 @@ try
            yStim = [AvgTmin,AvgTmax];
            xT0 = xT(find(t==0));
            xTStep = tStep*(xT(2)-xT(1));
            if strcmp(lv{idx, ii}, 'off')
               tvis_ch = 'off'; 
            else
                tvis_ch = tVis;
            end
            for xTi=xT0:xTStep:xT(end)
                xTi = [xTi xTi];
                h(idx,ii) = plot( xTi, yStim,'color','k' );
                h(idx,ii) = plot(xTi, yStim, 'color', 'k', 'visible', tvis_ch);
                lw(idx,ii) = 1.0;
                ii=ii+1;
                if ii-ndims(Avg)>nTSteps
@@ -262,12 +279,12 @@ try
                    AvgT(:,1) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))-ystd(:,lstW1(idx))-cmin)/(cmax-cmin))/2;
                    AvgT(:,2) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))-ystd(:,lstW2(idx))-cmin)/(cmax-cmin))/2;
                end
                h(idx,1)=plot( xT, AvgT(:,1), 'linewidth',0.5,'color',color(1,:),'linestyle',':');
                h(idx,1)=plot( xT, AvgT(:,1), 'linewidth',0.5,'color',color(1,:),'linestyle',':', 'visible',lv{idx,ii});
                if size(AvgT,2)>1
                    h(idx,2)=plot( xT, AvgT(:,2), 'linewidth',0.5,'color',color(2,:),'linestyle',':');
                    h(idx,2)=plot( xT, AvgT(:,2), 'linewidth',0.5,'color',color(2,:),'linestyle',':', 'visible',lv{idx,ii});
                end
                if size(AvgT,2)>2
                    h(idx,3)=plot( xT, AvgT(:,3), 'linewidth',0.5,'color',color(3,:),'linestyle',':');
                    h(idx,3)=plot( xT, AvgT(:,3), 'linewidth',0.5,'color',color(3,:),'linestyle',':', 'visible',lv{idx,ii});
                end
                
                if ndims(Avg)==3
@@ -276,32 +293,27 @@ try
                    AvgT(:,1) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))+ystd(:,lstW1(idx))-cmin)/(cmax-cmin))/2;
                    AvgT(:,2) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))+ystd(:,lstW2(idx))-cmin)/(cmax-cmin))/2;
                end
                h(idx,1)=plot( xT, AvgT(:,1), 'linewidth',0.5,'color',color(1,:),'linestyle',':');
                h(idx,1)=plot( xT, AvgT(:,1), 'linewidth',0.5,'color',color(1,:),'linestyle',':', 'visible',lv{idx,ii});
                if size(AvgT,2)>1
                    h(idx,2)=plot( xT, AvgT(:,2), 'linewidth',0.5,'color',color(2,:),'linestyle',':');
                    h(idx,2)=plot( xT, AvgT(:,2), 'linewidth',0.5,'color',color(2,:),'linestyle',':', 'visible',lv{idx,ii});
                end
                if size(AvgT,2)>2
                    h(idx,3)=plot( xT, AvgT(:,3), 'linewidth',0.5,'color',color(3,:),'linestyle',':');
                    h(idx,3)=plot( xT, AvgT(:,3), 'linewidth',0.5,'color',color(3,:),'linestyle',':', 'visible',lv{idx,ii});
                end
            end
            

            % Record line graphics properties based on the object type
            [lc,lv,lw,ls] = setLineProperties(lc,lv,lw,ls,idx,mlAct,color,nDataTypes,nTSteps);
            
        end

        % After plotting all the data, modify lines colors, styles, and width
        for idx=1:length(lstW1)
            for j=1:size(h,2)
                set(h(idx,j),'color',lc(idx,j,:),'linestyle',ls{idx},'linewidth',lw(idx,j),'visible',lv{idx,j});
                set(h(idx,j),'color',lc(idx,j,:),'linestyle',ls{idx},'linewidth',lw(idx,j));
            end
        end
    end
    
    
    % Plot the optodes on the axes
    if ~isProbeDrawn(SD)
    if ismac() || islinux()
        fs = 14;
    else
@@ -324,7 +336,6 @@ try
        set(ht,'fontweight','bold','fontsize',fs)
        set(ht,'color',[0 0 1])            
    end
    end
    
catch
    
@@ -340,16 +351,16 @@ hold off
% ----------------------------------------------------------------------------------------
function [lc,lv,lw,ls] = setLineProperties(lc,lv,lw,ls,idx,mlAct,color,nDataTypes,nTSteps)

if mlAct(idx)==0
if mlAct(idx)==0  % Make manually and automaticaly pruned or disabled channels dotted
    ls{idx} = ':';
    for ii=1:nDataTypes
        lw(idx,ii) = 2.0;
        lc(idx,ii,:) = color(ii,:);
        lv{idx,ii} = 'off';
        lv{idx,ii} = 'on';
    end
    for ii=nDataTypes+1:nDataTypes+nTSteps
        lc(idx,ii,:) = [0 0 0];
        lv{idx,ii} = 'off';
        lv{idx,ii} = 'on';
    end
elseif mlAct(idx)==1
    ls{idx} = '-';
@@ -362,16 +373,16 @@ elseif mlAct(idx)==1
        lc(idx,ii,:) = [0 0 0];
        lv{idx,ii} = 'on';
    end
elseif mlAct(idx)==2
elseif mlAct(idx)==-1  % Hide hidden channels
    ls{idx} = '-';
    for ii=1:nDataTypes
        lw(idx,ii) = 1.0;
        lc(idx,ii,:) = color(ii+nDataTypes,:);
        lv{idx,ii} = 'on';
        lv{idx,ii} = 'off';
    end
    for ii=nDataTypes+1:nDataTypes+nTSteps
        lc(idx,ii,:) = [0 0 0];
        lv{idx,ii} = 'on';
        lv{idx,ii} = 'off';
    end
end

+2 −2
Original line number Diff line number Diff line
@@ -13,10 +13,10 @@ t = plotprobe.t{iBlk};
tMarkInt = plotprobe.tMarkInt;
axScl    = plotprobe.axScl;
tMarkAmp = plotprobe.tMarkAmp;
tMarkVis = plotprobe.tMarkShow;
ch       = plotprobe.dataTree.currElem.GetMeasList(iBlk);
SD       = plotprobe.dataTree.currElem.GetSDG();

set(handles.textTimeMarkersAmpUnits, 'string',plotprobe.tMarkUnits);
hData = plotProbe( y, t, SD, ch, [], axScl, tMarkInt, tMarkAmp );
showHiddenObjs(iBlk, hData);
hData = plotProbe( y, t, SD, ch, [], axScl, tMarkInt, tMarkAmp, tMarkVis );
plotprobe.handles.data{iFig} = hData;

PlotProbeGUI/showHiddenObjs.m

deleted100644 → 0
+0 −43
Original line number Diff line number Diff line
function showHiddenObjs(iBlk, hData)
global plotprobe

if ~exist('hData','var')
    hData = plotprobe.handles.data;
end
y        = plotprobe.y{iBlk};
ch       = plotprobe.dataTree.currElem.GetMeasList(iBlk);
h        = hData;
bit0     = plotprobe.tMarkShow;
bit1     = plotprobe.hidMeasShow;

bitmask  = 2*bit1+bit0;

if isempty(y)
    return;
end
if ~ishandles(h)
    return;
end

nDataTypes = ndims(y);
MLact = ch.MeasListActAuto(ch.MeasList(:,4)==1); % option for future

j1 = find(MLact~=0);
j2 = find(MLact==0);
k1 = 1:nDataTypes;
k2 = nDataTypes+1:size(h,2);
switch bitmask
case 0
    set(h(j1,k1),'visible','on');
    set(h(j1,k2),'visible','off');
    set(h(j2,[k1 k2]),'visible','off');
case 1
    set(h(j1,[k1 k2]),'visible','on');
    set(h(j2,[k1 k2]),'visible','off');
case 2
    set(h([j1; j2],k1),'visible','on');
    set(h([j1; j2],k2),'visible','off');
case 3
    set(h([j1;j2],[k1 k2]),'visible','on');
end