Home > functions > common > morphology > vb_smooth_cortex_LR.m

vb_smooth_cortex_LR

PURPOSE ^

smoothing cortex and remove corpus area

SYNOPSIS ^

function [Vnew,Fnew,xxnew,Indx,Vinfo] = vb_smooth_cortex_LR(V, F, Para)

DESCRIPTION ^

 smoothing cortex and remove corpus area
  [Vnew,Fnew,xxnew,Indx,Vinfo] = vb_smooth_cortex_LR(V, F, Para)
--- Input 

 V     : Cortical vertex point cordinate [Nvertex, 3]
 F      : Patch index structure
  .F3R     : Right cortex
  .F3L     : Left  cortex
  .F3     : Left + Right

 Para.Nvertex  = 3000 : Reduced number of cortex
 Para.Dim      : Dimension of mask image
 Para.vstep    : subsampling step size of mask image [mm]
 Para.Nloop    = 200: iteration number for expanding sphere to brain surface
 Para.Nlast    = 0:   iteration number for additional smoothing
 Para.R_fill   = [4] :radius for fill-in cortex surface
 Para.R_smooth = [ 6 6 -6 -6] : radius for morphological smoothing
 Para.R_cut    = [ 6 6 -6 -6 -6 -4] 
               : radius for cut morphed cortex to make elimination mask
--- Output 
 Vnew  : Cortical vertex point cordinate [Nvertex, 3]
 xxnew : Normal vector to cortical surface   [Nvertex, 3]
 Fnew   : Patch index structure
  .F3R     : Right cortex
  .F3L     : Left  cortex
  .F3     : Left + Right
 Vinfo        : Vertex dimension structure
   .Ndipole   : # of vertex
   .NdipoleL  : # of vertex in Left cortex
   .Npatch    : # of patch
   .Coord     = 'Analyze_Right_mm';
 Indx   : Old vertex index list corresponding to new vertex

 --- Method: 皮質の皺を平滑化した平滑化皮質モデルを作る
 左脳皮質を3Dマスクパターンに変換・内部塗りつぶし & モルフォロジー平滑化
 左脳境界面抽出
 右脳皮質を3Dマスクパターンに変換・内部塗りつぶし & モルフォロジー平滑化
 左脳境界面抽出 
 左右脳皮質を3Dマスクパターンに変換・内部塗りつぶし 
 モルフォロジー膨張で左右を合わせる
 脳梁領域に重なる程度にモルフォロジー縮小
 左右脳から脳梁領域削除
 バネモデル平滑化
 頂点を間引く

 Made by M. Sato 2006-3-28

 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  [Vnew,Fnew,xxnew,Indx,Vinfo] = vb_smooth_cortex_LR(V, F, Para)
0002 % smoothing cortex and remove corpus area
0003 %  [Vnew,Fnew,xxnew,Indx,Vinfo] = vb_smooth_cortex_LR(V, F, Para)
0004 %--- Input
0005 %
0006 % V     : Cortical vertex point cordinate [Nvertex, 3]
0007 % F      : Patch index structure
0008 %  .F3R     : Right cortex
0009 %  .F3L     : Left  cortex
0010 %  .F3     : Left + Right
0011 %
0012 % Para.Nvertex  = 3000 : Reduced number of cortex
0013 % Para.Dim      : Dimension of mask image
0014 % Para.vstep    : subsampling step size of mask image [mm]
0015 % Para.Nloop    = 200: iteration number for expanding sphere to brain surface
0016 % Para.Nlast    = 0:   iteration number for additional smoothing
0017 % Para.R_fill   = [4] :radius for fill-in cortex surface
0018 % Para.R_smooth = [ 6 6 -6 -6] : radius for morphological smoothing
0019 % Para.R_cut    = [ 6 6 -6 -6 -6 -4]
0020 %               : radius for cut morphed cortex to make elimination mask
0021 %--- Output
0022 % Vnew  : Cortical vertex point cordinate [Nvertex, 3]
0023 % xxnew : Normal vector to cortical surface   [Nvertex, 3]
0024 % Fnew   : Patch index structure
0025 %  .F3R     : Right cortex
0026 %  .F3L     : Left  cortex
0027 %  .F3     : Left + Right
0028 % Vinfo        : Vertex dimension structure
0029 %   .Ndipole   : # of vertex
0030 %   .NdipoleL  : # of vertex in Left cortex
0031 %   .Npatch    : # of patch
0032 %   .Coord     = 'Analyze_Right_mm';
0033 % Indx   : Old vertex index list corresponding to new vertex
0034 %
0035 % --- Method: 皮質の皺を平滑化した平滑化皮質モデルを作る
0036 % 左脳皮質を3Dマスクパターンに変換・内部塗りつぶし & モルフォロジー平滑化
0037 % 左脳境界面抽出
0038 % 右脳皮質を3Dマスクパターンに変換・内部塗りつぶし & モルフォロジー平滑化
0039 % 左脳境界面抽出
0040 % 左右脳皮質を3Dマスクパターンに変換・内部塗りつぶし
0041 % モルフォロジー膨張で左右を合わせる
0042 % 脳梁領域に重なる程度にモルフォロジー縮小
0043 % 左右脳から脳梁領域削除
0044 % バネモデル平滑化
0045 % 頂点を間引く
0046 %
0047 % Made by M. Sato 2006-3-28
0048 %
0049 % Copyright (C) 2011, ATR All Rights Reserved.
0050 % License : New BSD License(see VBMEG_LICENSE.txt)
0051 
0052 if ~exist('Para','var'), Para = []; end
0053 
0054 if ~isfield(Para,'Dim') | isempty(Para.Dim)
0055     error('Size of mask image is not specified');
0056 else
0057     Dim = Para.Dim;
0058 end
0059 % --- subsampling step for mask image [mm]
0060 % 3D 画像処理のための間引きステップサイズ
0061 if ~isfield(Para,'vstep'), 
0062     error('Step size of mask image is not specified');
0063 else
0064     step = Para.vstep;
0065 end;
0066 
0067 % Reduced number of cortex
0068 if ~isfield(Para,'Nvertex'), 
0069     Nvertex = 3000; 
0070 else
0071     Nvertex = Para.Nvertex;
0072 end;
0073 
0074 % --- Radius of Morfology operation [mm]
0075 % 穴埋め・孤立点削除 (モルフォロジー) 変換の半径
0076 if ~isfield(Para,'R_fill'),
0077       R_fill   = [4]; 
0078 else
0079     R_fill = Para.R_fill;
0080 end;
0081       
0082 if ~isfield(Para,'R_cut'),
0083        R_cut = [ 6 6 -6 -6 -6 -4]; 
0084 else
0085     R_cut = Para.R_cut;
0086 end;
0087 if ~isfield(Para,'R_smooth'),
0088     R_smooth = [ 6 6 -6 -6]; 
0089 else
0090     R_smooth = Para.R_smooth;
0091 end;
0092 
0093 if ~isfield(Para,'Nloop'), Para.Nloop = 200; end
0094 if ~isfield(Para,'Nlast'), Para.Nlast = 0; end
0095 if ~isfield(Para,'tangent_rate'),   Para.tangent_rate   = 0.3; end
0096 if ~isfield(Para,'mask_ratio'),     Para.mask_ratio     = 0.5; end
0097 if ~isfield(Para,'mask_threshold'), Para.mask_threshold = 0.3; end
0098 
0099 if ~isfield(Para,'plot_mode'),
0100     plot_mode = 0;
0101 else
0102     plot_mode = Para.plot_mode;
0103 end;
0104 
0105 %
0106 % 皮質面を3Dマスクパターンに変換
0107 % 内部の塗りつぶし & モルフォロジー変換
0108 %
0109 % --- Make mask to remove central region from LR cortex
0110 [BB] = vb_cortex_fill(V, F, step, R_fill, 'LR', Dim);
0111 
0112 if  plot_mode > 0,
0113     % subplot の 数
0114     Nfig  = [3, 3];
0115     % スライス画像表示の Z-座標リスト
0116     zindx = [10:10:Dim(3)];
0117     fclr = [0.8 0.7 0.6];
0118     eclr = 'w';
0119     light_mode=1;
0120 end
0121 
0122 BB  = vb_morphology_operation(BB, R_cut, step);
0123 
0124 if  plot_mode > 1,
0125     vb_plot_slice( BB, [], zindx, 1, Nfig);
0126 end
0127 
0128 %
0129 % --- Make smooth left cortex
0130 %
0131 B = vb_cortex_fill(V, F, step, R_fill, 'L', Dim);
0132 B = vb_morphology_operation(B, R_smooth, step);
0133 
0134 if  plot_mode > 1,
0135     vb_plot_slice( B, [], zindx, 1, Nfig);
0136 end
0137 
0138 % 境界面抽出
0139 %[FL, VL, xxL] = vb_surf_extract(B, step);
0140 
0141 NL = F.NdipoleL;
0142 [VL,FL,xxL] = vb_make_inner_sphere(V(1:NL,:), Nvertex);
0143 [VL,FL,xxL] = vb_surf_smooth_fit(VL,FL,xxL, B, Para);
0144 
0145 %
0146 % --- Make smooth right cortex
0147 %
0148 B = vb_cortex_fill(V, F, step, R_fill, 'R', Dim);
0149 B = vb_morphology_operation(B, R_smooth, step);
0150 
0151 if  plot_mode > 1,
0152     vb_plot_slice( B, [], zindx, 1, Nfig);
0153 end
0154 
0155 % 境界面抽出
0156 %[FR, VR, xxR] = vb_surf_extract(B, step);
0157 
0158 [VR,FR,xxR] = vb_make_inner_sphere(V((NL+1):end,:), Nvertex, 1);
0159 [VR,FR,xxR] = vb_surf_smooth_fit(VR,FR,xxR, B, Para);
0160 
0161 fprintf('# of left cortex = %d\n',size(VL,1))
0162 fprintf('# of right cortex = %d\n',size(VR,1))
0163 
0164 if Para.Nlast > 0,
0165     % バネモデルで表面平滑化
0166     fprintf('Surface smooth by spring model\n')
0167     tic
0168     Para.Nloop = Para.Nlast;
0169     [VL, FL, xxL] = vb_surf_smooth(VL,FL,xxL,Para);
0170     [VR, FR, xxR] = vb_surf_smooth(VR,FR,xxR,Para);
0171     vb_ptime(toc)
0172 end
0173 
0174 % remove center region vertex by using mask
0175 fprintf('Remove central region from left cortex\n')
0176 
0177 VL_indx = vb_remove_vertex_by_mask(VL,BB,step);
0178 [VL, FL] = vb_trans_index( VL, FL, VL_indx);
0179 
0180 fprintf('Remove central region from right cortex\n')
0181 VR_indx = vb_remove_vertex_by_mask(VR,BB,step);
0182 [VR, FR] = vb_trans_index( VR, FR, VR_indx);
0183 
0184 fprintf('# of left cortex  = %d\n',size(VL,1))
0185 fprintf('# of right cortex = %d\n',size(VR,1))
0186 
0187 % 法線方向を外向きにする
0188 [FL, VL, xxL] = vb_out_normal( FL ,VL);
0189 omega  = vb_solid_angle_check(VL,FL);
0190 fprintf('Closed surface index (=1) for left  cortex: %f\n', omega)
0191 
0192 [FR, VR, xxR] = vb_out_normal( FR ,VR);
0193 omega  = vb_solid_angle_check(VR,FR);
0194 fprintf('Closed surface index (=1) for right cortex: %f\n', omega)
0195 
0196 NdipoleL = size(VL,1);
0197 
0198 Vnew  = [VL ; VR];
0199 xxnew = [xxL; xxR];
0200 
0201 Fnew.F3L = FL;
0202 Fnew.F3R = FR + NdipoleL;
0203 Fnew.F3     = [FL ; FR + NdipoleL];
0204 
0205 Fnew.NdipoleL = NdipoleL;
0206 
0207 Ndipole = size(Vnew,1);
0208 Npatch  = size(Fnew.F3,1);
0209 
0210 % Dimensional info
0211 Vinfo.Ndipole   = Ndipole;
0212 Vinfo.NdipoleL  = NdipoleL;
0213 Vinfo.Npatch    = Npatch;
0214 Vinfo.Coord     = 'Analyze_Right_mm';
0215 
0216 % # of vertex
0217 fprintf('# of vertex  = %d\n', Ndipole) 
0218 
0219 % Find old vertex point corresponding to new vertex
0220 % Zstep : Number of steps to divide Z-axis
0221 % Rmax  : find nearest point within radius Rmax [mm]
0222 Zstep = 100;
0223 Rmax  = 10;
0224 
0225 %return
0226 tic
0227 fprintf('Find original vertex corresponding to the smoothed surface\n')
0228 [Indx ,ddmin] = vb_find_nearest_point(V, Vnew, Rmax, Zstep);
0229 
0230 fprintf('Max distance between new and old vertex = %f\n',max(ddmin))
0231 vb_ptime(toc)
0232 
0233 if Para.plot_mode > 0
0234     dmax = 10;
0235     X0 = mean(Vnew);
0236     F3 = Fnew.F3;
0237     vb_plot_slice_surf( B, Vnew/step, F3, round(X0(1)/step), 'x',[1 1],'r-',dmax);
0238     vb_plot_slice_surf( B, Vnew/step, F3, round(X0(2)/step), 'y',[1 1],'r-',dmax);
0239     vb_plot_slice_surf( B, Vnew/step, F3, round(X0(3)/step), 'z',[1 1],'r-',dmax);
0240 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005