0001
0002
0003
0004
0005
0006 fprintf(1,'loading segmented brain image...\n');
0007 for i=1:256
0008 brain(:,:,i)=imread('brain_seg.tif',i);
0009 end
0010 brain=uint8(brain);
0011
0012
0013
0014
0015 fprintf(1,'meshing the segmented brain (this may take a few minutes) ...\n');
0016
0017 [node,elem,face]=v2m(brain,[],2,100,'cgalmesh');
0018
0019 figure
0020 hs=plotmesh(node,face,'y>100');
0021
0022 axis equal;
0023 title('cross-cut view of the generated surface mesh');
0024
0025
0026
0027
0028 fprintf(1,'extracting the right-hemisphere cerebellum white matter surface\n')
0029
0030 LHwhitemat=elem(find(elem(:,5)==5),:);
0031 wmsurf=volface(LHwhitemat(:,1:4));
0032
0033 figure;
0034 hs=plotmesh(node,wmsurf);
0035 axis equal;
0036 title('pre-smoothed cerebellum white matter surface');
0037
0038
0039 fprintf(1,'performing mesh smoothing on the white matter surface\n')
0040
0041 [no,el]=removeisolatednode(node,wmsurf);
0042 wmno=sms(no(:,1:3),el,3,0.5);
0043
0044 figure;
0045 hs=plotmesh(wmno,el);
0046 axis equal;
0047 title('smoothed cerebellum white matter surface of the right-hemisphere');
0048
0049
0050 fprintf(1,'generate volumetric mesh from the smoothed cerebellum white matter surface \n')
0051
0052 [wmnode,wmelem,wmface]=s2m(wmno(:,1:3),el(:,1:3),1,200);