smoothing cortex combined left and right cortex [Vnew,Fnew,xx,Indx,ddmin]=vb_morph_cortex(V, F, Nvertex, Radius, step, LR_mode) 皮質の皺を平滑化した平滑化皮質モデルを作る 左右の脳を一つにまとめる --- Input F.F3/F3L/F3R : 面(3角形)を構成する3つの頂点番号 ( 面の数, 3) V : 頂点位置 ( 頂点の数, 3) Nvertex : # of output cortex vertex Radius : morphology radius (mm) step : voxcel size of mask (mm) LR_mode = 'LR' : Left & Right cortex = 'L' : Left cortex = 'R' : Right cortex --- Output Fnew.F3/F3L/F3R : 面(3角形)を構成する3つの頂点番号 ( 面の数, 3) Vnew : 頂点位置 ( 頂点の数, 3) xx : 外向き法線 Indx : Old vertex index list corresponding to new vertex Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Vnew,Fnew,xx,Indx,ddmin] = ... 0002 vb_morph_cortex(V, F, Nvertex, Radius, step, LR_mode) 0003 % smoothing cortex combined left and right cortex 0004 % [Vnew,Fnew,xx,Indx,ddmin]=vb_morph_cortex(V, F, Nvertex, Radius, step, LR_mode) 0005 % 0006 % 皮質の皺を平滑化した平滑化皮質モデルを作る 0007 % 左右の脳を一つにまとめる 0008 %--- Input 0009 % 0010 % F.F3/F3L/F3R : 面(3角形)を構成する3つの頂点番号 ( 面の数, 3) 0011 % V : 頂点位置 ( 頂点の数, 3) 0012 % 0013 % Nvertex : # of output cortex vertex 0014 % Radius : morphology radius (mm) 0015 % step : voxcel size of mask (mm) 0016 % LR_mode = 'LR' : Left & Right cortex 0017 % = 'L' : Left cortex 0018 % = 'R' : Right cortex 0019 % 0020 %--- Output 0021 % 0022 % Fnew.F3/F3L/F3R : 面(3角形)を構成する3つの頂点番号 ( 面の数, 3) 0023 % Vnew : 頂点位置 ( 頂点の数, 3) 0024 % xx : 外向き法線 0025 % Indx : Old vertex index list corresponding to new vertex 0026 % 0027 % Copyright (C) 2011, ATR All Rights Reserved. 0028 % License : New BSD License(see VBMEG_LICENSE.txt) 0029 0030 % 3D 画像処理のための間引きステップサイズ 0031 % subsampling step for mask image [mm] 0032 if ~exist('step','var'), step = 2; end; 0033 0034 % 穴埋め・孤立点削除 (モルフォロジー) 変換の半径 0035 % Radius of Morfology operation [mm] 0036 if ~exist('Radius','var'), Radius = 4; end; 0037 0038 if ~exist('LR_mode','var'), LR_mode = 'LR'; end; 0039 0040 % 0041 % 皮質面を3Dマスクパターンに変換 0042 % 内部の塗りつぶし & モルフォロジー変換 0043 % 0044 [B, Vorgin] = vb_cortex_fill(V,F,step,Radius,LR_mode); 0045 0046 % 境界面抽出 0047 [Fc, Vc, xx] = vb_surf_extract(B, step, Vorgin); 0048 0049 % ボクセル座標から元の座標への変換 [m] 0050 %Vc = vb_trans_vox_to_surf(Vc, Vorgin, step); 0051 Vc = Vc*0.001; 0052 0053 Ndipole = size(Vc,1); 0054 Npatch = size(Fc,1); 0055 0056 % 解像度を下げて皮質点を作成 0057 Fnew.F3 = Fc; 0058 Fnew.F3L = Fc; 0059 Fnew.F3R = []; 0060 Fnew.NdipoleL = Ndipole; 0061 0062 [Vnew, Fnew] = vb_reduce_vertex(Vc,Fnew,Nvertex); 0063 0064 % 法線方向を外向きに揃える 0065 % xx : 外向き法線 0066 [Fc, Vnew, xx, Vmiss] = vb_out_normal( Fnew.F3 ,Vnew); 0067 0068 Fnew.F3 = Fc; 0069 Fnew.F3L = Fc; 0070 Fnew.F3R = []; 0071 Fnew.NdipoleL = size(Vnew,1); 0072 0073 % # of disconnected vertex 0074 fprintf('# of reduced vertex = %d\n', size(Vnew,1)) 0075 fprintf('# of disconnected vertex = %d\n', size(Vmiss,1)) 0076 0077 % 閉局面のチェック: omega = 1 0078 omega = vb_solid_angle_check(Vnew,Fc); 0079 fprintf('Closed surface index (=1) : %f\n', omega) 0080 0081 % Find old vertex point corresponding to new vertex 0082 % Zstep : Number of steps to divide Z-axis 0083 % Rmax : find nearest point within radius Rmax [m] 0084 Zstep = 50; 0085 Rmax = 0.01; 0086 0087 [Indx ,ddmin] = vb_find_nearest_point(V, Vnew, Rmax, Zstep); 0088 0089 fprintf('Max distance between new and old vertex = %f\n',max(ddmin))