0001
0002
0003
0004 clear all
0005 pack
0006
0007 udir= [getenv('MATHOME') '/SBIdata-new/BEM/head/'];
0008
0009 fname='100008d-bem.voxel.mat';
0010
0011
0012 load([udir fname]);
0013
0014
0015 step = 2;
0016
0017 vlevel = 0.5;
0018
0019 R = 5;
0020
0021 profile_on = 0;
0022
0023
0024 [N1,N2,N3] = size(voxel);
0025 voxel = voxel( 1:step:N1, 1:step:N2, 1:step:N3 );
0026 [N1,N2,N3] = size(voxel);
0027
0028 ix = find( voxel > vlevel);
0029 voxel = zeros(N1,N2,N3);
0030 voxel(ix) = 1;
0031
0032
0033
0034
0035
0036
0037
0038 if profile_on == 0,
0039 tic
0040 elseif profile_on > 0,
0041 profile off
0042 profile on -detail builtin
0043 tic
0044 end;
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 B = vb_erosion_3d(voxel,R);
0063 vb_ptime(toc);tic
0064 B1 = erosion_3d_bak(voxel,R);
0065 vb_ptime(toc);tic
0066
0067
0068
0069 B1 = double(B1);
0070 B2 = B1 - B;
0071 err1 = sum(abs(B(:) - B1(:)))
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082 if profile_on==0,
0083 vb_ptime(toc)
0084 elseif profile_on==1,
0085 vb_ptime(toc)
0086 if vb_matlab_version >= 7
0087 profile off
0088 profsave(profile('info'),'profile_job')
0089 else
0090 profile report profile_job
0091 end
0092 elseif profile_on==2,
0093 vb_ptime(toc)
0094 profile viewer
0095 end
0096
0097 return
0098
0099
0100 mode = 4;
0101 zindx = [100 , 100, 180];
0102 slice = {'x'; 'y'; 'z'};
0103
0104 zindx = [130:10:160];
0105 slice = 'z';
0106 NX=2;
0107 NY=2;
0108
0109 figure;
0110
0111 nfig = length(zindx);
0112
0113 for n=1:nfig
0114 subplot(NX,NY,n);
0115 vb_plot_3d_image(B, zindx(n), mode, slice);
0116 title([slice '-slice (' num2str(zindx(n),3) ')'])
0117
0118
0119 end;
0120
0121 return
0122
0123 vangle = [80 30];
0124 fcolor = [0.9, 0.8, 0.8];
0125 egcolor = 'k';
0126
0127
0128 patch('Faces',F,'Vertices',V,'FaceColor',fcolor,'EdgeColor',egcolor);
0129
0130
0131
0132
0133
0134 lighting phong;
0135 material dull;
0136
0137 view(vangle);
0138 axis equal
0139
0140 zoomrate=1.5;
0141
0142 zoom(zoomrate);