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

vb_neighbor_smooth_3d

PURPOSE ^

averaging by nearest neighbor

SYNOPSIS ^

function B = vb_neighbor_smooth_3d(B)

DESCRIPTION ^

 averaging by nearest neighbor
 B = vb_neighbor_smooth_3d(B)
 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    B = vb_neighbor_smooth_3d(B)
0002 % averaging by nearest neighbor
0003 % B = vb_neighbor_smooth_3d(B)
0004 % B : 3D-image
0005 %
0006 % Copyright (C) 2011, ATR All Rights Reserved.
0007 % License : New BSD License(see VBMEG_LICENSE.txt)
0008 
0009 [N1,N2,N3] = size(B);
0010 
0011 % データの間引き間隔
0012 % subsampling step
0013 step = 2;
0014 
0015 % neighbor index list for boundary detection
0016 % (X-axis) 隣接点インデックス
0017 j1d = 1:(N1-1);
0018 j1u = 2:N1;
0019 % (Y-axis) 隣接点インデックス
0020 j2d = 1:(N2-1);
0021 j2u = 2:N2;
0022 
0023 % 前後左右上下に動かし平均化
0024 for zz = 1:N3
0025     B(j1d, : , zz ) = B(j1d, : , zz ) + B(j1u, : , zz );
0026 end
0027 
0028 for zz = 1:N3
0029     B( : ,j2d, zz ) = B( : ,j2d, zz ) + B( : ,j2u, zz );
0030 end
0031 
0032 for zz = 1:(N3-1)
0033     B(:,:,zz) = B(:,:,zz) + B(:,:,zz+1);
0034 end
0035 
0036 B = B/8;
0037 
0038

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