Commit b265dcb3 authored by Mike Cichonski's avatar Mike Cichonski
Browse files

partial fix for speed of ve_eegplot manual time mark adding, and proper...

partial fix for speed of ve_eegplot manual time mark adding, and proper creation of pop_vised history command
parent cdc82224
......@@ -1261,7 +1261,7 @@ else
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');
'LineStyle','none','tag',['mark_' g.time_marks_struct(tmi).label]);
alpha(sh,g.marks_col_alpha);
if p1==0;
text(figdim(2),ylims(1)+inter_time_mark_offset*tmi+(time_marks_offset(i))-(inter_time_mark_offset*length(g.time_marks_struct)), ...
......@@ -2016,7 +2016,7 @@ else
end;
end;
set(fig,'UserData', g);
ve_eegplot('drawp', 0);
%ve_eegplot('drawp', 0);
if strcmp(g.mocap,'on'), show_mocap_for_eegplot(g.winrej); g.winrej = g.winrej(end,:); end; % nima
% push button: create/remove window
......@@ -2072,7 +2072,7 @@ else
end;
end;
set(fig,'UserData', g);
ve_eegplot('drawp', 0); % redraw background
%ve_eegplot('drawp', 0); % redraw background
end;
end;
end;
......
......@@ -236,6 +236,83 @@ if ~isempty(g.add_winrej_mark) || ~isempty(g.add_page_mark) || ~isempty(g.rm_win
end
end
set(gcf, 'userdata', udf);
if (isfield(g,'awm') && strcmp(g.awm,'manual')); % || (isfield(g,'rwm') && strcmp(g.rwm,'manual'));
figh = gcf; % figure handle
if strcmp(get(figh,'tag'),'dialog')
figh = get(figh,'UserData');
end
ax0 = findobj('tag','backeeg','parent',figh); % axes handle
ax1 = findobj('tag','eegaxis','parent',figh); % axes handle
data = get(ax1,'UserData');
ESpacing = findobj('tag','ESpacing','parent',figh); % ui handle
EPosition = findobj('tag','EPosition','parent',figh); % ui handle
if udf.trialstag(1) == -1
udf.time = str2num(get(EPosition,'string'));
else
udf.time = str2num(get(EPosition,'string'));
udf.time = udf.time - 1;
end;
udf.spacing = str2num(get(ESpacing,'string'));
if udf.trialstag ~= -1 % time in second or in trials
multiplier = udf.trialstag;
else
multiplier = udf.srate;
end;
% Update edit box
% ---------------
udf.time = max(0,min(udf.time,ceil((udf.frames-1)/multiplier)-udf.winlength));
if udf.trialstag(1) == -1
set(EPosition,'string',num2str(udf.time));
else
set(EPosition,'string',num2str(udf.time+1));
end;
set(figh, 'userdata', udf);
lowlim = round(udf.time*multiplier+1)
highlim = round(min((udf.time+udf.winlength)*multiplier+2,udf.frames))
low_high_range = lowlim:highlim;
zlowhigh = zeros(1,length(low_high_range));
ylims=get(gca,'YLim');
inter_time_mark_offset=diff(ylims)*udf.inter_mark_int;
time_marks_offset=diff(ylims)*udf.marks_y_loc;
% plot time_info flags.
cmap=[];
j=0;
cflags=double([udf.time_marks_struct(1).flags(lowlim:highlim);udf.time_marks_struct(1).flags(lowlim:highlim)]);
cdat=cflags;
cdat=udf.marks_col_int*round(cflags/udf.marks_col_int);
tmp_cdat=cdat;
uval=unique(cdat);
for ci=1:length(uval);
tmp_cdat(find(cdat==uval(ci)))=ci+j-1;
cmap(ci+j,:)=ones(1,3)-((ones(1,3)-udf.time_marks_struct(1).color)*uval(ci));
end
j=j+length(uval);
cdat=tmp_cdat;
for i=1:length(time_marks_offset)
if isfield(g,'awm');
sh=surf(1:size(cflags,2), ...
[ylims(1)+inter_time_mark_offset*1+(time_marks_offset(i))-(inter_time_mark_offset*length(udf.time_marks_struct)), ...
ylims(1)+inter_time_mark_offset*1+(time_marks_offset(i))+inter_time_mark_offset-(inter_time_mark_offset*length(udf.time_marks_struct))], ...
cflags, ...
'CData',cdat, ...
'LineStyle','none','tag',['mark_' udf.time_marks_struct(1).label]);
alpha(sh,udf.marks_col_alpha);
end
end
return
end
if strcmp(g.page_forward, 'off');
ve_eegplot('drawp', 0)
else
......
......@@ -20,7 +20,7 @@ vised_config.marks_col_int=[];
vised_config.marks_col_alpha=[];
%eegplot options
vised_config.srate='';%store sample rate value or name of sample rate var... if empty EEG.srate... implemented
vised_config.srate=[];%store sample rate value or name of sample rate var... if empty EEG.srate... implemented
vised_config.spacing=[];
vised_config.eloc_file='';%store name of channel location structure or location fname... if empty EEG.chanlocs
vised_config.limits=[];
......
......@@ -479,7 +479,8 @@ else
end
end
end
vised_config.tmp_events=VisEd.event;
try vised_config.tmp_events=VisEd.event; catch, vised_config.tmp_events = [];end
if ~isempty(vised_config.quick_evtmk)%overwrites vised_config.altselectcommand
vised_config.altselectcommand={ ['ve_edit(EEG,''quick_evtmk'',''', ...
......@@ -556,16 +557,6 @@ for i=1:length(vised_config.chan_marks_struct);
vised_config.chan_marks_struct(i).flags=vised_config.chan_marks_struct(i).flags(chans);
end
if isempty(vised_config.srate);
vised_config.srate=EEG.srate;
else
if isempty(str2num(vised_config.srate));
vised_config.srate=eval(vised_config.srate);
else
vised_config.srate=str2num(vised_config.srate);
end
end
if isempty(str2num(vised_config.children))
try vised_config.children=findobj('tag',vised_config.children);
catch, disp('the children tag does not exist... figure will have no child')
......@@ -583,5 +574,60 @@ for i=1:length(vararg_cell);
end
ve_eegplot(data, vararg_cell{:});
temp_config = init_vised_config;
keywords = fieldnames(vised_config);
vararg_str = '';
for i=1:length(keywords);
curr_field = eval(['vised_config.',keywords{i}]);
dflt_field = [];
if isfield(temp_config,eval('keywords{i}'));
dflt_field = eval(['temp_config.',keywords{i}]);
end
if ischar(curr_field);
if ~strcmp(curr_field,dflt_field);
quote_inds = strfind(curr_field,'''');
if length(quote_inds)==1;
curr_field = [curr_field(1:quote_inds) '''' curr_field(quote_inds+1:end)];
elseif length(quote_inds)>1;
for j=1:length(quote_inds);
curr_field = [curr_field(1:quote_inds(j)+j-1) '''' curr_field(j+quote_inds(j):end)];
end
end
vararg_str = strcat(vararg_str,',','''',keywords{i},'''',',','''',curr_field,'''');
end
elseif iscell(curr_field);
if ~isempty(setdiff(curr_field,dflt_field));
tf = transpose(curr_field);
vararg_str = strcat(vararg_str,',','''',keywords{i},'''',',{');
for t=1:length(tf);
quote_inds = strfind(tf{t},'''');
if length(quote_inds)==1;
tf{t} = [tf{t}(1:quote_inds) '''' tf{t}(quote_inds+1:end)];
elseif length(quote_inds)>1;
for j=1:length(quote_inds);
tf{t} = [tf{t}(1:quote_inds(j)+j-1) '''' tf{t}(j+quote_inds(j):end)];
end
end
vararg_str = strcat(vararg_str,'''',tf{t},'''',';');
if t==length(tf);
vararg_str = vararg_str(1:end-1);
end
end
vararg_str = strcat(vararg_str,'}');
end
elseif isnumeric(curr_field);
if isempty(dflt_field);
dflt_field = 0;
end
if ~all(size(curr_field)==[1,1]);
continue;
end
if curr_field~=dflt_field;
vararg_str = strcat(vararg_str,',','''',keywords{i},'''',',',num2str(curr_field));
end
end
end
vararg_str = vararg_str(2:end); % remove leading comma
%% RETURN COMMAND AND EVALUATE CALL TO VISED
com=sprintf('EEG = pop_vised( %s, {%s});', inputname(1), vararg2str(event_type));
com=sprintf('EEG = pop_vised(EEG,''pop_gui'',''off'',%s);',vararg_str);
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