0001 function BB = vb_upsample_3d(B)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 step = 2;
0012
0013 [N1,N2,N3] = size(B);
0014 N1 = N1*step;
0015 N2 = N2*step;
0016 N3 = N3*step;
0017
0018 BB = zeros(N1,N2,N3);
0019
0020
0021
0022 BB(1:step:N1,1:step:N2,1:step:N3) = B;
0023 BB(2:step:N1,1:step:N2,1:step:N3) = B;
0024 BB(1:step:N1,2:step:N2,1:step:N3) = B;
0025 BB(2:step:N1,2:step:N2,1:step:N3) = B;
0026
0027 BB(1:step:N1,1:step:N2,2:step:N3) = B;
0028 BB(2:step:N1,1:step:N2,2:step:N3) = B;
0029 BB(1:step:N1,2:step:N2,2:step:N3) = B;
0030 BB(2:step:N1,2:step:N2,2:step:N3) = B;
0031
0032 return
0033
0034
0035
0036 j1d = 1:step:(N1-1);
0037 j1u = 2:step:N1;
0038
0039 j2d = 1:step:(N2-1);
0040 j2u = 2:step:N2;
0041
0042
0043 for zz = 1:N3
0044 B(j1d, : , zz ) = B(j1d, : , zz ) + B(j1u, : , zz );
0045 end
0046
0047 for zz = 1:N3
0048 B( : ,j2d, zz ) = B( : ,j2d, zz ) + B( : ,j2u, zz );
0049 end
0050
0051 for zz = 1:(N3-1)
0052 B(:,:,zz) = B(:,:,zz) + B(:,:,zz+1);
0053 end
0054
0055
0056