Home > functions > brain > vb_original_normal_statics.m

vb_original_normal_statics

PURPOSE ^

Find original vertex near the cortical vertex

SYNOPSIS ^

function normal_stat = vb_original_normal_statics(proj_root,brain_parm)

DESCRIPTION ^

 Find original vertex near the cortical vertex
  normal_stat = vb_original_normal_statics(proj_root,brain_parm)
 --- Input
 proj_root
 brain_parm
  brain_parm.R_normal : Max radius of neighbor search
 --- Output
 normal_stat.neighbor_org : original brain neighbor index list
 normal_stat.normal_org   : original brain normal vector

 [history]
 M. Sato  2006-7-14
 2010-05-26 Taku Yoshioka
  Minor change (verbose level support)

 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  normal_stat = vb_original_normal_statics(proj_root,brain_parm)
0002 % Find original vertex near the cortical vertex
0003 %  normal_stat = vb_original_normal_statics(proj_root,brain_parm)
0004 % --- Input
0005 % proj_root
0006 % brain_parm
0007 %  brain_parm.R_normal : Max radius of neighbor search
0008 % --- Output
0009 % normal_stat.neighbor_org : original brain neighbor index list
0010 % normal_stat.normal_org   : original brain normal vector
0011 %
0012 % [history]
0013 % M. Sato  2006-7-14
0014 % 2010-05-26 Taku Yoshioka
0015 %  Minor change (verbose level support)
0016 %
0017 % Copyright (C) 2011, ATR All Rights Reserved.
0018 % License : New BSD License(see VBMEG_LICENSE.txt)
0019 
0020 brain_file  = [proj_root filesep brain_parm.brain_file];
0021 
0022 % Max radius of neighbor search
0023 if isfield(brain_parm,'R_normal')
0024     Rmax = brain_parm.R_normal; 
0025 else
0026     Rmax = 0.004;    % 4mm
0027 end
0028 
0029 %
0030 % --- Load original brain
0031 %
0032 vb_disp('Load original brain')
0033 [V0L,F0L,n0L,V0R,F0R,n0R] = vb_load_orig_brain_surf(brain_parm);
0034 %
0035 % --- SPM cordinate in [m] , Normal vector is outward.
0036 %
0037 vb_disp('Change coordinate to [m] ');
0038 
0039 V0L = V0L/1000;
0040 V0R = V0R/1000;
0041 
0042 %
0043 % --- Set normal direction outward
0044 %     normal vector for disconnected vertex is set to zero
0045 tic
0046 vb_disp_nonl('Set normal direction outward: ')
0047 [F0L, V0L, xxL] = vb_out_normal_surf(F0L,V0L);
0048 
0049 xxsig = sign( sum( n0L .* xxL , 2) );
0050 n0L = n0L .* repmat(xxsig, [1 3]);
0051 
0052 [F0R, V0R, xxR] = vb_out_normal_surf(F0R,V0R);
0053 
0054 xxsig = sign( sum( n0R .* xxR , 2) );
0055 n0R = n0R .* repmat(xxsig, [1 3]);
0056 vb_disp(sprintf('%f[sec]',toc));
0057 %vb_ptime(toc)
0058 
0059 % Original vertex index for cortex
0060 load(brain_file,'BV_index')
0061 
0062 NV0L  = size(V0L,1);
0063 indxL = BV_index.Left;
0064 indxR = BV_index.Right;
0065 
0066 if min(indxR) > NV0L,
0067     indxR = indxR - NV0L;
0068 end
0069 
0070 %
0071 % Search neighbor points along cortex sheet
0072 % and calculate normal direction statistics
0073 %
0074 
0075 %
0076 % --- Make neighbor member list of original brain (Left)
0077 %
0078 tic
0079 vb_disp_nonl('Find neighbor index (Left): ')
0080 [xxD,xxF]   = vb_next_distance( F0L, V0L ); 
0081 vb_disp(sprintf('%f[sec]',toc));
0082 %vb_ptime(toc)
0083 
0084 vb_disp_nonl('Make neighbor member list of original brain (Left): ')
0085 tic
0086 Llist  = vb_find_near_member(xxF, xxD, indxL, Rmax);
0087 vb_disp(sprintf('%f[sec]',toc));
0088 %vb_ptime(toc)
0089 
0090 %
0091 % --- Make neighbor member list of original brain (Right)
0092 %
0093 tic
0094 vb_disp_nonl('Find neighbor index (Right): ')
0095 [xxD,xxF]   = vb_next_distance( F0R, V0R ); 
0096 vb_disp(sprintf('%f[sec]',toc));
0097 %vb_ptime(toc)
0098 
0099 vb_disp_nonl('Make neighbor member list of original brain (Right): ')
0100 tic
0101 Rlist  = vb_find_near_member(xxF, xxD, indxR, Rmax);
0102 vb_disp(sprintf('%f[sec]',toc));
0103 %vb_ptime(toc)
0104 
0105 clear V0R F0R V0L F0L xxD xxF  BV_index
0106 
0107 %
0108 % --- Merge member list
0109 %
0110 
0111 %tic
0112 vb_disp('Merge neighbor index')
0113 
0114 NL = length(Llist);
0115 NR = length(Rlist);
0116 
0117 neighbor = cell(NL+NR,1);
0118 
0119 for n=1:NL
0120     neighbor{n} = Llist{n};
0121 end
0122 
0123 for n=1:NR
0124     neighbor{n + NL} = Rlist{n} + NV0L;
0125 end
0126 
0127 normal = [n0L; n0R];
0128 
0129 %vb_ptime(toc)
0130 
0131 normal_stat.neighbor_org = neighbor;
0132 normal_stat.normal_org   = normal;
0133 
0134 %fprintf('Save neighbor statics in the original brain\n')
0135 %vb_save(brain_file,'normal_stat')

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