Commit a541153f authored by Brad Kennedy's avatar Brad Kennedy
Browse files

Brad progress

parent ff5d4084
......@@ -1202,20 +1202,48 @@ else
%% HANDLE MARKING ...
%calculate x ifinterval for channel tags...
figdim=axis;
tag_x_int=figdim(2)*g.inter_tag_int;
figdim = axis;
tag_x_int = figdim(2) * g.inter_tag_int;
% plot channels whose order is < 0.
mark_inds=find([g.chan_marks_struct.order]<0);
mark_inds= 1:length(g.chan_marks_struct);
n_mark_inds=length(mark_inds);
default_colour = [0.7 0.7 0.7];
if strcmp(g.plotdata2, 'on') && length(g.color) == 2
default_colour = g.color{2};
end
% Initialize struct array
[channel_colour(1:size(data, 1)).priority] = deal(-inf);
% Default colour
[channel_colour(1:size(data, 1)).colour] = deal(default_colour);
% If this flag is set, then the priority is infinite
[channel_colour(1:size(data, 1)).force] = deal(false);
len_mark = length(g.chan_marks_struct);
%% Find out the line with the highest priority
% Mark index
for mi = 1:len_mark
cur_mark = g.chan_marks_struct(mi);
% Channel index
for ci = find(cur_mark.flags)'
% If priority is lower then current mark, or equal we update
% this means the latest with the equal priority is picked
if ~(channel_colour(ci).force) ...
&& channel_colour(ci).priority <= cur_mark.order
% Update colour and mark
channel_colour(ci).priority = cur_mark.order;
channel_colour(ci).colour = cur_mark.line_color;
channel_colour(ci).force = strcmp('manual', cur_mark.label);
end
end
end
%% Draw Ticks
for fi=1:n_mark_inds;
chan_inds=find(g.chan_marks_struct(mark_inds(n_mark_inds-(fi-1))).flags);
tmp_color=g.chan_marks_struct(mark_inds(n_mark_inds-(fi-1))).line_color;
tmp_color=[.7 .7 .7];
if strcmp(g.plotdata2, 'on') && length(g.color) == 2
tmp_color=g.color{2};
end
plot_p1 = 1+tag_x_int*mark_inds(n_mark_inds-(fi-1));
plot_p2 = (g.chans-(chan_inds-1))*g.spacing;
plot_p1 = 1 + tag_x_int * mark_inds(n_mark_inds - (fi-1));
plot_p2 = (g.chans-(chan_inds-1)) * g.spacing;
plot_colour = g.chan_marks_struct(mark_inds(n_mark_inds-(fi-1))).tag_color;
for ci=1:length(chan_inds);
%plot tick...
......@@ -1224,27 +1252,35 @@ else
'MarkerFaceColor', plot_colour, ...
'MarkerSize', 8);
%plot data
tmp_offset=(g.chans-(chan_inds(ci)-1))*g.spacing-(meandata(chan_inds(ci)));
line(1:length(low_high_range), ...
data(chan_inds(ci),low_high_range) + tmp_offset, zlowhigh, ...
'color', tmp_color, 'clipping','on');
% tmp_offset=(g.chans-(chan_inds(ci)-1))*g.spacing-(meandata(chan_inds(ci)));
% line(1:length(low_high_range), ...
% data(chan_inds(ci),low_high_range) + tmp_offset, zlowhigh, ...
% 'color', tmp_color, 'clipping','on');
end
end
%% Draw underlines (order < 0)
% Channel index
for ci = find([channel_colour.priority] < 0)
tmp_offset=(g.chans-(ci-1)) * g.spacing - meandata(ci);
tmp_colour = channel_colour(ci).colour;
line(1:length(low_high_range), ...
data(ci, low_high_range) + tmp_offset, zlowhigh * 1000, ...
'color', tmp_colour, 'clipping','on');
end
ylims=get(gca,'YLim');
inter_time_mark_offset=diff(ylims)*g.inter_mark_int;
%inter_time_mark_offset=figdim(4)*g.inter_mark_int;
time_marks_offset=diff(ylims)*g.marks_y_loc;
%time_marks_offset=figdim(4)*g.marks_y_loc;
% plot time_info flags.
%% plot time_info flags.
cmap=[];
j=0;
%for ntf=1:length(time_marks_offset);
for tmi=1:length(g.time_marks_struct);
cflags=double([g.time_marks_struct(tmi).flags(lowlim:highlim);g.time_marks_struct(tmi).flags(lowlim:highlim)]);
cdat=cflags;
cflags = double([g.time_marks_struct(tmi).flags(lowlim:highlim) ...
; g.time_marks_struct(tmi).flags(lowlim:highlim)]);
cdat = cflags;
cdat=g.marks_col_int*round(cflags/g.marks_col_int);
tmp_cdat=cdat;
......@@ -1258,80 +1294,40 @@ else
for i=1:length(time_marks_offset)
sh=surf(1:size(cflags,2), ...
[ylims(1)+inter_time_mark_offset*tmi+(time_marks_offset(i))-(inter_time_mark_offset*length(g.time_marks_struct)), ...
ylims(1)+inter_time_mark_offset*tmi+(time_marks_offset(i))+inter_time_mark_offset-(inter_time_mark_offset*length(g.time_marks_struct))], ...
[ylims(1)+inter_time_mark_offset*tmi+(time_marks_offset(i)) - ...
(inter_time_mark_offset*length(g.time_marks_struct)), ...
ylims(1)+inter_time_mark_offset*tmi+(time_marks_offset(i))+ ...
inter_time_mark_offset-(inter_time_mark_offset*length(g.time_marks_struct))], ...
cflags, ...
'CData',cdat, ...
'LineStyle','none');
alpha(sh,g.marks_col_alpha);
alpha(sh, g.marks_col_alpha);
text(figdim(2),ylims(1)+inter_time_mark_offset*tmi+(time_marks_offset(i))-(inter_time_mark_offset*length(g.time_marks_struct)), ...
g.time_marks_struct(tmi).label,'color',g.time_marks_struct(tmi).color,'interpreter','none');
end
end
colormap(cmap);
chan_inds=find(sum([g.chan_marks_struct.flags],2)==0);
tmp_color=g.color{:};%[0,0,.3];
if strcmp(g.plotdata2, 'on')
if length(g.color)==2
tmp_color=g.color{2};
else
tmp_color=[.7 .7 .7];
end
end
chan_inds = find(sum([g.chan_marks_struct.flags],2) == 0);
tmp_color = g.color{:}; %[0,0,.3];
if strcmp(g.plotdata2, 'on')
tmp_color = default_colour;
end
for ci=1:length(chan_inds);
tmp_offset=(g.chans-(chan_inds(ci)-1))*g.spacing-(meandata(chan_inds(ci)));
line(1:length(lowlim:highlim),data(chan_inds(ci),lowlim:highlim) + tmp_offset, ones(1,length(lowlim:highlim))*100, ...
'color', tmp_color, 'clipping','on');
end
% plot channels whose order is > 0.
mark_inds = find([g.chan_marks_struct.order]>0);
manual_mark_ind = strcmp('manual',{g.chan_marks_struct.label});
for fi=1:length(mark_inds);
chan_inds = [];
chan_inds = find(g.chan_marks_struct(mark_inds(fi)).flags);
tmp_color = g.chan_marks_struct(mark_inds(fi)).line_color;
if strcmp(g.plotdata2, 'on')
if length(g.color) == 2
tmp_color = g.color{2};
else
tmp_color = [.7, .7, .7];
end
end
for ci=1:length(chan_inds);
%plot tick...
plot(1+tag_x_int*mark_inds(fi),(g.chans-(chan_inds(ci)-1))*g.spacing,'<', ...
'MarkerEdgeColor', g.chan_marks_struct(mark_inds(fi)).tag_color, ...
'MarkerFaceColor', g.chan_marks_struct(mark_inds(fi)).tag_color, ...
'MarkerSize',8);
%plot data
if ~g.chan_marks_struct(manual_mark_ind).flags(chan_inds(ci))
tmp_offset=(g.chans-(chan_inds(ci)-1))*g.spacing-(meandata(chan_inds(ci)));
line(1:length(lowlim:highlim),data(chan_inds(ci),lowlim:highlim) + tmp_offset, ones(1,length(lowlim:highlim))*1000, ...
'color', tmp_color, 'clipping','on');
end
end
%% plot channels whose order is > 0.
for ci = find([channel_colour.priority] > 0)
tmp_offset=(g.chans-(ci-1)) * g.spacing - meandata(ci);
tmp_colour = channel_colour(ci).colour;
line(1:length(low_high_range), ...
data(ci, low_high_range) + tmp_offset, zlowhigh, ...
'color', tmp_colour, 'clipping','on');
end
% draw selected channels
% ------------------------
if ~isempty(g.winrej) && size(g.winrej,2) > 2
for tpmi = 1:size(g.winrej,1) % scan rows
if (g.winrej(tpmi,1) >= lowlim && g.winrej(tpmi,1) <= highlim) || ...
(g.winrej(tpmi,2) >= lowlim && g.winrej(tpmi,2) <= highlim)
abscmin = max(1,round(g.winrej(tpmi,1)-lowlim));
abscmax = round(g.winrej(tpmi,2)-lowlim);
maxXlim = get(gca, 'xlim');
abscmax = min(abscmax, round(maxXlim(2)-1));
for i = 1:g.chans
if g.winrej(tpmi,g.chans-i+1+5)
plot(abscmin+1:abscmax+1,data(g.chans-i+1,abscmin+lowlim:abscmax+lowlim) ...
-meandata(g.chans-i+1)+i*g.spacing + (g.dispchans+1)*(oldspacing-g.spacing)/2 +g.elecoffset*(oldspacing-g.spacing), 'color','r','clipping','on')
end
end
end
end
end
g.spacing = oldspacing;
set(ax1, 'Xlim',[1 g.winlength*multiplier+1],...
'XTick',[1:multiplier*DEFAULT_GRID_SPACING:g.winlength*multiplier+1]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment