Home > vbmeg > functions > common > morphology > vb_upsample_3d.m

vb_upsample_3d

PURPOSE ^

upsampling by two

SYNOPSIS ^

function BB = vb_upsample_3d(B)

DESCRIPTION ^

 upsampling by two

 B : 3D-image

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    BB = vb_upsample_3d(B)
0002 % upsampling by two
0003 %
0004 % B : 3D-image
0005 %
0006 % Copyright (C) 2011, ATR All Rights Reserved.
0007 % License : New BSD License(see VBMEG_LICENSE.txt)
0008 
0009 % データの繰り返し数
0010 % upsampling step
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 % upsampling
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 % neighbor index list for boundary detection
0035 % (X-axis) 隣接点インデックス
0036 j1d = 1:step:(N1-1);
0037 j1u = 2:step:N1;
0038 % (Y-axis) 隣接点インデックス
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

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005