0001 function [GUI] = gui_eeg_ascii_parameters(parent)
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 if exist('parent','var'),
0030 if ~isempty(parent),
0031 ASCIIParam.parent.gui = parent;
0032 ParentUserdata = get(parent,'Userdata');
0033 if isfield(ParentUserdata,'p'),
0034 if ~isempty(ParentUserdata.p),
0035 ASCIIParam.p = ParentUserdata.p;
0036 else
0037 ASCIIParam.p = eeg_toolbox_defaults('create');
0038 end
0039 else
0040 ASCIIParam.p = eeg_toolbox_defaults('create');
0041 end
0042 else
0043 ASCIIParam.p = eeg_toolbox_defaults('create');
0044 end
0045 end
0046
0047
0048 GUIwidth = 300;
0049 GUIheight = 250;
0050 GUI = figure('Name','ERP PARAMETERS','Tag','ERP_PARAMETERS',...
0051 'NumberTitle','off','HandleVisibility','callback',...
0052 'MenuBar','none','Position',[1 1 GUIwidth GUIheight]);
0053 movegui(GUI,'center');
0054
0055 ASCIIParam.gui = GUI;
0056
0057 Font.FontName = 'Helvetica';
0058 Font.FontUnits = 'Pixels';
0059 Font.FontSize = 12;
0060 Font.FontWeight = 'normal';
0061 Font.FontAngle = 'normal';
0062
0063
0064
0065
0066 G.TvoltChannels = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0067 'Position',[.05 .8 .45 .1],'String','Channels','HorizontalAlignment','left');
0068 G.EvoltChannels = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ...
0069 'Position',[.51 .8 .4 .1], 'String',num2str(ASCIIParam.p.volt.channels),...
0070 'Callback',strcat('ASCIIParam = get(gcbf,''Userdata'');',...
0071 'ASCIIParam.p.volt.channels = str2num(get(ASCIIParam.handles.EvoltChannels,''String''));',...
0072 'set(gcbf,''Userdata'',ASCIIParam); clear ASCIIParam;'));
0073
0074 G.TvoltagePoints = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0075 'Position',[.05 .7 .45 .1],'String','Sample Points *','HorizontalAlignment','left',...
0076 'TooltipString','Essential');
0077 G.EvoltagePoints = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ...
0078 'Position',[.51 .7 .4 .1], 'String',num2str(ASCIIParam.p.volt.points),...
0079 'Callback',strcat('ASCIIParam = get(gcbf,''Userdata'');',...
0080 'ASCIIParam.p.volt.points = str2num(get(ASCIIParam.handles.EvoltagePoints,''String''));',...
0081 'set(gcbf,''Userdata'',ASCIIParam); clear ASCIIParam;'));
0082
0083 G.TvoltSampleHz = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0084 'Position',[.05 .6 .45 .1],'String','Sample Rate (Hz) *','HorizontalAlignment','left',...
0085 'TooltipString','Essential');
0086 G.EvoltSampleHz = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ...
0087 'Position',[.51 .6 .4 .1], 'String',num2str(ASCIIParam.p.volt.sampleHz),...
0088 'TooltipString','1000 / Sample Rate (msec)',...
0089 'Callback',strcat('ASCIIParam = get(gcbf,''Userdata'');',...
0090 'ASCIIParam.p.volt.sampleHz = str2num(get(ASCIIParam.handles.EvoltSampleHz,''String''));',...
0091 'ASCIIParam.p.volt.sampleMsec = 1000 ./ ASCIIParam.p.volt.sampleHz;',...
0092 'set(ASCIIParam.handles.EvoltSampleMsec,''String'',num2str(ASCIIParam.p.volt.sampleMsec));',...
0093 'set(gcbf,''Userdata'',ASCIIParam); clear ASCIIParam;'));
0094
0095 G.TvoltSampleMsec = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0096 'Position',[.05 .5 .45 .1],'String','Sample Rate (msec) *','HorizontalAlignment','left',...
0097 'TooltipString','Essential');
0098 G.EvoltSampleMsec = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ...
0099 'Position',[.51 .5 .4 .1], 'String',num2str(ASCIIParam.p.volt.sampleMsec),...
0100 'TooltipString','1000 / Sample Rate (Hz)',...
0101 'Callback',strcat('ASCIIParam = get(gcbf,''Userdata'');',...
0102 'ASCIIParam.p.volt.sampleMsec = str2num(get(ASCIIParam.handles.EvoltSampleMsec,''String''));',...
0103 'ASCIIParam.p.volt.sampleHz = 1000 ./ ASCIIParam.p.volt.sampleMsec;',...
0104 'set(ASCIIParam.handles.EvoltSampleHz,''String'',num2str(ASCIIParam.p.volt.sampleHz));',...
0105 'set(gcbf,''Userdata'',ASCIIParam); clear ASCIIParam;'));
0106
0107 G.TvoltEpochStart = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0108 'Position',[.05 .4 .45 .1],'String','Epoch Start (msec) *','HorizontalAlignment','left',...
0109 'TooltipString','Essential');
0110 G.EvoltEpochStart = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ...
0111 'Position',[.51 .4 .4 .1], 'String',num2str(ASCIIParam.p.volt.epochStart),...
0112 'TooltipString','Prestimulus Baseline Time (msec)',...
0113 'Callback',strcat('ASCIIParam = get(gcbf,''Userdata'');',...
0114 'ASCIIParam.p.volt.epochStart = str2num(get(ASCIIParam.handles.EvoltEpochStart,''String''));',...
0115 'if ~isempty(ASCIIParam.p.volt.points) & ~isempty(ASCIIParam.p.volt.sampleMsec), ',...
0116 'ASCIIParam.p.volt.epochEnd = ASCIIParam.p.volt.epochStart + (ASCIIParam.p.volt.points .* ASCIIParam.p.volt.sampleMsec);',...
0117 'set(ASCIIParam.handles.EvoltEpochEnd,''String'',num2str(ASCIIParam.p.volt.epochEnd));',...
0118 'end; ',...
0119 'set(gcbf,''Userdata'',ASCIIParam); clear ASCIIParam;'));
0120
0121 G.TvoltEpochEnd = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0122 'Position',[.05 .3 .45 .1],'String','Epoch End (msec) *','HorizontalAlignment','left',...
0123 'TooltipString','Essential');
0124 G.EvoltEpochEnd = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ...
0125 'Position',[.51 .3 .4 .1], 'String',num2str(ASCIIParam.p.volt.epochEnd),...
0126 'TooltipString','Poststimulus Epoch Time (msec)',...
0127 'Callback',strcat('ASCIIParam = get(gcbf,''Userdata'');',...
0128 'ASCIIParam.p.volt.epochEnd = str2num(get(ASCIIParam.handles.EvoltEpochEnd,''String''));',...
0129 'set(gcbf,''Userdata'',ASCIIParam); clear ASCIIParam;'));
0130
0131 G.TvoltSweeps = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0132 'Position',[.05 .2 .45 .1],'String','Accepted Sweeps','HorizontalAlignment','left');
0133 G.EvoltSweeps = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ...
0134 'Position',[.51 .2 .4 .1], 'String',num2str(ASCIIParam.p.volt.sweeps),...
0135 'Callback',strcat('ASCIIParam = get(gcbf,''Userdata'');',...
0136 'ASCIIParam.p.volt.sweeps = str2num(get(ASCIIParam.handles.EvoltSweeps,''String''));',...
0137 'set(gcbf,''Userdata'',ASCIIParam); clear ASCIIParam;'));
0138
0139 G.Tessential = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
0140 'Position',[.05 .1 .45 .1],'String','( * are essential )','HorizontalAlignment','left');
0141
0142
0143 Font.FontWeight = 'bold';
0144
0145
0146 donecommand = strcat('ASCIIParam = get(gcbf,''Userdata''); ',...
0147 'if isempty(ASCIIParam.p.volt.sampleHz) | isempty(ASCIIParam.p.volt.epochStart) | isempty(ASCIIParam.p.volt.points),',...
0148 'help = helpdlg(''Please Specify Essential (*) Parameters'',''HELP'');',...
0149 'movegui(help,''center''); waitfor(help); clear ASCIIParam help;',...
0150 'else, ',...
0151 'ASCIIParam.p.volt.timeArray = zeros(ASCIIParam.p.volt.points,1);',...
0152 't = ASCIIParam.p.volt.epochStart;',...
0153 'for i=1:ASCIIParam.p.volt.points, ',...
0154 'ASCIIParam.p.volt.timeArray(i,1) = t;',...
0155 't = t + ASCIIParam.p.volt.sampleMsec;',...
0156 'end; clear i t;',...
0157 'if isfield(ASCIIParam,''parent''),',...
0158 'if isfield(ASCIIParam.parent,''gui''),',...
0159 'parent = get(ASCIIParam.parent.gui,''UserData'');',...
0160 'if isfield(parent,''p'') & isfield(ASCIIParam,''p''),',...
0161 'parent.p = ASCIIParam.p;',...
0162 'set(ASCIIParam.parent.gui,''UserData'',parent);',...
0163 'clear parent;',...
0164 'end; ',...
0165 'end; ',...
0166 'end; ',...
0167 'close gcbf; clear ASCIIParam;',...
0168 'end;');
0169
0170
0171
0172
0173 G.Bdone = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0174 'Position',[.51 .1 .19 .1],...
0175 'String','OK','BusyAction','queue',...
0176 'TooltipString','Update the ascii parameters.',...
0177 'BackgroundColor',[0.0 0.5 0.0],...
0178 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
0179 'Callback',donecommand);
0180
0181
0182 G.Bquit = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0183 'Position',[.71 .1 .2 .1],...
0184 'String','CANCEL','BusyAction','queue',...
0185 'BackgroundColor',[0.75 0.0 0.0],...
0186 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
0187 'Callback','close gcbf;');
0188
0189
0190
0191 ASCIIParam.handles = G;
0192 set(ASCIIParam.gui,'Userdata',ASCIIParam);
0193
0194 uiwait(GUI);
0195
0196 return