Home > bioelectromagnetism > plots_topography.m

plots_topography

PURPOSE ^

plots_topography - script to plot ERP topo maps

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 plots_topography - script to plot ERP topo maps

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 % plots_topography - script to plot ERP topo maps
0003 
0004 clear
0005 
0006 comp = 'wm';
0007 data = 'link14hz';
0008 
0009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0010 % Set time for topo maps, in msec
0011 xmin = 50;
0012 xmax = 805;
0013 xstep = 5;
0014 
0015 
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 % Load the data files
0018 switch comp,
0019 case 'sa',
0020     exp = 'oac'; con = 'ouc'; dif = 'oac-ouc';
0021 case 'wm',
0022     exp = 'tac'; con = 'oac'; dif = 'tac-oac';
0023 case 'ea',
0024     exp = 'oat'; con = 'oac'; dif = 'oat-oac';
0025 case 'dt',
0026     exp = 'tud'; con = 'tuc'; dif = 'tud-tuc';
0027 end
0028 plots_loaddata
0029 
0030 
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 % Create output directories
0033 if mkdir('topomaps'),
0034     cd('topomaps');
0035     if mkdir(comp),
0036         cd(comp);
0037     else
0038         msg = sprintf('Cannot create %s directory',comp);
0039         error(msg);
0040     end
0041 else
0042     error('Cannot create ''topomaps'' directory');
0043 end
0044 
0045 
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 % Setup the eeg toolbox parameters
0048 
0049 p = eeg_toolbox_defaults;
0050 p.volt.sampleHz = 400;
0051 p.volt.sampleMsec = 2.5;
0052 p.volt.channels = 124;
0053 p.volt.epochStart = -200;
0054 p.volt.epochEnd = 1500;
0055 p.volt.sweeps = 1;
0056 p.volt.interpZero = 1;
0057 
0058 % define time point 0
0059 p.volt.sampleTime = 0;
0060 p.volt.samplePoint = 81;
0061 p.timeMethod = 1;
0062 p.endTime = 81;
0063 
0064 % Setup to plot the scalp mesh topography
0065 p.elec.plot = 0;
0066 p.elec.plotSurf = 0;
0067 p.mesh.plotSurf = 1;
0068 
0069 % Setup the contours
0070 p.contour.plot3D = 1; % with contours
0071 
0072 % Open the default mesh and electrodes
0073 p = mesh_open(p);
0074 p = elec_open(p);
0075 
0076 
0077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0078 % Create topography maps for the exp/con conditions
0079 
0080 expvolt = eval(CONT.expvolt);
0081 convolt = eval(CONT.convolt);
0082 CONTexpvolt = expvolt;
0083 CONTconvolt = convolt;
0084 
0085 expvolt = eval(PTSD.expvolt);
0086 convolt = eval(PTSD.convolt);
0087 PTSDexpvolt = expvolt;
0088 PTSDconvolt = convolt;
0089 
0090 % -- Determine common scale
0091 
0092 CONT.erpmax = max([CONTexpvolt CONTconvolt]);
0093 CONT.erpmin = min([CONTexpvolt CONTconvolt]);
0094 CONT.ymax = ceil( max(CONT.erpmax));
0095 CONT.ymin = floor(min(CONT.erpmin));
0096 
0097 PTSD.erpmax = max([PTSDexpvolt PTSDconvolt]);
0098 PTSD.erpmin = min([PTSDexpvolt PTSDconvolt]);
0099 PTSD.ymax = ceil( max(PTSD.erpmax));
0100 PTSD.ymin = floor(min(PTSD.erpmin));
0101 
0102 ymin = min(CONT.ymin,PTSD.ymin);
0103 ymax = max(CONT.ymax,PTSD.ymax);
0104 
0105 ymax = max(abs(ymin),abs(ymax));
0106 ymin = -1 * ymax;
0107 
0108 
0109 
0110 
0111 
0112 
0113 % -- Load the first voltage data file
0114 
0115 p.volt.path = datapath;
0116 p.volt.file = CONT.expfile;
0117 p = eeg_open(p);
0118 
0119 % -- Plot the topography
0120 
0121 p = eeg_contours_engine(p);
0122 
0123 % -- Setup the Animation parameters
0124 H = get(gcf,'userdata');
0125 
0126 % no mouse rotation
0127 set(H.Info,'value',0);
0128 
0129 % specify ymin/ymax
0130 set(H.Yset,'value',1);
0131 set(H.Ymin,'string',sprintf('%7.2f',ymin));
0132 set(H.Ymin,'value',ymin);
0133 set(H.Ymax,'string',sprintf('%7.2f',ymax));
0134 set(H.Ymax,'value',ymax);
0135 
0136 % specify x start/finish/step
0137 set(H.Start,'value',xmin);
0138 set(H.Start,'string',sprintf('%7.2f',xmin));
0139 set(H.Finish,'value',xmax);
0140 set(H.Finish,'string',sprintf('%7.2f',xmax));
0141 set(H.Step,'value',xstep);
0142 set(H.Step,'string',sprintf('%7.2f',xstep));
0143 
0144 % specify save graphics
0145 set(H.Save,'value',1);
0146 
0147 set(H.gui,'userdata',H);
0148 
0149 % -- For each view (Front,Back,Left,Right)
0150 for view = 3:6,
0151     
0152     set(H.View,'value',view); mouse_rotate('view',H);
0153     set(H.gui,'userdata',H);
0154     gui_topo_animate('animate');
0155     
0156 end
0157 
0158 close gcf
0159 
0160 
0161 
0162 
0163 
0164 
0165 % -- Load the second voltage data file
0166 
0167 p.volt.path = datapath;
0168 p.volt.file = CONT.confile;
0169 p = eeg_open(p);
0170 
0171 % -- Plot the topography
0172 
0173 p = eeg_contours_engine(p);
0174 
0175 % -- Setup the Animation parameters
0176 H = get(gcf,'userdata');
0177 
0178 % no mouse rotation
0179 set(H.Info,'value',0);
0180 
0181 % specify ymin/ymax
0182 set(H.Yset,'value',1);
0183 set(H.Ymin,'string',sprintf('%7.2f',ymin));
0184 set(H.Ymin,'value',ymin);
0185 set(H.Ymax,'string',sprintf('%7.2f',ymax));
0186 set(H.Ymax,'value',ymax);
0187 
0188 % specify x start/finish/step
0189 set(H.Start,'value',xmin);
0190 set(H.Start,'string',sprintf('%7.2f',xmin));
0191 set(H.Finish,'value',xmax);
0192 set(H.Finish,'string',sprintf('%7.2f',xmax));
0193 set(H.Step,'value',xstep);
0194 set(H.Step,'string',sprintf('%7.2f',xstep));
0195 
0196 % specify save graphics
0197 set(H.Save,'value',1);
0198 
0199 set(H.gui,'userdata',H);
0200 
0201 % -- For each view (Front,Back,Left,Right)
0202 for view = 3:6,
0203     
0204     set(H.View,'value',view); mouse_rotate('view',H);
0205     set(H.gui,'userdata',H);
0206     gui_topo_animate('animate');
0207     
0208 end
0209 
0210 close gcf
0211 
0212 
0213 
0214 
0215 
0216 
0217 
0218 
0219 
0220 % -- Load the third voltage data file
0221 
0222 p.volt.path = datapath;
0223 p.volt.file = PTSD.expfile;
0224 p = eeg_open(p);
0225 
0226 % -- Plot the topography
0227 
0228 p = eeg_contours_engine(p);
0229 
0230 % -- Setup the Animation parameters
0231 H = get(gcf,'userdata');
0232 
0233 % no mouse rotation
0234 set(H.Info,'value',0);
0235 
0236 % specify ymin/ymax
0237 set(H.Yset,'value',1);
0238 set(H.Ymin,'string',sprintf('%7.2f',ymin));
0239 set(H.Ymin,'value',ymin);
0240 set(H.Ymax,'string',sprintf('%7.2f',ymax));
0241 set(H.Ymax,'value',ymax);
0242 
0243 % specify x start/finish/step
0244 set(H.Start,'value',xmin);
0245 set(H.Start,'string',sprintf('%7.2f',xmin));
0246 set(H.Finish,'value',xmax);
0247 set(H.Finish,'string',sprintf('%7.2f',xmax));
0248 set(H.Step,'value',xstep);
0249 set(H.Step,'string',sprintf('%7.2f',xstep));
0250 
0251 % specify save graphics
0252 set(H.Save,'value',1);
0253 
0254 set(H.gui,'userdata',H);
0255 
0256 % -- For each view (Front,Back,Left,Right)
0257 for view = 3:6,
0258     
0259     set(H.View,'value',view); mouse_rotate('view',H);
0260     set(H.gui,'userdata',H);
0261     gui_topo_animate('animate');
0262     
0263 end
0264 
0265 close gcf
0266 
0267 
0268 
0269 
0270 
0271 
0272 
0273 
0274 
0275 % -- Load the fourth voltage data file
0276 
0277 p.volt.path = datapath;
0278 p.volt.file = PTSD.confile;
0279 p = eeg_open(p);
0280 
0281 % -- Plot the topography
0282 
0283 p = eeg_contours_engine(p);
0284 
0285 % -- Setup the Animation parameters
0286 H = get(gcf,'userdata');
0287 
0288 % no mouse rotation
0289 set(H.Info,'value',0);
0290 
0291 % specify ymin/ymax
0292 set(H.Yset,'value',1);
0293 set(H.Ymin,'string',sprintf('%7.2f',ymin));
0294 set(H.Ymin,'value',ymin);
0295 set(H.Ymax,'string',sprintf('%7.2f',ymax));
0296 set(H.Ymax,'value',ymax);
0297 
0298 % specify x start/finish/step
0299 set(H.Start,'value',xmin);
0300 set(H.Start,'string',sprintf('%7.2f',xmin));
0301 set(H.Finish,'value',xmax);
0302 set(H.Finish,'string',sprintf('%7.2f',xmax));
0303 set(H.Step,'value',xstep);
0304 set(H.Step,'string',sprintf('%7.2f',xstep));
0305 
0306 % specify save graphics
0307 set(H.Save,'value',1);
0308 
0309 set(H.gui,'userdata',H);
0310 
0311 % -- For each view (Front,Back,Left,Right)
0312 for view = 3:6,
0313     
0314     set(H.View,'value',view); mouse_rotate('view',H);
0315     set(H.gui,'userdata',H);
0316     gui_topo_animate('animate');
0317     
0318 end
0319 
0320 close gcf
0321 
0322 
0323 
0324 
0325 
0326 
0327 
0328 
0329 
0330 
0331 
0332 
0333 
0334 
0335 
0336 
0337 
0338 
0339 
0340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0341 % Create topography maps for the difference data
0342 
0343 CONTdifvolt = eval(CONT.difvolt);
0344 
0345 PTSDdifvolt = eval(PTSD.difvolt);
0346 
0347 % -- Determine common scale
0348 
0349 CONT.difmax = max(CONTdifvolt);
0350 CONT.difmin = min(CONTdifvolt);
0351 CONT.ymax = ceil( max(CONT.difmax));
0352 CONT.ymin = floor(min(CONT.difmin));
0353 
0354 PTSD.difmax = max(PTSDdifvolt);
0355 PTSD.difmin = min(PTSDdifvolt);
0356 PTSD.ymax = ceil( max(PTSD.difmax));
0357 PTSD.ymin = floor(min(PTSD.difmin));
0358 
0359 ymax = ceil( max([CONT.ymax PTSD.ymax]));
0360 ymin = floor(min([CONT.ymin PTSD.ymin]));
0361 
0362 ymax = max(abs(ymin),abs(ymax));
0363 ymin = -1 * ymax;
0364 
0365 
0366 
0367 
0368 % -- Load the first dif voltage data file
0369 
0370 p.volt.path = datapath;
0371 p.volt.file = CONT.diffile;
0372 p = eeg_open(p);
0373 
0374 % -- Plot the topography
0375 
0376 p = eeg_contours_engine(p);
0377 
0378 % -- Setup the Animation parameters
0379 H = get(gcf,'userdata');
0380 
0381 % no mouse rotation
0382 set(H.Info,'value',0);
0383 
0384 % specify ymin/ymax
0385 set(H.Yset,'value',1);
0386 set(H.Ymin,'string',sprintf('%7.2f',ymin));
0387 set(H.Ymin,'value',ymin);
0388 set(H.Ymax,'string',sprintf('%7.2f',ymax));
0389 set(H.Ymax,'value',ymax);
0390 
0391 % specify x start/finish/step
0392 set(H.Start,'value',xmin);
0393 set(H.Start,'string',sprintf('%7.2f',xmin));
0394 set(H.Finish,'value',xmax);
0395 set(H.Finish,'string',sprintf('%7.2f',xmax));
0396 set(H.Step,'value',xstep);
0397 set(H.Step,'string',sprintf('%7.2f',xstep));
0398 
0399 % specify save graphics
0400 set(H.Save,'value',1);
0401 
0402 set(H.gui,'userdata',H);
0403 
0404 % -- For each view (Front,Back,Left,Right)
0405 for view = 3:6,
0406     
0407     set(H.View,'value',view); mouse_rotate('view',H);
0408     set(H.gui,'userdata',H);
0409     gui_topo_animate('animate');
0410     
0411 end
0412 
0413 close gcf
0414 
0415 
0416 
0417 
0418 
0419 
0420 
0421 % -- Load the second dif voltage data file
0422 
0423 p.volt.path = datapath;
0424 p.volt.file = PTSD.diffile;
0425 p = eeg_open(p);
0426 
0427 % -- Plot the topography
0428 
0429 p = eeg_contours_engine(p);
0430 
0431 % -- Setup the Animation parameters
0432 H = get(gcf,'userdata');
0433 
0434 % no mouse rotation
0435 set(H.Info,'value',0);
0436 
0437 % specify ymin/ymax
0438 set(H.Yset,'value',1);
0439 set(H.Ymin,'string',sprintf('%7.2f',ymin));
0440 set(H.Ymin,'value',ymin);
0441 set(H.Ymax,'string',sprintf('%7.2f',ymax));
0442 set(H.Ymax,'value',ymax);
0443 
0444 % specify x start/finish/step
0445 set(H.Start,'value',xmin);
0446 set(H.Start,'string',sprintf('%7.2f',xmin));
0447 set(H.Finish,'value',xmax);
0448 set(H.Finish,'string',sprintf('%7.2f',xmax));
0449 set(H.Step,'value',xstep);
0450 set(H.Step,'string',sprintf('%7.2f',xstep));
0451 
0452 % specify save graphics
0453 set(H.Save,'value',1);
0454 
0455 set(H.gui,'userdata',H);
0456 
0457 % -- For each view (Front,Back,Left,Right)
0458 for view = 3:6,
0459     
0460     set(H.View,'value',view); mouse_rotate('view',H);
0461     set(H.gui,'userdata',H);
0462     gui_topo_animate('animate');
0463     
0464 end
0465 
0466 close gcf
0467 
0468 
0469 
0470 
0471 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003