0001 function set_ic_ftr_thresh(command_str)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 global EEG;
0079 global VERBLEVEL;
0080
0081 if nargin == 0
0082 command_str = 'initialize';
0083 end
0084
0085
0086 if ~strcmpi(command_str,'initialize')
0087 h_fig = gcf;
0088 if ~strcmp(get(h_fig,'tag'),'set_ic_ftr_thresh')
0089
0090
0091 h_figs = get(0,'children');
0092 h_fig = findobj(h_figs,'flat',...
0093 'tag','set_ic_ftr_thresh');
0094 if isempty(h_fig)
0095
0096
0097
0098 set_ic_ftr_thresh('initialize');
0099 set_ic_ftr_thresh(command_str);
0100 return;
0101 end
0102 end
0103
0104
0105
0106
0107
0108 end
0109
0110
0111 if strcmp(command_str,'initialize')
0112
0113
0114
0115
0116 h_figs = get(0,'children');
0117 h_fig = findobj(h_figs,'flat',...
0118 'tag','set_ic_ftr_thresh');
0119 if ~isempty(h_fig)
0120 figure(h_fig(1));
0121 return
0122 end
0123
0124 h_fig = figure('name','set_ic_ftr_thresh GUI','tag','set_ic_ftr_thresh', ...
0125 'MenuBar','none');
0126 pos=get(h_fig,'position');
0127
0128
0129 clear dat_tmp;
0130
0131
0132
0133
0134
0135
0136 h_frame_top = uicontrol(h_fig,...
0137 'Units','normalized', ...
0138 'Position',[ 0 0.9 1 0.3 ],...
0139 'Style','frame');
0140 frm_col=get(h_frame_top,'backgroundcolor');
0141
0142
0143 h_in_fnameB=uicontrol(h_fig,...
0144 'CallBack',['h_in_fname=findobj(gcf,''tag'',''in_fname'');' ...
0145 '[in_fname, in_pathname]=uigetfile(''*.set'',''Select EEGLAB .set data file'');' ...
0146 'if in_fname, ', ...
0147 ' set(h_in_fname,''string'',[in_pathname in_fname]);' ...
0148 ' set_ic_ftr_thresh(''load data''); end;'], ...
0149 'Units','normalized', ...
0150 'Position',[ 0.03 0.92 0.15 0.06 ],...
0151 'String','Input File',...
0152 'ToolTipString','Click to find *.eim file containing EEG and sorting variables', ...
0153 'Style','pushbutton');
0154
0155
0156 h_in_fname=uicontrol(h_fig,...
0157 'CallBack','set_ic_ftr_thresh(''load data'');',...
0158 'Units','normalized', ...
0159 'Position',[ 0.18 0.92 0.8 0.06 ], ...
0160 'String','None', ...
0161 'Style','edit', ...
0162 'Enable','on', ...
0163 'BackGroundColor','w', ...
0164 'Tag','in_fname');
0165 align([h_in_fnameB h_in_fname],'VerticalAlignment','center');
0166
0167
0168
0169
0170
0171
0172 h_frame_top = uicontrol(h_fig,...
0173 'Units','normalized', ...
0174 'Position',[ 0 0 .25 0.9 ],...
0175 'Style','frame');
0176 frm_col=get(h_frame_top,'backgroundcolor');
0177
0178
0179
0180 uicontrol(h_fig,...
0181 'Units','normalized', ...
0182 'Position',[ 0.04 0.82 0.18 0.07 ],...
0183 'String','IC Features',...
0184 'FontWeight','bold', ...
0185 'FontSize',14, ...
0186 'HorizontalAlignment','center', ...
0187 'tag','static', ...
0188 'ToolTipString',['Features useful for identifying independent components (ICs) corresponding to artifacts. ', ...
0189 10 'Computed by cmpt_ic_art_ftrs.m.'], ...
0190 'Style','text');
0191
0192
0193 h_blink_topo=uicontrol(h_fig,...
0194 'Units','normalized', ...
0195 'CallBack',['tmp=get(gcf,''userdata''); ',...
0196 ' set(tmp.h_emg_spectra,''value'',0); ', ...
0197 ' set(tmp.h_eog_spectra,''value'',0); ', ...
0198 ' set(tmp.h_mn_std,''value'',0); ', ...
0199 ' set(tmp.h_xtrm_topo,''value'',0); ', ...
0200 ' set(tmp.h_heart_topo,''value'',0); ', ...
0201 ' set(tmp.h_he_topo,''value'',0); ', ...
0202 ' set(tmp.h_blink_topo,''value'',1); ', ...
0203 ' set_ic_ftr_thresh(''new feature'');'], ...
0204 'Position',[ 0.01 0.78 0.24 0.06 ], ...
0205 'String','Blink Topo', ...
0206 'Style','radiobutton', ...
0207 'Value',0, ...
0208 'FontSize',12, ...
0209 'enable','off', ...
0210 'ToolTipString','Similarity to prototypical blink topography', ...
0211 'HorizontalAlignment','left', ...
0212 'tag','blink_topo');
0213
0214
0215 h_he_topo=uicontrol(h_fig,...
0216 'Units','normalized', ...
0217 'CallBack',['tmp=get(gcf,''userdata''); ',...
0218 ' set(tmp.h_emg_spectra,''value'',0); ', ...
0219 ' set(tmp.h_eog_spectra,''value'',0); ', ...
0220 ' set(tmp.h_mn_std,''value'',0); ', ...
0221 ' set(tmp.h_xtrm_topo,''value'',0); ', ...
0222 ' set(tmp.h_heart_topo,''value'',0); ', ...
0223 ' set(tmp.h_he_topo,''value'',1); ', ...
0224 ' set(tmp.h_blink_topo,''value'',0); ', ...
0225 ' set_ic_ftr_thresh(''new feature'');'], ...
0226 'Position',[ 0.01 0.72 0.24 0.06 ], ...
0227 'String','Horz EOG Topo', ...
0228 'Style','radiobutton', ...
0229 'FontSize',12, ...
0230 'Value',0, ...
0231 'enable','off', ...
0232 'ToolTipString','Similarity to prototypical horizontal eye movement topography', ...
0233 'HorizontalAlignment','left', ...
0234 'tag','he_topo');
0235
0236
0237 h_heart_topo=uicontrol(h_fig,...
0238 'Units','normalized', ...
0239 'CallBack',['tmp=get(gcf,''userdata''); ',...
0240 ' set(tmp.h_emg_spectra,''value'',0); ', ...
0241 ' set(tmp.h_eog_spectra,''value'',0); ', ...
0242 ' set(tmp.h_mn_std,''value'',0); ', ...
0243 ' set(tmp.h_xtrm_topo,''value'',0); ', ...
0244 ' set(tmp.h_heart_topo,''value'',1); ', ...
0245 ' set(tmp.h_he_topo,''value'',0); ', ...
0246 ' set(tmp.h_blink_topo,''value'',0); ', ...
0247 ' set_ic_ftr_thresh(''new feature'');'], ...
0248 'Position',[ 0.01 0.66 0.24 0.06 ], ...
0249 'String','Heart Topo', ...
0250 'Style','radiobutton', ...
0251 'Value',0, ...
0252 'FontSize',12, ...
0253 'enable','off', ...
0254 'ToolTipString','Similarity to prototypical heart artifact topography', ...
0255 'HorizontalAlignment','left', ...
0256 'tag','heart_topo');
0257
0258
0259 h_xtrm_topo=uicontrol(h_fig,...
0260 'Units','normalized', ...
0261 'CallBack',['tmp=get(gcf,''userdata''); ',...
0262 ' set(tmp.h_emg_spectra,''value'',0); ', ...
0263 ' set(tmp.h_eog_spectra,''value'',0); ', ...
0264 ' set(tmp.h_mn_std,''value'',0); ', ...
0265 ' set(tmp.h_xtrm_topo,''value'',1); ', ...
0266 ' set(tmp.h_heart_topo,''value'',0); ', ...
0267 ' set(tmp.h_he_topo,''value'',0); ', ...
0268 ' set(tmp.h_blink_topo,''value'',0); ', ...
0269 ' set_ic_ftr_thresh(''new feature'');'], ...
0270 'Position',[ 0.01 0.6 0.24 0.06 ], ...
0271 'String','Extrm Topo Wt', ...
0272 'Style','radiobutton', ...
0273 'Value',0, ...
0274 'enable','off', ...
0275 'FontSize',12, ...
0276 'ToolTipString','Maximum proportion of topography length accounted for by a single channel', ...
0277 'HorizontalAlignment','left', ...
0278 'tag','heart_topo');
0279
0280
0281 h_emg_spectra=uicontrol(h_fig,...
0282 'Units','normalized', ...
0283 'CallBack',['tmp=get(gcf,''userdata''); ',...
0284 ' set(tmp.h_emg_spectra,''value'',1); ', ...
0285 ' set(tmp.h_eog_spectra,''value'',0); ', ...
0286 ' set(tmp.h_mn_std,''value'',0); ', ...
0287 ' set(tmp.h_xtrm_topo,''value'',0); ', ...
0288 ' set(tmp.h_heart_topo,''value'',0); ', ...
0289 ' set(tmp.h_he_topo,''value'',0); ', ...
0290 ' set(tmp.h_blink_topo,''value'',0); ', ...
0291 ' set_ic_ftr_thresh(''new feature'');'], ...
0292 'Position',[ 0.01 0.54 0.24 0.06 ], ...
0293 'String','EMG Spectra', ...
0294 'Style','radiobutton', ...
0295 'Value',0, ...
0296 'FontSize',12, ...
0297 'enable','off', ...
0298 'ToolTipString','Activation spectra similar to that produced by EMG', ...
0299 'HorizontalAlignment','left', ...
0300 'tag','emg_spectra');
0301
0302
0303 h_eog_spectra=uicontrol(h_fig,...
0304 'Units','normalized', ...
0305 'CallBack',['tmp=get(gcf,''userdata''); ',...
0306 ' set(tmp.h_emg_spectra,''value'',0); ', ...
0307 ' set(tmp.h_eog_spectra,''value'',1); ', ...
0308 ' set(tmp.h_mn_std,''value'',0); ', ...
0309 ' set(tmp.h_xtrm_topo,''value'',0); ', ...
0310 ' set(tmp.h_heart_topo,''value'',0); ', ...
0311 ' set(tmp.h_he_topo,''value'',0); ', ...
0312 ' set(tmp.h_blink_topo,''value'',0); ', ...
0313 ' set_ic_ftr_thresh(''new feature'');'], ...
0314 'Position',[ 0.01 0.48 0.24 0.06 ], ...
0315 'String','EOG Spectra', ...
0316 'Style','radiobutton', ...
0317 'Value',0, ...
0318 'FontSize',12, ...
0319 'enable','off', ...
0320 'ToolTipString','Activation spectra similar to that produced by EOG', ...
0321 'HorizontalAlignment','left', ...
0322 'tag','eog_spectra');
0323
0324
0325 h_mn_std=uicontrol(h_fig,...
0326 'Units','normalized', ...
0327 'CallBack',['tmp=get(gcf,''userdata''); ',...
0328 ' set(tmp.h_emg_spectra,''value'',0); ', ...
0329 ' set(tmp.h_eog_spectra,''value'',0); ', ...
0330 ' set(tmp.h_mn_std,''value'',1); ', ...
0331 ' set(tmp.h_xtrm_topo,''value'',0); ', ...
0332 ' set(tmp.h_heart_topo,''value'',0); ', ...
0333 ' set(tmp.h_he_topo,''value'',0); ', ...
0334 ' set(tmp.h_blink_topo,''value'',0); ', ...
0335 ' set_ic_ftr_thresh(''new feature'');'], ...
0336 'Position',[ 0.01 0.42 0.24 0.06 ], ...
0337 'String','Act Std Dev', ...
0338 'Style','radiobutton', ...
0339 'Value',0, ...
0340 'FontSize',12, ...
0341 'enable','off', ...
0342 'ToolTipString','Standard deviation of activation averaged across all time points', ...
0343 'HorizontalAlignment','left', ...
0344 'tag','mn_std');
0345
0346
0347
0348 uicontrol(h_fig,...
0349 'Units','normalized', ...
0350 'Position',[ 0.033 0.32 0.20 0.1 ],...
0351 'String','Current Threshold',...
0352 'Style','text', ...
0353 'FontWeight','bold', ...
0354 'FontSize',14, ...
0355 'tag','static', ...
0356 'ToolTipString',['ICs with feature values above this threshold will be labeled as artifacts.', ...
0357 10 'NaN stands for "not a number" and means that this feature is ignored.'], ...
0358 'HorizontalAlignment','center');
0359 h_thresh=uicontrol(h_fig,...
0360 'CallBack','set_ic_ftr_thresh(''new threshold'');',...
0361 'Units','normalized', ...
0362 'Position',[ 0.048 0.26 0.17 0.07 ],...
0363 'String','NaN',...
0364 'Style','edit', ...
0365 'FontSize',12, ...
0366 'enable','off', ...
0367 'backgroundcolor','w', ...
0368 'horizontalalignment','center', ...
0369 'tag','thresh');
0370
0371
0372
0373 h_save=uicontrol(h_fig,...
0374 'CallBack','set_ic_ftr_thresh(''save changes'');',...
0375 'Units','normalized', ...
0376 'Position',[ 0.048 0.17 0.17 0.08],...
0377 'String','Save',...
0378 'Tag','save', ...
0379 'FontSize',14, ...
0380 'enable','off', ...
0381 'ToolTipString','Save changes to EEG variable.', ...
0382 'horizontalalignment','center', ...
0383 'Style','pushbutton');
0384
0385 help_msg=sprintf(['This GUI allows you to interactively set IC rejection thresholds. The current feature''s threshold is represented with the red dashed line. ', ...
0386 'Any ICs with features that fall in the rejection region (shaded in red) will be represented by red asterisks and rejected.', ...
0387 ' Magenta circles are ICs that are labelled as artifacts due to other features/', ...
0388 'thresholds or manual labels. Blue circles are ICs that won''t be rejected.\n\n', ...
0389 'Hold mouse cursor over a GUI control for an explanation of what it does or what the feature is.\n\n', ...
0390 'Click on circles or asterisks to see the properties of that IC.\n\n', ...
0391 'Type ''help set_ic_ftr_thresh'' for more information about what IC artifact features are.\n\n' ...
0392 'See the ICA_Artifact_Correction page of the lab wiki for further help.\n\n', ...
0393 'This GUI was produced by set_ic_ftr_thresh.m']);
0394
0395
0396 h_help=uicontrol(h_fig,...
0397 'CallBack','dat=get(gcf,''userdata''); helpdlg(dat.help_msg,''set_ic_ftr_thresh GUI Help'');', ...
0398 'Units','normalized', ...
0399 'Position',[ 0.048 0.09 0.17 0.08],...
0400 'String','Help',...
0401 'Tag','help', ...
0402 'FontSize',14, ...
0403 'enable','on', ...
0404 'ToolTipString','GUI information and figure legend.', ...
0405 'horizontalalignment','center', ...
0406 'Style','pushbutton');
0407
0408
0409
0410
0411 uicontrol(h_fig,...
0412 'CallBack','close(gcf);',...
0413 'Units','normalized', ...
0414 'Position',[ 0.048 0.01 0.17 0.07 ],...
0415 'String','Close',...
0416 'Tag','close', ...
0417 'FontSize',14, ...
0418 'ToolTipString','Close GUI', ...
0419 'horizontalalignment','center', ...
0420 'backgroundcolor','m', ...
0421 'Style','pushbutton');
0422
0423
0424
0425
0426
0427
0428
0429 h_panel_right=uipanel(h_fig,...
0430 'Units','normalized', ...
0431 'Position',[ 0.25 0 0.75 0.9 ],...
0432 'shadowcolor','k', ...
0433 'highlightcolor',frm_col, ...
0434 'foregroundcolor',frm_col, ...
0435 'backgroundcolor',frm_col);
0436
0437
0438
0439 h_axis=axes('position',[0.35 .1 .63 .78],'box','off');
0440 n_ics=64;
0441 h_xlab=xlabel('IC #');
0442 set(h_xlab,'fontsize',12,'fontweight','bold');
0443 h_ylab=ylabel('IC Feature');
0444 set(h_ylab,'fontsize',12,'fontweight','bold');
0445 axis([0 n_ics+1 0 1]);
0446 set(h_axis,'xtick',[1 [5:5:n_ics]]);
0447 h_txt=text(32,.5,'Data not yet loaded.');
0448 set(h_txt,'fontsize',12,'horizontalalignment','center');
0449
0450
0451
0452
0453 tmp.h_axis=h_axis;
0454 tmp.h_thresh=h_thresh;
0455 tmp.h_mn_std=h_mn_std;
0456 tmp.h_eog_spectra=h_eog_spectra;
0457 tmp.h_emg_spectra=h_emg_spectra;
0458 tmp.h_xtrm_topo=h_xtrm_topo;
0459 tmp.h_heart_topo=h_heart_topo;
0460 tmp.h_he_topo=h_he_topo;
0461 tmp.h_blink_topo=h_blink_topo;
0462 tmp.h_in_fname=h_in_fname;
0463 tmp.h_in_fnameB=h_in_fnameB;
0464 tmp.h_save=h_save;
0465 tmp.h_help=h_help;
0466 tmp.help_msg=help_msg;
0467 set(h_fig,'userdata',tmp);
0468
0469 if ~isempty(EEG),
0470 set_ic_ftr_thresh('refresh');
0471 end
0472
0473 elseif strcmpi('refresh',command_str),
0474 tmp=get(h_fig,'userdata');
0475
0476
0477 if isempty(EEG)
0478 set_ic_ftr_thresh('disable');
0479 err=lasterror;
0480 errordlg(err.message,'The global variable EEG is empty. You need to load a data set.','on');
0481 return;
0482 end
0483
0484
0485 set(tmp.h_in_fname,'string',[EEG.filepath EEG.filename]);
0486
0487
0488 EEG=cmpt_ic_art_ftrs(EEG);
0489
0490
0491 thresh_names{1}='thresh_blink_topo';
0492 thresh_names{2}='thresh_heart_topo';
0493 thresh_names{3}='thresh_he_topo';
0494 thresh_names{4}='thresh_ic_emg_spectra';
0495 thresh_names{5}='thresh_ic_xtrm_chan';
0496 thresh_names{6}='thresh_ic_mn_std';
0497 thresh_names{7}='thresh_ic_eog_spectra';
0498 fldnms=fieldnames(EEG.reject);
0499 for tn=1:length(thresh_names),
0500 fnd=0;
0501 for fn=1:length(fldnms),
0502 if strcmpi(fldnms{fn},thresh_names{tn}),
0503 fnd=1;
0504 break;
0505 end
0506 end
0507 if ~fnd,
0508 cmd=['EEG.reject.' thresh_names{tn} '=NaN;'];
0509 eval(cmd);
0510 end
0511 end
0512
0513
0514
0515 set(tmp.h_emg_spectra,'enable','on','value',0);
0516 set(tmp.h_eog_spectra,'enable','on','value',0);
0517 set(tmp.h_mn_std,'enable','on','value',0);
0518 set(tmp.h_xtrm_topo,'enable','on','value',0);
0519 set(tmp.h_heart_topo,'enable','on','value',0);
0520 set(tmp.h_he_topo,'enable','on','value',0);
0521 set(tmp.h_blink_topo,'enable','on','value',1);
0522 set(tmp.h_thresh,'enable','on');
0523 verblevel=VERBLEVEL;
0524 EEG=reject_ics_by_ftr(EEG);
0525 VERBLEVEL=verblevel;
0526 set_ic_ftr_thresh('new feature');
0527
0528
0529 elseif strcmpi('load data',command_str),
0530 tmp=get(h_fig,'userdata');
0531
0532
0533 try
0534 in_fname=get(tmp.h_in_fname,'string');
0535 fprintf('Loading EEG variable from %s.\n',in_fname);
0536 EEG=pop_loadset(in_fname);
0537 catch
0538 set_ic_ftr_thresh('disable');
0539 err=lasterror;
0540 errordlg(err.message,'Input File Error','on');
0541 return;
0542 end
0543
0544
0545 EEG=cmpt_ic_art_ftrs(EEG);
0546
0547
0548 thresh_names{1}='thresh_blink_topo';
0549 thresh_names{2}='thresh_heart_topo';
0550 thresh_names{3}='thresh_he_topo';
0551 thresh_names{4}='thresh_ic_emg_spectra';
0552 thresh_names{5}='thresh_ic_xtrm_chan';
0553 thresh_names{6}='thresh_ic_mn_std';
0554 thresh_names{7}='thresh_ic_eog_spectra';
0555 fldnms=fieldnames(EEG.reject);
0556 for tn=1:length(thresh_names),
0557 fnd=0;
0558 for fn=1:length(fldnms),
0559 if strcmpi(fldnms{fn},thresh_names{tn}),
0560 fnd=1;
0561 break;
0562 end
0563 end
0564 if ~fnd,
0565 cmd=['EEG.reject.' thresh_names{tn} '=NaN;'];
0566 eval(cmd);
0567 end
0568 end
0569
0570
0571
0572 set(tmp.h_emg_spectra,'enable','on','value',0);
0573 set(tmp.h_eog_spectra,'enable','on','value',0);
0574 set(tmp.h_mn_std,'enable','on','value',0);
0575 set(tmp.h_xtrm_topo,'enable','on','value',0);
0576 set(tmp.h_heart_topo,'enable','on','value',0);
0577 set(tmp.h_he_topo,'enable','on','value',0);
0578 set(tmp.h_blink_topo,'enable','on','value',1);
0579 set(tmp.h_thresh,'enable','on');
0580 verblevel=VERBLEVEL;
0581 EEG=reject_ics_by_ftr(EEG);
0582 VERBLEVEL=verblevel;
0583 set_ic_ftr_thresh('new feature');
0584
0585 elseif strcmpi('new feature',command_str),
0586 tmp=get(h_fig,'userdata');
0587 cla(tmp.h_axis);
0588 n_ics=length(EEG.icfeatures);
0589 ftr=zeros(1,n_ics);
0590
0591
0592 if get(tmp.h_blink_topo,'value'),
0593 ftr_str='blink_topo';
0594 thresh_str='blink_topo';
0595 ylab='Blink-like Topography';
0596 iclabel='Blink (objective)';
0597 elseif get(tmp.h_he_topo,'value'),
0598 ftr_str='he_topo';
0599 thresh_str='he_topo';
0600 ylab='Horizontal EOG-like Topography';
0601 iclabel='HE (objective)';
0602 elseif get(tmp.h_heart_topo,'value'),
0603 ftr_str='heart_topo';
0604 thresh_str='heart_topo';
0605 ylab='Heart-like Topography';
0606 iclabel='Heart (objective)';
0607 elseif get(tmp.h_xtrm_topo,'value'),
0608 ftr_str='xtrm_chan';
0609 thresh_str='ic_xtrm_chan';
0610 ylab='Extreme Topography Weight';
0611 iclabel='Bad_chan (objective)';
0612 elseif get(tmp.h_emg_spectra,'value'),
0613 ftr_str='emg_spectra';
0614 thresh_str='ic_emg_spectra';
0615 ylab='EMG-like Spectra';
0616 iclabel='EMG (objective)';
0617 elseif get(tmp.h_eog_spectra,'value'),
0618 ftr_str='eog_spectra';
0619 thresh_str='ic_eog_spectra';
0620 ylab='EOG-like Spectra';
0621 iclabel='EOG (objective)';
0622 else
0623 ftr_str='mn_std';
0624 thresh_str='ic_mn_std';
0625 ylab='Activation Standard Deviation/Time Point';
0626 iclabel='Xtrm_activity (objective)';
0627 end
0628
0629 cmnd=['thresh=EEG.reject.thresh_' thresh_str ';'];
0630 eval(cmnd);
0631 rej=zeros(1,n_ics);
0632 for c=1:n_ics,
0633 cmnd=['ftr(c)=EEG.icfeatures(' int2str(c) ').' ftr_str ';'];
0634 eval(cmnd);
0635 if ftr(c)>thresh,
0636 rej(c)=1;
0637 end
0638 end
0639 set(tmp.h_thresh,'string',num2str(thresh));
0640
0641 yes_rej=find(rej==1);
0642 other_rej=setdiff(find(EEG.reject.gcompreject==1),yes_rej);
0643 no_rej=setdiff(find(rej==0),other_rej);
0644 axes(tmp.h_axis);
0645
0646
0647 mx=max([ftr thresh]);
0648 mn=min([ftr thresh]);
0649 ftr_pad=(mx-mn)*.1;
0650 axis([0 n_ics+1 mn-ftr_pad mx+ftr_pad]);
0651 hh=patch([0 n_ics+1 n_ics+1 0],[thresh thresh mx+ftr_pad mx+ftr_pad],'r');
0652 set(hh,'FaceAlpha',.5,'linestyle','--','edgecolor','r');
0653 hold on;
0654 for c=1:n_ics,
0655 if ismember(c,no_rej),
0656 h=plot(c,ftr(c),'o');
0657 set(h,'buttondownfcn',['ic_prop(' int2str(c) ',''from_set_ic_ftr_thresh'',1);']);
0658 elseif ismember(c,yes_rej),
0659 h=plot(c,ftr(c),'r*');
0660 set(h,'buttondownfcn',['ic_prop(' int2str(c) ',''from_set_ic_ftr_thresh'',1);']);
0661 elseif ismember(c,other_rej),
0662 h=plot(c,ftr(c),'mo');
0663 set(h,'buttondownfcn',['ic_prop(' int2str(c) ',''from_set_ic_ftr_thresh'',1);']);
0664 end
0665 end
0666 EEG.reject.gcompreject(yes_rej)=1;
0667 h_xlab=xlabel('IC #');
0668 set(h_xlab,'fontsize',12,'fontweight','bold');
0669 h_ylab=ylabel(ylab);
0670 set(h_ylab,'fontsize',12,'fontweight','bold');
0671
0672
0673
0674
0675
0676
0677 set(tmp.h_axis,'xtick',[1 [5:5:n_ics]]);
0678
0679 if ~strcmpi(EEG.saved,'yes'),
0680 set(tmp.h_save,'enable','on');
0681 end
0682
0683 elseif strcmpi('new threshold',command_str),
0684 tmp=get(h_fig,'userdata');
0685
0686
0687 if get(tmp.h_blink_topo,'value'),
0688 thresh_str='blink_topo';
0689 elseif get(tmp.h_he_topo,'value'),
0690 thresh_str='he_topo';
0691 elseif get(tmp.h_heart_topo,'value'),
0692 thresh_str='heart_topo';
0693 elseif get(tmp.h_xtrm_topo,'value'),
0694 thresh_str='ic_xtrm_chan';
0695 elseif get(tmp.h_emg_spectra,'value'),
0696 thresh_str='ic_emg_spectra';
0697 elseif get(tmp.h_eog_spectra,'value'),
0698 thresh_str='ic_eog_spectra';
0699 else
0700 thresh_str='ic_mn_std';
0701 end
0702
0703 new_val=str2num(get(tmp.h_thresh,'string'));
0704 cmnd=['EEG.reject.thresh_' thresh_str '=' num2str(new_val) ';'];
0705 eval(cmnd);
0706 EEG.saved='no';
0707 set(tmp.h_save,'enable','on');
0708 set(tmp.h_thresh,'string',num2str(new_val));
0709 verblevel=VERBLEVEL;
0710 EEG=reject_ics_by_ftr(EEG,0);
0711 VERBLEVEL=verblevel;
0712 set_ic_ftr_thresh('new feature');
0713 elseif strcmpi('save changes',command_str),
0714 tmp=get(h_fig,'userdata');
0715 try
0716 pop_saveset(EEG,'filename',EEG.filename,'filepath',EEG.filepath);
0717 catch
0718 err=lasterror;
0719 errordlg(err.message,'File Save Error','on');
0720 return;
0721 end
0722 set(tmp.h_save,'enable','off');
0723 elseif strcmpi('disable',command_str),
0724 tmp=get(h_fig,'userdata');
0725
0726
0727 for a=get(h_fig,'children')',
0728 f=fieldnames(set(a));
0729 for b=1:length(f),
0730 if strcmpi(f{b},'Callback') && ~strcmpi('close',get(a,'Tag')) && ...
0731 ~strcmpi('help',get(a,'Tag')) && ~strcmpi('static',get(a,'Tag'))
0732
0733
0734
0735 set(a,'enable','off');
0736 break;
0737 end
0738 end
0739 end
0740
0741 set(tmp.h_in_fname,'enable','on');
0742 set(tmp.h_in_fnameB,'enable','on');
0743
0744
0745
0746 set(tmp.h_emg_spectra,'enable','off','value',0);
0747 set(tmp.h_eog_spectra,'enable','off','value',0);
0748 set(tmp.h_mn_std,'enable','off','value',0);
0749 set(tmp.h_xtrm_topo,'enable','off','value',0);
0750 set(tmp.h_heart_topo,'enable','off','value',0);
0751 set(tmp.h_he_topo,'enable','off','value',0);
0752 set(tmp.h_blink_topo,'enable','off','value',0);
0753 set(tmp.h_thresh,'enable','off','string','NaN');
0754
0755
0756 n_ics=64;
0757 axes(tmp.h_axis);
0758 cla;
0759 h_ylab=ylabel('IC Feature');
0760 set(h_ylab,'fontsize',12,'fontweight','bold');
0761 axis([0 n_ics+1 0 1]);
0762 set(tmp.h_axis,'xtick',[1 [5:5:n_ics]]);
0763 h_txt=text(32,.5,'Data not yet loaded.');
0764 set(h_txt,'fontsize',12,'horizontalalignment','center');
0765 end
0766