0001 function [p] = gui_eeg_contour_steps(parent)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 if exist('parent','var'),
0019 ContourSteps.parent.gui = parent;
0020 ParentUserdata = get(parent,'Userdata');
0021 ContourSteps.p = ParentUserdata.p;
0022 else
0023 error('No parent gui parameter supplied');
0024 end
0025
0026
0027 GUIwidth = 200;
0028 GUIheight = 100;
0029 GUI = figure('Name','Contour Steps','Tag','CONTOURSTEPS',...
0030 'NumberTitle','off','HandleVisibility','callback',...
0031 'MenuBar','none','Position',[1 1 GUIwidth GUIheight]);
0032 movegui(GUI,'center');
0033
0034 ContourSteps.gui = GUI;
0035
0036 Font.FontName = 'Helvetica';
0037 Font.FontUnits = 'Pixels';
0038 Font.FontSize = 12;
0039 Font.FontWeight = 'normal';
0040 Font.FontAngle = 'normal';
0041
0042
0043
0044 switch ContourSteps.p.contour.stepMethod
0045 case 1, step = [0 1];
0046 otherwise, step = [1 0];
0047 end
0048
0049 G.BstepMethod0 = uicontrol('Parent',GUI,'Style','Radiobutton',...
0050 'Units','Normalized',Font,'Position',[.1 .6 .6 .2],...
0051 'String','Step Size','Value',step(1),...
0052 'Callback',strcat('ContourSteps = get(gcbf,''Userdata'');',...
0053 'ContourSteps.p.contour.stepMethod = 0;',...
0054 'set(ContourSteps.handles.BstepMethod0,''Value'',1);',...
0055 'set(ContourSteps.handles.BstepMethod1,''Value'',0);',...
0056 'set(ContourSteps.handles.EstepMethod0,''String'',num2str(ContourSteps.p.contour.stepSize));',...
0057 'set(ContourSteps.gui,''Userdata'',ContourSteps); clear ContourSteps;'));
0058 G.EstepMethod0 = uicontrol('Parent',GUI,'Style','edit',...
0059 'Units','Normalized',Font,'Position',[.7 .6 .2 .2],...
0060 'String',num2str(ContourSteps.p.contour.stepSize),...
0061 'Callback',strcat('ContourSteps = get(gcbf,''Userdata'');',...
0062 'ContourSteps.p.contour.stepSize = str2num(get(ContourSteps.handles.EstepMethod0,''String''));',...
0063 'set(ContourSteps.gui,''Userdata'',ContourSteps); clear ContourSteps;'));
0064
0065
0066
0067 G.BstepMethod1 = uicontrol('Parent',GUI,'Style','Radiobutton',...
0068 'Units','Normalized',Font,'Position',[.1 .4 .6 .2],...
0069 'String','Number of Steps','Value',step(2),...
0070 'Callback',strcat('ContourSteps = get(gcbf,''Userdata'');',...
0071 'ContourSteps.p.contour.stepMethod = 1;',...
0072 'set(ContourSteps.handles.BstepMethod0,''Value'',0);',...
0073 'set(ContourSteps.handles.BstepMethod1,''Value'',1);',...
0074 'set(ContourSteps.handles.EstepMethod1,''String'',num2str(ContourSteps.p.contour.Nsteps));',...
0075 'set(ContourSteps.gui,''Userdata'',ContourSteps); clear ContourSteps;'));
0076 G.EstepMethod1 = uicontrol('Parent',GUI,'Style','edit',...
0077 'Units','Normalized',Font,'Position',[.7 .4 .2 .2],...
0078 'String',num2str(ContourSteps.p.contour.Nsteps),...
0079 'Callback',strcat('ContourSteps = get(gcbf,''Userdata'');',...
0080 'ContourSteps.p.contour.Nsteps = str2num(get(ContourSteps.handles.EstepMethod1,''String''));',...
0081 'set(ContourSteps.gui,''Userdata'',ContourSteps); clear ContourSteps;'));
0082
0083
0084
0085 Font.FontWeight = 'bold';
0086
0087
0088 G.Bdone = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0089 'Position',[.3 .15 .3 .2],...
0090 'String','OK','BusyAction','queue',...
0091 'TooltipString','Update the ascii parameters.',...
0092 'BackgroundColor',[0.0 0.5 0.0],...
0093 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
0094 'Callback',strcat('ContourSteps = get(gcbf,''Userdata'');',...
0095 'if isfield(ContourSteps,''parent''),',...
0096 'if isfield(ContourSteps.parent,''gui''),',...
0097 'parent = get(ContourSteps.parent.gui,''UserData'');',...
0098 'if isfield(parent,''p'') & isfield(ContourSteps,''p''),',...
0099 'parent.p = ContourSteps.p;',...
0100 'set(ContourSteps.parent.gui,''UserData'',parent);',...
0101 'end; ',...
0102 'end; ',...
0103 'end; ',...
0104 'close gcbf;[p] = ContourSteps.p; clear ContourSteps parent;'));
0105
0106
0107 G.Bquit = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0108 'Position',[.6 .15 .3 .2],...
0109 'String','CANCEL','BusyAction','queue',...
0110 'BackgroundColor',[0.75 0.0 0.0],...
0111 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
0112 'Callback','close gcbf;');
0113
0114
0115
0116 ContourSteps.handles = G;
0117 set(ContourSteps.gui,'Userdata',ContourSteps);
0118
0119 p = ContourSteps.p;
0120 return