Home > functions > plotfunc > check_model > vb_check_sphere.m

vb_check_sphere

PURPOSE ^

Check sphere model in 3D image

SYNOPSIS ^

function vb_check_sphere(brainfile,megfile,Vradius)

DESCRIPTION ^

 Check sphere model in 3D image
  vb_check_sphere(brainfile, megfile, Vradius)

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    vb_check_sphere(brainfile,megfile,Vradius)
0002 % Check sphere model in 3D image
0003 %  vb_check_sphere(brainfile, megfile, Vradius)
0004 %
0005 % Copyright (C) 2011, ATR All Rights Reserved.
0006 % License : New BSD License(see VBMEG_LICENSE.txt)
0007 
0008 if ~exist('Vradius','var') || isempty(Vradius)
0009     Vradius = 0.08; 
0010 else 
0011     Vradius = Vradius; 
0012 end;
0013 
0014 %brainfile   = [proj_root '/' brain_parm.brain_file];
0015 %megfile     = [proj_root '/' meg_parm.meg_file];
0016 %if iscell(megfile), megfile = megfile{1}; end;
0017 
0018 % Load sensor and sphere center position
0019 [pick,Qpick,Wsensor,Vcenter] = vb_load_sensor(megfile);
0020 
0021 % Load brain model
0022 [V,F] = vb_load_cortex(brainfile);
0023 F     = F.F3;
0024 
0025 % Number of fig in subplot
0026 NY           = 2;    % Number of fig. in Y
0027 NX           = 2;    % Number of fig. in X
0028 
0029 % plot color
0030 fclr = [0.9 0.7 0.6];
0031 eclr = 'none';
0032 
0033 light_mode = 1;
0034 max_mode   = 0;
0035 
0036 % View angle definition
0037 vangle = [ 0  90; 90 0 ; 180 0 ; 0 0 ];
0038 NV       = size(vangle,1);
0039 
0040 [sx,sy,sz]=sphere; 
0041 sdim = size(sx);
0042 sx = sx*Vradius + repmat(Vcenter(1),sdim); 
0043 sy = sy*Vradius + repmat(Vcenter(2),sdim);
0044 sz = sz*Vradius + repmat(Vcenter(3),sdim);
0045 
0046 figure;
0047 
0048 for n=1:NV,
0049     subplot(NY,NX,n);
0050 
0051     % plot brain
0052     vb_plot_surf(V, F, fclr,eclr,light_mode,max_mode)
0053     hold on; 
0054     surf(sx,sy,sz);
0055        view( vangle(n,:) ); 
0056     xlabel('X')
0057     ylabel('Y')
0058     zlabel('Z')
0059     alpha(0.2);
0060 end
0061 
0062 subplot(NY,NX,1);
0063 title('Sphere model overlapped on brain model')
0064

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005