|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| function [EEG,com] = pop_selectcomps_ADJ( EEG, compnum, art, horiz, vert, blink, disc,...
|
| soglia_DV, diff_var, soglia_K, med2_K, meanK, soglia_SED, med2_SED, SED, soglia_SAD, med2_SAD, SAD, ...
|
| soglia_GDSF, med2_GDSF, GDSF, soglia_V, med2_V, maxvar, soglia_D, maxdin, fig )
|
|
|
| COLREJ = '[1 0.6 0.6]';
|
| COLACC = '[0.75 1 0.75]';
|
| COLART = '[1 0 0]';
|
| PLOTPERFIG = 35;
|
|
|
| com = '';
|
| if nargin < 1
|
| help pop_selectcomps_ADJ;
|
| return;
|
| end;
|
|
|
| if nargin < 2
|
| promptstr = { 'Components to plot:' };
|
| initstr = { [ '1:' int2str(size(EEG.icaweights,1)) ] };
|
|
|
| result = inputdlg2(promptstr, 'Reject comp. by map -- pop_selectcomps',1, initstr);
|
| if isempty(result), return; end;
|
| compnum = eval( [ '[' result{1} ']' ]);
|
|
|
| if length(compnum) > PLOTPERFIG
|
| ButtonName=questdlg2(strvcat(['More than ' int2str(PLOTPERFIG) ' components so'],'this function will pop-up several windows'), ...
|
| 'Confirmation', 'Cancel', 'OK','OK');
|
| if ~isempty( strmatch(lower(ButtonName), 'cancel')), return; end;
|
| end;
|
|
|
| end;
|
|
|
| currentfigtag = ['selcomp' num2str(rand)];
|
|
|
| if length(compnum) > PLOTPERFIG
|
| for index = 1:PLOTPERFIG:length(compnum)
|
| fprintf('Drawing figure...\n');
|
| EEG = pop_selectcomps_ADJ(EEG, compnum([index:min(length(compnum),index+PLOTPERFIG-1)]), art, horiz, vert, blink, disc,...
|
| soglia_DV, diff_var, soglia_K, med2_K, meanK, soglia_SED, med2_SED, SED, soglia_SAD, med2_SAD, SAD, ...
|
| soglia_GDSF, med2_GDSF, GDSF, soglia_V, med2_V, maxvar, soglia_D, maxdin);
|
| end;
|
|
|
| com = [ 'pop_selectcomps(' inputname(1) ', ' vararg2str(compnum) ');' ];
|
| return;
|
| end;
|
|
|
| if isempty(EEG.reject.gcompreject)
|
| EEG.reject.gcompreject = zeros( size(EEG.icawinv,2));
|
| end;
|
| try, icadefs;
|
| catch,
|
| BACKCOLOR = [0.8 0.8 0.8];
|
| GUIBUTTONCOLOR = [0.8 0.8 0.8];
|
| end;
|
|
|
|
|
|
|
| column =ceil(sqrt( length(compnum) ))+1;
|
| rows = ceil(length(compnum)/column);
|
| if ~exist('fig')
|
| figure('name', [ 'Reject components by map - pop_selectcomps_ADJ() (dataset: ' EEG.setname ')'], 'tag', currentfigtag, ...
|
| 'numbertitle', 'off', 'color', BACKCOLOR);
|
| set(gcf,'MenuBar', 'none');
|
| pos = get(gcf,'Position');
|
| set(gcf,'Position', [pos(1) 20 800/7*column 600/5*rows]);
|
| incx = 120;
|
| incy = 110;
|
| sizewx = 100/column;
|
| if rows > 2
|
| sizewy = 90/rows;
|
| else
|
| sizewy = 80/rows;
|
| end;
|
| pos = get(gca,'position');
|
| hh = gca;
|
| q = [pos(1) pos(2) 0 0];
|
| s = [pos(3) pos(4) pos(3) pos(4)]./100;
|
| axis off;
|
| end;
|
|
|
|
|
|
|
| if EEG.nbchan > 64
|
| disp('More than 64 electrodes: electrode locations not shown');
|
| plotelec = 0;
|
| else
|
| plotelec = 1;
|
| end;
|
| count = 1;
|
| for ri = compnum
|
| if exist('fig')
|
| button = findobj('parent', fig, 'tag', ['comp' num2str(ri)]);
|
| if isempty(button)
|
| error( 'pop_selectcomps_ADJ(): figure does not contain the component button');
|
| end;
|
| else
|
| button = [];
|
| end;
|
|
|
| if isempty( button )
|
|
|
|
|
| X = mod(count-1, column)/column * incx-10;
|
| Y = (rows-floor((count-1)/column))/rows * incy - sizewy*1.3;
|
|
|
|
|
|
|
| if ~strcmp(get(gcf, 'tag'), currentfigtag);
|
| disp('Aborting plot');
|
| return;
|
| end;
|
| ha = axes('Units','Normalized', 'Position',[X Y sizewx sizewy].*s+q);
|
| if plotelec
|
| topoplot( EEG.icawinv(:,ri), EEG.chanlocs, 'verbose', ...
|
| 'off', 'style' , 'fill', 'chaninfo', EEG.chaninfo);
|
| else
|
| topoplot( EEG.icawinv(:,ri), EEG.chanlocs, 'verbose', ...
|
| 'off', 'style' , 'fill','electrodes','off', 'chaninfo', EEG.chaninfo);
|
| end;
|
| axis square;
|
|
|
|
|
|
|
| button = double(uicontrol(gcf, 'Style', 'pushbutton', 'Units','Normalized', 'Position',...
|
| [X Y+sizewy sizewx sizewy*0.25].*s+q, 'tag', ['comp' num2str(ri)]));
|
| command = sprintf('pop_prop_ADJ( %s, 0, %d, %3.15f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f);', ...
|
| inputname(1), ri, button, ...
|
| ~isempty(intersect(horiz,ri)), ~isempty(intersect(vert,ri)), ~isempty(intersect(blink,ri)), ~isempty(intersect(disc,ri)),...
|
| soglia_DV, diff_var(ri), soglia_K, med2_K, meanK(ri), soglia_SED, med2_SED, SED(ri),...
|
| soglia_SAD, med2_SAD, SAD(ri), soglia_GDSF, med2_GDSF, GDSF(ri), soglia_V, med2_V, maxvar(ri), soglia_D, maxdin(ri));
|
| set( button, 'callback', command );
|
| end;
|
|
|
|
|
| if isempty( intersect(art,ri))
|
| set( button, 'backgroundcolor', eval(fastif(EEG.reject.gcompreject(ri), COLREJ,COLACC)), 'string', int2str(ri));
|
| else set( button, 'backgroundcolor', eval(fastif(EEG.reject.gcompreject(ri), COLREJ,COLART)), 'string', int2str(ri));
|
| end
|
|
|
| drawnow;
|
| count = count +1;
|
| end;
|
|
|
|
|
|
|
| if ~exist('fig')
|
| hh = uicontrol(gcf, 'Style', 'pushbutton', 'string', 'Cancel', 'Units','Normalized', 'backgroundcolor', GUIBUTTONCOLOR, ...
|
| 'Position',[-10 -10 15 sizewy*0.25].*s+q, 'callback', 'close(gcf); fprintf(''Operation cancelled\n'')' );
|
| hh = uicontrol(gcf, 'Style', 'pushbutton', 'string', 'Set threhsolds', 'Units','Normalized', 'backgroundcolor', GUIBUTTONCOLOR, ...
|
| 'Position',[10 -10 15 sizewy*0.25].*s+q, 'callback', 'pop_icathresh(EEG); pop_selectcomps( EEG, gcbf);' );
|
| if isempty( EEG.stats.compenta ), set(hh, 'enable', 'off'); end;
|
| hh = uicontrol(gcf, 'Style', 'pushbutton', 'string', 'See comp. stats', 'Units','Normalized', 'backgroundcolor', GUIBUTTONCOLOR, ...
|
| 'Position',[30 -10 15 sizewy*0.25].*s+q, 'callback', ' ' );
|
| if isempty( EEG.stats.compenta ), set(hh, 'enable', 'off'); end;
|
| hh = uicontrol(gcf, 'Style', 'pushbutton', 'string', 'See projection', 'Units','Normalized', 'backgroundcolor', GUIBUTTONCOLOR, ...
|
| 'Position',[50 -10 15 sizewy*0.25].*s+q, 'callback', ' ', 'enable', 'off' );
|
| hh = uicontrol(gcf, 'Style', 'pushbutton', 'string', 'Help', 'Units','Normalized', 'backgroundcolor', GUIBUTTONCOLOR, ...
|
| 'Position',[70 -10 15 sizewy*0.25].*s+q, 'callback', 'pophelp(''pop_selectcomps'');' );
|
| command = '[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET); eegh(''[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);''); close(gcf)';
|
|
|
|
|
|
|
| hh = uicontrol(gcf, 'Style', 'pushbutton', 'string', 'OK', 'Units','Normalized', 'backgroundcolor', GUIBUTTONCOLOR, ...
|
| 'Position',[90 -10 15 sizewy*0.25].*s+q, 'callback', command);
|
|
|
|
|
| end;
|
|
|
| com = [ 'pop_selectcomps(' inputname(1) ', ' vararg2str(compnum) ');' ];
|
| return;
|
|
|