attachment:stimsize2visangle.m of TransformingVisualAngleAndPixelSize - MRC CBU Imaging Wiki
location: attachment:stimsize2visangle.m of TransformingVisualAngleAndPixelSize

Attachment 'stimsize2visangle.m'

Download

   1 % Quick convenience function to convert stimulus size in pixels to degrees
   2 % visual angle. If the screen and distance parameters are undefined, we use
   3 % the CBU scanner settings (see 
   4 % http://imaging.mrc-cbu.cam.ac.uk/mri/CbuStimulusDelivery). If using default
   5 % CBU scanner parameters, the sizey input is also optional.
   6 % use: [visanglex,visangley] = stimsize2visangle(sizex,[sizey],[totdistmm],[screenwidthmm],[screenres])
   7 % 25/9/2009 J Carlin
   8 
   9 function [visanglex,visangley] = stimsize2visangle(sizex,sizey,totdist,screenwidth,screenres)
  10 
  11 if nargin < 3
  12 	% mm
  13 	distscreenmirror=823;
  14 	distmirroreyes=90;
  15 	totdist=distscreenmirror+distmirroreyes;
  16 	screenwidth=268;
  17 
  18 	% pixels
  19 	screenres=1024;
  20 end
  21 
  22 visang_rad = 2 * atan(screenwidth/2/totdist);
  23 visang_deg = visang_rad * (180/pi);
  24 
  25 visang_perpix = visang_deg / screenres;
  26 
  27 visanglex = sizex * visang_perpix;
  28 
  29 if nargin > 1
  30 	visangley = sizey * visang_perpix;
  31 end

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-12-07 12:00:14, 0.9 KB) [[attachment:stimsize2visangle.m]]
  • [get | view] (2009-12-07 11:59:52, 0.9 KB) [[attachment:visangle2stimsize.m]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.