0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 clear all
0027 DEBUG=0;
0028
0029
0030 subj_dir = [getenv('MATHOME') '/Retino_TY/'];
0031
0032 analyzefile = [subj_dir '3d.hdr' ];
0033 subj_mask = [subj_dir 'brain_mask.mat'];
0034
0035
0036 fname = [subj_dir 'test_head1.head.mat'];
0037
0038 surf_mode = 0;
0039
0040
0041
0042
0043 Para.Nvertex = 3000;
0044 Para.Radius = [2 4 -4 -2];
0045 Para.vstep = 1 ;
0046 Para.Nloop = 200;
0047 Para.Nlast = 10;
0048
0049
0050 zindx = fix([80:15:200]);
0051
0052 switch surf_mode
0053 case 0
0054
0055
0056
0057 [avw ,Xcenter] = vb_get_brain_mask([subj_mask],'brain','', Para.vstep);
0058
0059
0060 if DEBUG==1,
0061 [xyz] = vb_get_boundary(avw.img);
0062 vb_plot_slice( avw.img, xyz, fix(zindx/Para.vstep), 1, [3, 3], 5);
0063 end
0064
0065
0066
0067
0068 [Vhead, Fhead, XXhead] = vb_mask_to_surf_expand(avw.img, Para);
0069
0070 case 1
0071
0072
0073
0074 load(subj_mask,'XYZspm')
0075 Fhead = XYZspm{2}.F;
0076 Vhead = XYZspm{2}.xyz;
0077
0078 [Vdim, Vsize] = analyze_hdr_read(analyzefile);
0079 Para.Dim = vb_mask_image_size(Vdim,Vsize,Para.vstep);
0080
0081 Vhead = vb_spm_right_to_analyze_right_mm(Vhead, Vdim, Vsize);
0082
0083 [Fhead, Vhead, XXhead] = vb_out_normal(Fhead,Vhead);
0084 [Vhead, Fhead, XXhead] = vb_surf_smooth_expand(Vhead, Fhead, XXhead, Para);
0085 end
0086
0087 [B, Vdim, Vsize] = vb_load_analyze_to_right(analyzefile);
0088
0089
0090 Vana = vb_analyze_mm_to_analyze(Vhead,Vdim,Vsize);
0091
0092
0093
0094
0095 Vhead = vb_analyze_right_mm_to_spm_right(Vhead,Vdim,Vsize);
0096
0097
0098
0099
0100 if exist('fname','var') & ~isempty(fname),
0101 fprintf('Save %s \n',fname)
0102 vb_fsave(fname,'Vhead','Fhead','XXhead')
0103 end
0104
0105
0106
0107
0108 zindx = fix(zindx/Vsize(3));
0109 Nfig = [3 3];
0110
0111 vb_plot_slice_surf(B, Vana, Fhead, zindx, 'z',Nfig,'r-',10, 1);
0112
0113 figure
0114 vb_plot_surf(Vhead,Fhead,[],[],1,1);
0115 view([ -130 10]);
0116
0117 return