📄 gui_eeg_contours.m
字号:
function [G,p] = gui_eeg_contours(p,parent)
% GUI_EEG_CONTOURS - GUI controls for topographic mapping of scalp potentials
%
% Paint Graphical user interface (GUI) for eeg_contour_engine.m
%
% $Revision: 1.3 $ $Date: 2003/04/07 06:12:02 $
% Licence: GNU GPL, no express or implied warranties
% History: 09/99 Chris Harvey, initial development
% diagnostics, optional plots, interactive timepoint selection
% 07/01 Darren.Weber@flinders.edu.au
% completely revised. Significant improvement to GUI painting
% and general parameter handling and callback functions. Added
% various functionality to take advantage of better engines.
%
% Depends: eeg_contours.m
% eeg_colormap.m, ColorMapsShow.m, ColorMapsMake.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% initial values.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if ~exist('p','var'),
% Default parameters
p = eeg_toolbox_defaults('create');
elseif isempty(p),
p = eeg_toolbox_defaults('create');
end
EEGCONTOURS.p = p;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Paint the GUI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GUI General Parameters
version = ' [alpha 1.0]';
GUIwidth = 550;
GUIheight = 500;
GUI = figure('Name',strcat('EEG Contours ',version),'Tag','EEG_Contours',...
'NumberTitle','off','HandleVisibility','callback',...
'MenuBar','none');
set(GUI,'Position',[1 1 GUIwidth GUIheight]); % Activate GUI Figure
movegui(GUI,'center');
filewidth = .70; %Normalized GUI units
frameindent = .01;
frameheight = .06;
framewidth = .98;
titlewidth = .20;
textheight = .04;
textwidth = .10;
editheight = textheight;
editwidth = textwidth;
boxheight = .05;
boxwidth = textwidth + .02;
radioheight = textheight;
radiowidth = .22;
popupheight = textheight;
popupwidth = .25;
sliderheight = textheight;
sliderwidth = .35;
Font.FontName = 'Helvetica';
Font.FontUnits = 'Pixels';
Font.FontSize = 12;
Font.FontWeight = 'normal';
Font.FontAngle = 'normal';
indent = [frameindent .25 .50 .75 .85];
L = [.01 .06 .11 .16 .21 .26 .31 .36 .41];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Electrode File Selection
% Cartesian or Spherical Coordinates? Units of measurement: cm or m?
height = .99 - frameheight*4;
G.Frame_elec = uicontrol('Tag','Frame_elec','Parent',GUI,'Style','frame',...
'Units','Normalized','Position',[frameindent height framewidth frameheight*4]);
G.Title_elec = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized',Font, ...
'Position',[frameindent*2 height+L(4) titlewidth textheight],...
'String','Electrode File','HorizontalAlignment','left',...
'BackgroundColor',[0.0 0.0 0.75],'ForegroundColor', [1 1 1],...
'Callback',strcat('EEGCONTOURS = get(gcbf,''UserData'');',...
'gui_elec_open(EEGCONTOURS.p,''init'',EEGCONTOURS.gui);',...
'clear EEGCONTOURS;'));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Surface Interpolation
G.Title_gridMethod = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
'Position',[frameindent*2 height+L(2) titlewidth textheight*2],...
'String','Surface Interpolation','HorizontalAlignment','left');
switch p.elec.shape
case 'sphere', shape = 1; % spherical fitting
case 'ellipse', shape = 2; % elliptical fitting
case 'realistic', shape = 3; % no fitting, use real locations
otherwise, shape = 3;
end
G.PelecShape = uicontrol('Tag','PelecShape','Parent',GUI,'Style','popupmenu',...
'Units','Normalized',Font,...
'TooltipString','Fit ''sphere'' or ''ellipse'' to ''realistic'' electrode positions.',...
'Position',[indent(2) height+L(3)+.005 popupwidth popupheight],...
'String',{'sphere' 'ellipse' 'realistic'},'Value',shape,...
'Callback',strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'EEGCONTOURS.p.elec.shape = popupstr(EEGCONTOURS.handles.PelecShape);',...
'set(EEGCONTOURS.gui,''Userdata'',EEGCONTOURS); clear EEGCONTOURS;'));
switch p.interpMethod
case 'linear', interp = 1;
case 'cubic', interp = 2;
case 'nearest', interp = 3;
case 'v4 or invdist', interp = 4;
end
G.PinterpMethod = uicontrol('Tag','PinterpMethod','Parent',GUI,'Style','popupmenu',...
'Units','Normalized',Font,...
'TooltipString','Matlab ''griddata'' interpolation methods.',...
'Position',[indent(3) height+L(3)+.005 popupwidth popupheight],...
'String',{'linear' 'cubic' 'nearest' 'v4' 'invdist'},'Value',interp,...
'Callback',strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'EEGCONTOURS.p.interpMethod = popupstr(EEGCONTOURS.handles.PinterpMethod);',...
'set(EEGCONTOURS.gui,''Userdata'',EEGCONTOURS); clear EEGCONTOURS;'));
switch p.grid.method
case 1, gridM = [1 0]; gridEnable = {'on', 'off'};
otherwise, gridM = [0 1]; gridEnable = {'off','on' };
end
G.BgridMethod1 = uicontrol('Parent',GUI,'Style','Radiobutton','Units','Normalized', Font, ...
'Position',[indent(2) height+L(2)+.002 .2 textheight], 'String','Grid Size','Value',gridM(1));
G.SgridSize = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', ...
'Position',[indent(3) height+L(2)+.002 sliderwidth boxheight],'Enable',char(gridEnable(1)),...
'Min', p.grid.sizeMin, 'Max', p.grid.sizeMax, 'Value', p.grid.size, 'SliderStep',[0.005 0.05]);
G.EgridSize = uicontrol('Parent',GUI,'Style','edit','Units','Normalized', Font, ...
'Position',[indent(5) height+L(2)+.002 .1 boxheight],'Enable',char(gridEnable(1)),...
'Min', p.grid.sizeMin, 'Max', p.grid.sizeMax, 'Value', p.grid.size, 'String', num2str(p.grid.size));
G.BgridMethod2 = uicontrol('Parent',GUI,'Style','Radiobutton','Units','Normalized', Font, ...
'Position',[indent(2) height+L(1) .2 textheight], 'String','Grid Resolution','Value',gridM(2));
G.SgridRes = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', ...
'Position',[indent(3) height+L(1) sliderwidth boxheight],'Enable',char(gridEnable(2)),...
'Min', p.grid.resMin, 'Max', p.grid.resMax, 'Value', p.grid.res, 'SliderStep',[0.005 0.05]);
G.EgridRes = uicontrol('Parent',GUI,'Style','edit','Units','Normalized', Font, ...
'Position',[indent(5) height+L(1) .1 boxheight],'Enable',char(gridEnable(2)),...
'Min', p.grid.resMin, 'Max', p.grid.resMax, 'Value', p.grid.res, 'String', num2str(p.grid.res));
% Set grid size parameters
set(G.BgridMethod1,'Callback', strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'set(EEGCONTOURS.handles.BgridMethod1,''Value'',1);',...
'set(EEGCONTOURS.handles.BgridMethod2,''Value'',0);',...
'set(EEGCONTOURS.handles.SgridSize,''Enable'',''on'');',...
'set(EEGCONTOURS.handles.EgridSize,''Enable'',''on'');',...
'set(EEGCONTOURS.handles.SgridRes,''Enable'',''off'');',...
'set(EEGCONTOURS.handles.EgridRes,''Enable'',''off''); ',...
'set(EEGCONTOURS.gui,''Userdata'',EEGCONTOURS); clear EEGCONTOURS;'));
set(G.SgridSize,'Callback',...
strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'EEGCONTOURS.p.grid.size = round( get(EEGCONTOURS.handles.SgridSize,''Value'') ); ',...
'set(EEGCONTOURS.handles.EgridSize,''String'', num2str(EEGCONTOURS.p.grid.size),''Value'', EEGCONTOURS.p.grid.size ); ',...
'set(EEGCONTOURS.gui,''Userdata'',EEGCONTOURS); clear EEGCONTOURS;'));
set(G.EgridSize,'Callback',...
strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'EEGCONTOURS.p.grid.size = round( str2num( get(EEGCONTOURS.handles.EgridSize,''String'') ) ); ',...
'set(EEGCONTOURS.handles.EgridSize,''String'', num2str(EEGCONTOURS.p.grid.size),''Value'', EEGCONTOURS.p.grid.size ); ',...
'set(EEGCONTOURS.gui,''Userdata'',EEGCONTOURS); clear EEGCONTOURS;'));
% Set grid resolution parameters
set(G.BgridMethod2,'Callback', strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'set(EEGCONTOURS.handles.BgridMethod1,''Value'',0);',...
'set(EEGCONTOURS.handles.BgridMethod2,''Value'',1);',...
'set(EEGCONTOURS.handles.SgridSize,''Enable'',''off'');',...
'set(EEGCONTOURS.handles.EgridSize,''Enable'',''off'');',...
'set(EEGCONTOURS.handles.SgridRes,''Enable'',''on'');',...
'set(EEGCONTOURS.handles.EgridRes,''Enable'',''on''); ',...
'set(EEGCONTOURS.gui,''Userdata'',EEGCONTOURS); clear EEGCONTOURS;'));
set(G.SgridRes,'Callback',...
strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'EEGCONTOURS.p.grid.res = get(EEGCONTOURS.handles.SgridRes,''Value''); ',...
'set(EEGCONTOURS.handles.EgridRes,''String'', num2str(EEGCONTOURS.p.grid.res),''Value'', EEGCONTOURS.p.grid.res ); ',...
'set(EEGCONTOURS.gui,''Userdata'',EEGCONTOURS); clear EEGCONTOURS;'));
set(G.EgridRes, 'Callback',...
strcat('EEGCONTOURS = get(gcbf,''Userdata'');',...
'EEGCONTOURS.p.grid.res = str2num( get(EEGCONTOURS.handles.EgridRes,''String'') ); ',...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -