0001 function vb_check_head_plot(proj_root, head_parm, mode)
0002
0003
0004
0005
0006 if nargin<3, mode=0; end;
0007
0008
0009 brainfile = head_parm.brain_file ;
0010 analyzefile = head_parm.analyze_file;
0011
0012 if iscell(head_parm.head_file)
0013 head_file = head_parm.head_file;
0014 else
0015 head_file = {head_parm.head_file};
0016 end
0017
0018 Nhead = length(head_file);
0019
0020
0021 for n=1:Nhead
0022 if isempty(proj_root)
0023 headfile = [head_file{n}];
0024 else
0025 headfile = [proj_root '/' head_file{n}];
0026 end
0027 if mode < 2
0028 headsave{n} = change_name(headfile, head_parm.Nvertex);
0029 else
0030 headsave{n} = headfile;
0031 end
0032 end
0033
0034 switch mode
0035 case {0,2}
0036
0037 vb_plot_slice_head(headsave,analyzefile,brainfile);
0038
0039
0040 vb_plot_head_surf(headsave{1}, brainfile)
0041
0042 vangle = [40 25 ; -130 10];
0043
0044 view(vangle(2,:))
0045 alpha(0.9);
0046
0047 case {1,3}
0048 for n=1:Nhead
0049 vb_plot_slice_head(headsave{n}, analyzefile, brainfile);
0050 end
0051 end
0052
0053 if Nhead == 1, return; end;
0054
0055 figure;
0056
0057 if isfield(head_parm,'face_file') && ~isempty(head_parm.face_file),
0058 load(head_parm.face_file)
0059
0060 if exist('surf_face','var')
0061 if isfield(surf_face,'V_reduce')
0062 V = surf_face.V_reduce;
0063 F = surf_face.F_reduce;
0064 elseif isfield(surf_face,'V')
0065 V = surf_face.V;
0066 F = surf_face.F;
0067 end
0068 end
0069
0070 vb_plot_surf(V,F,[],[],1,1);
0071 hold on
0072 end
0073
0074 load(headsave{Nhead})
0075 vb_plot_surf(Vhead,Fhead,'none','k');
0076 alpha 0.9;
0077
0078 return
0079
0080
0081
0082 function fnew = change_name(fold, N);
0083
0084 fext = '.head.mat';
0085 ix_ext = findstr(fold, fext);
0086
0087 if ~isempty(ix_ext),
0088 basename = fold(1:ix_ext-1);
0089 else
0090 basename = fold;
0091 end
0092
0093 fnew = sprintf('%s_%d%s', basename, N, fext);