Home > vbmeg > 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 % Load sensor and sphere center position
0015 [pick,Qpick,Wsensor,Vcenter] = vb_load_sensor(megfile);
0016 
0017 % Load brain model
0018 [V,F] = vb_load_cortex(brainfile, 'subj');
0019 if ~isempty(F)
0020     F     = F.F3;
0021 end
0022 
0023 % Number of fig in subplot
0024 NY           = 2;    % Number of fig. in Y
0025 NX           = 2;    % Number of fig. in X
0026 
0027 % plot color
0028 fclr = [0.72 0.59 0.45];
0029 
0030 % View angle definition
0031 vangle = [ 0  90; 90 0 ; 180 0 ; 0 0 ];
0032 NV       = size(vangle,1);
0033 
0034 [sx,sy,sz]=sphere; 
0035 sdim = size(sx);
0036 sx = sx*Vradius + repmat(Vcenter(1),sdim); 
0037 sy = sy*Vradius + repmat(Vcenter(2),sdim);
0038 sz = sz*Vradius + repmat(Vcenter(3),sdim);
0039 
0040 figure;
0041 
0042 for n=1:NV
0043     subplot(NY,NX,n);
0044 
0045     % plot brain
0046     plot3(V(:, 1), V(:, 2), V(:, 3), '.', 'Color', fclr);
0047     hold on; 
0048     surf(sx,sy,sz);
0049        view( vangle(n,:) ); 
0050     xlabel('X')
0051     ylabel('Y')
0052     zlabel('Z')
0053     alpha(0.2);
0054     axis equal;
0055     axis tight;
0056 end
0057 
0058 subplot(NY,NX,1);
0059 title('Sphere model overlapped on brain model')
0060

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005