📄 topoplot.m
字号:
% adjusting corrdinates% for dipole%% Revision 1.62 2003/11/05 20:35:21 arno% dipole options%% Revision 1.61 2003/11/05 19:44:32 arno% header text%% Revision 1.60 2003/08/08 17:36:12 arno% shrink factor overwrite problem fixed%% Revision 1.59 2003/08/08 17:34:41 arno% -cos -> cos%% Revision 1.58 2003/08/07 20:49:12 arno% option 'masksurf' to speed up display%% Revision 1.57 2003/08/07 16:02:35 scott% typo%% Revision 1.56 2003/08/07 16:01:49 scott% debug%% Revision 1.55 2003/08/07 15:56:54 scott% debug%% Revision 1.54 2003/08/07 15:54:49 scott% debug last%% Revision 1.53 2003/08/07 15:51:05 scott% added 'noplot' option to return interpolated channel value%% Revision 1.52 2003/07/18 01:34:07 scott% text placement%% Revision 1.51 2003/07/18 01:33:19 scott% text placement%% Revision 1.50 2003/07/18 01:31:49 scott% debug%% Revision 1.49 2003/07/18 01:27:17 scott% debug%% Revision 1.48 2003/07/18 01:26:05 scott% debug%% Revision 1.47 2003/07/18 01:18:12 scott% debug last%% Revision 1.46 2003/07/18 01:17:34 scott% formatting, debug axes size message%% Revision 1.45 2003/07/17 23:42:32 scott% nothing%% Revision 1.44 2003/07/17 23:13:03 scott% rm debug message%% Revision 1.43 2003/07/16 16:29:46 arno% replacing with topoplottest - added image output, gridscale arg%% Revision 1.41 2003/07/15 23:55:40 arno% retreiving version 1.28%% Revision 1.28 2003/06/27 18:53:04 arno% header msg%% Revision 1.27 2003/05/12 22:27:44 arno% debug verbose%% Revision 1.26 2003/05/12 22:23:38 arno% adding verbose option%% Revision 1.25 2002/11/27 01:23:53 arno% change warning message%% Revision 1.24 2002/11/12 23:06:48 arno% still debugging last insert%% Revision 1.23 2002/11/12 22:19:01 arno% typo%% Revision 1.22 2002/11/12 21:43:51 scott% tmpelocs -> tmpeloc%% Revision 1.21 2002/11/12 19:33:24 arno% remove last channel of eloc structure if necessary (common ref)%% Revision 1.20 2002/11/01 03:50:08 erik% same%% Revision 1.19 2002/11/01 03:47:40 erik% added test for locs_file string to readlocs call%% Revision 1.18 2002/10/31 22:51:25 luca% now also plotting n < nchans single channels%% Revision 1.17 2002/10/30 18:50:37 arno% debugging dipole%% Revision 1.16 2002/10/30 16:41:21 arno% adding the dipole option%% Revision 1.15 2002/10/26 20:09:35 arno% error typo%% Revision 1.14 2002/10/14 00:40:44 arno% *** empty log message ***%% Revision 1.13 2002/09/23 18:09:11 arno% fixing single channel plotting%% Revision 1.12 2002/08/13 17:45:58 arno% undo last change%% Revision 1.11 2002/08/13 17:44:37 arno% remove color setting%% Revision 1.10 2002/08/12 01:34:53 arno% color%% Revision 1.9 2002/08/11 22:31:20 arno% color%% Revision 1.8 2002/05/01 18:49:20 arno% modifying default shrink%% Revision 1.7 2002/05/01 02:40:10 arno% typo%% Revision 1.6 2002/04/24 17:30:47 arno% auto shrink%% Revision 1.5 2002/04/24 17:07:28 arno% debugging error message problem%% Revision 1.4 2002/04/17 18:40:23 arno% display real electrode number%% Revision 1.3 2002/04/06 03:47:44 arno% adding emarkersize1chan input%% Revision 1.2 2002/04/06 03:37:24 arno% adding single channel vector input%% Revision 1.1 2002/04/05 17:36:45 jorn% Initial revision%% Topoplot Version 2.1% Early development history:% Begun by Andy Spydell and Scott Makeig, NHRC, 7-23-96% 8-96 Revised by Colin Humphries, CNL / Salk Institute, La Jolla CA% -changed surf command to imagesc (faster)% -can now handle arbitrary scaling of electrode distances% -can now handle non integer angles in chan_locs% 4-4-97 Revised again by Colin Humphries, reformatted by SM% -added parameters% -changed chan_locs format% 2-26-98 Revised by Colin% -changed image back to surface command% -added fill and blank styles% -removed extra background colormap entry (now use any colormap)% -added parameters for electrode colors and labels% -now each topoplot axes use the caxis command again.% -removed OUTPUT parameter% 3-11-98 changed default emarkersize, improve help msg -sm% 5-24-01 made default emarkersize vary with number of channels -sm% 01-25-02 reformated help & license, added link -ad % 03-15-02 added readlocs and the use of eloc input structure -ad % 03-25-02 added 'labelpoint' options and allow Values=[] -ad &sm% 03-25-02 added details to "Unknown parameter" warning -sm & adfunction [handle,Zi] = topoplot2(Values,loc_file,p1,v1,p2,v2,p3,v3,p4,v4,p5,v5,p6,v6,p7,v7,p8,v8,p9,v9,p10,v10)%%%%%%%%%%%%%%%%%%%%%%%%% Set defaults %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%icadefs % read defaults MAXTOPOPLOTCHANS and DEFAULT_ELOC and BACKCOLORif ~exist('BACKCOLOR') % if icadefs.m does not define BACKCOLOR BACKCOLOR = [.93 .96 1]; % EEGLAB standardendnoplot = 'off';handle = [];Zi = [];chanval = NaN;rmax = 0.5; % head radius - don't change this!INTERPLIMITS = 'head'; % head, electrodesINTSQUARE = 'on'; % default, interpolate electrodes located though the whole square containing % the plotting diskMAPLIMITS = 'absmax'; % absmax, maxmin, [values]GRID_SCALE = 67; % plot map on a 67X67 gridCIRCGRID = 201; % number of angles to use in drawing circlesAXHEADFAC = 1.3; % head to axes scaling factorCONTOURNUM = 6; % number of contour levels to plotSTYLE = 'both'; % default 'style': both,straight,fill,contour,blankHEADCOLOR = [0 0 0]; % default head color (black)CCOLOR = [0.2 0.2 0.2]; % default contour colorECOLOR = [0 0 0]; % default electrode colorELECTRODES = []; % default 'electrodes': on|off|label - set belowMAXDEFAULTSHOWLOCS = 64;% if more channels than this, don't show electrode locations by defaultEMARKER = '.'; % mark electrode locations with small disksEMARKERSIZE = []; % default depends on number of electrodes, set in codeEMARKERSIZE1CHAN = 40; % default selected channel location marker sizeEMARKERCOLOR1CHAN = 'red'; % selected channel location marker colorEFSIZE = get(0,'DefaultAxesFontSize'); % use current default fontsize for electrode labelsHLINEWIDTH = 3; % default linewidth for head, nose, earsBLANKINGRINGWIDTH = .035;% width of the blanking ring HEADRINGWIDTH = .007;% width of the cartoon head ringSHADING = 'flat'; % default 'shading': flat|interpshrinkfactor = []; % shrink mode (dprecated)intrad = []; % default interpolation square is to outermost electrode (<=1.0)plotrad = []; % plotting radius ([] = auto, based on outermost channel location)headrad = []; % default plotting radius for cartoon head is 0.5MINPLOTRAD = 0.15; % can't make a topoplot with smaller plotrad (contours fail)VERBOSE = 'on';MASKSURF = 'off';CONVHULL = 'off'; % dont mask outside the electrodes convex hull%%%%%% Dipole defaults %%%%%%%%%%%%DIPOLE = []; DIPNORM = 'on';DIPSPHERE = 85;DIPLEN = 1;DIPSCALE = 1;DIPORIENT = 1;DIPCOLOR = [0 0 0];%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Handle arguments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if nargin< 1 help topoplot; returnendnargs = nargin;if nargs < 2 loc_file = DEFAULT_ELOC; if ~exist(loc_file) fprintf('default locations file "%s" not found - specify chan_locs in topoplot() call.\n',loc_file) error(' ') endendif nargs == 1 if isstr(Values) if any(strcmp(lower(Values),{'example','demo'})) fprintf(['This is an example of an electrode location file,\n',... 'an ascii file consisting of the following four columns:\n',... ' channel_number degrees arc_length channel_name\n\n',... 'Example:\n',... ' 1 -18 .352 Fp1 \n',... ' 2 18 .352 Fp2 \n',... ' 5 -90 .181 C3 \n',... ' 6 90 .181 C4 \n',... ' 7 -90 .500 A1 \n',... ' 8 90 .500 A2 \n',... ' 9 -142 .231 P3 \n',... '10 142 .231 P4 \n',... '11 0 .181 Fz \n',... '12 0 0 Cz \n',... '13 180 .181 Pz \n\n',... ... 'In topoplot() coordinates, 0 deg. points to the nose, positive\n',... 'angles point to the right hemisphere, and negative to the left.\n',... 'The model head sphere has a circumference of 2; the vertex\n',... '(Cz) has arc_length 0. Locations with arc_length > 0.5 are below\n',... 'head center and are plotted outside the head cartoon.\n'.... 'Option plotrad controls how much of this lower-head "skirt" is shown.\n',... 'Option headrad controls if and where the cartoon head will be drawn.\n',... 'Option intrad controls how many channels will be included in the interpolation.\n',... ]) return end endendif isempty(loc_file) loc_file = 0;endif isnumeric(loc_file) & loc_file == 0 loc_file = DEFAULT_ELOC;endif nargs > 2 if ~(round(nargs/2) == nargs/2) error('Odd number of inputs?') end for i = 3:2:nargs Param = eval(['p',int2str((i-3)/2 +1)]); Value = eval(['v',int2str((i-3)/2 +1)]); if ~isstr(Param) error('Flag arguments must be strings') end Param = lower(Param); switch lower(Param) case 'conv' CONVHULL = lower(Value); if ~strcmp(CONVHULL,'on') & ~strcmp(CONVHULL,'off') error('Value of ''conv'' must be ''on'' or ''off''.'); end case 'colormap' if size(Value,2)~=3 error('Colormap must be a n x 3 matrix') end colormap(Value) case 'intsquare' INTSQUARE = lower(Value); if ~strcmp(INTSQUARE,'on') & ~strcmp(INTSQUARE,'off') error('Value of ''intsquare'' must be ''on'' or ''off''.'); end case {'interplimits','headlimits'} if ~isstr(Value) error('''interplimits'' value must be a string') end Value = lower(Value); if ~strcmp(Value,'electrodes') & ~strcmp(Value,'head') error('Incorrect value for interplimits') end INTERPLIMITS = Value; case 'verbose' VERBOSE = Value; case 'maplimits' MAPLIMITS = Value; case 'masksurf' MASKSURF = Value; case 'circgrid' CIRCGRID = Value; if isstr(CIRCGRID) | CIRCGRID<100 error('''circgrid'' value must be an int > 100'); end case 'style' STYLE = lower(Value); case 'numcontour' CONTOURNUM = Value; case 'electrodes' ELECTRODES = lower(Value); if strcmpi(ELECTRODES,'pointlabels') | strcmpi(ELECTRODES,'ptslabels') ... | strcmpi(ELECTRODES,'labelspts') | strcmpi(ELECTRODES,'ptlabels') ... | strcmpi(ELECTRODES,'labelpts') ELECTRODES = 'labelpoint'; % backwards compatability end if strcmpi(ELECTRODES,'pointnumbers') | strcmpi(ELECTRODES,'ptsnumbers') ... | strcmpi(ELECTRODES,'numberspts') | strcmpi(ELECTRODES,'ptnumbers') ... | strcmpi(ELECTRODES,'numberpts') ELECTRODES = 'numpoint'; % backwards compatability end if ~strcmpi(ELECTRODES,'labelpoint') ... & ~strcmpi(ELECTRODES,'numpoint') ... & ~strcmp(ELECTRODES,'on') ... & ~strcmp(ELECTRODES,'off') ... & ~strcmp(ELECTRODES,'labels') ... & ~strcmpi(ELECTRODES,'numbers') error('Unknown value for keyword ''electrodes'''); end case 'dipole' DIPOLE = Value; case 'dipsphere' DIPSPHERE = Value; case 'dipnorm' DIPNORM = Value; case 'diplen' DIPLEN = Value; case 'dipscale' DIPSCALE = Value; case 'diporient' DIPORIENT = Value; case 'dipcolor' DIPCOLOR = Value; case 'emarker' EMARKER = Value; case 'shrink' shrinkfactor = Value; case 'intrad' intrad = Value; if isstr(intrad) | (intrad < MINPLOTRAD | intrad > 1) error('intrad argument should be a number between 0.15 and 1.0'); end case 'plotrad' plotrad = Value; if isstr(plotrad) | (plotrad < MINPLOTRAD | plotrad > 1) error('plotrad argument should be a number between 0.15 and 1.0'); end case 'headrad' headrad = Value;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -