0001 function vb_check_sphere_slice(brainfile,megfile,analyzefile,Vradius)
0002
0003
0004
0005
0006
0007 if ~exist('Vradius','var') || isempty(Vradius)
0008 Vradius = 75;
0009 else
0010 Vradius = Vradius*1000;
0011 end
0012
0013
0014
0015
0016
0017 if ~exist(analyzefile,'file'),
0018 fprintf('There is no analyze file: %s\n',analyzefile)
0019 fprintf('Check of sphere model is skipped\n')
0020 return
0021 end
0022
0023 if iscell(megfile), megfile = megfile{1}; end;
0024
0025
0026 [pick,Qpick,Wsensor,Vcenter] = vb_load_sensor(megfile);
0027
0028
0029 [V] = vb_load_cortex(brainfile, 'subj');
0030
0031
0032 [B, Vdim, Vsize] = vb_load_analyze_to_right(analyzefile);
0033
0034
0035 Scenter = vb_spm_right_to_analyze_right(Vcenter(:)',Vdim,Vsize);
0036 Vana = vb_spm_right_to_analyze_right(V,Vdim,Vsize);
0037
0038 vdim = ['x';'y';'z'];
0039 sindx = round(Scenter);
0040 xyindx = [ 2 3 ; 1 3; 1 2];
0041 step = 1;
0042 xymode = 0;
0043 Msize = 4;
0044 Mtype = 'y.';
0045
0046 NX = 3; NY = 1;
0047
0048 T = 1000;
0049 t = (0:T)*(2/T);
0050 x = Vradius*cos(pi*t);
0051 y = Vradius*sin(pi*t);
0052
0053 figure;
0054
0055 for n=1:3
0056 subplot(NY,NX,n);
0057 vb_plot_3d_image(B,sindx(n),vdim(n),xymode);
0058 hold on
0059 vb_plot_vertex(Vana, vdim(n), sindx(n), step, Msize, Mtype, xymode);
0060 plot(x/Vsize(n) + Scenter(xyindx(n,1)), y/Vsize(n) + Scenter(xyindx(n,2)), '-r');
0061 end
0062
0063 subplot(NY,NX,2);
0064 title('Sphere and cortex model on MRI slice')
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079