Home > functions > common > boundary > vb_get_cortex_surf_from_std.m

vb_get_cortex_surf_from_std

PURPOSE ^

Transform standard brain model to an individual brain

SYNOPSIS ^

function [V,F,xx,Vinfo,indx] = vb_get_cortex_surf_from_std(std_brain_file,snfile)

DESCRIPTION ^

 Transform standard brain model to an individual brain 
 -- Usage
 [V,F,xx,Vinfo] = vb_get_cortex_surf_from_std(std_brain_file,snfile)
  
%% --- Required Parameter
 std_brain_file : Standard brain model file (.brain.mat)
 snfile : coordinate transform file for coregistration to standard brain

 Masa-aki Sato 2009-9-30

 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 [V,F,xx,Vinfo,indx] = vb_get_cortex_surf_from_std(std_brain_file,snfile)
0002 % Transform standard brain model to an individual brain
0003 % -- Usage
0004 % [V,F,xx,Vinfo] = vb_get_cortex_surf_from_std(std_brain_file,snfile)
0005 %
0006 %%% --- Required Parameter
0007 % std_brain_file : Standard brain model file (.brain.mat)
0008 % snfile : coordinate transform file for coregistration to standard brain
0009 %
0010 % Masa-aki Sato 2009-9-30
0011 %
0012 % Copyright (C) 2011, ATR All Rights Reserved.
0013 % License : New BSD License(see VBMEG_LICENSE.txt)
0014 
0015 [V,F,xx] = vb_load_cortex(std_brain_file);
0016 
0017 % Convert to subject SPM-right coordinate
0018 if nargin==2 && ~isempty(snfile)
0019     sn = load(deblank(snfile)); 
0020     V = vb_unsn( V'*1000, sn)'*0.001;  
0021 end
0022 
0023 NP = size(V,1);
0024 NL = F.NdipoleL;
0025 
0026 % Left/Right hemisphere normal vector
0027 normal_mode = 0;
0028 [F1, V1, xx1, indx1] = vb_out_normal_surf(F.F3L,V(1:NL,:), normal_mode);
0029 [F2, V2, xx2, indx2] = vb_out_normal_surf(F.F3R - NL,V(NL+1:end,:), normal_mode);
0030 
0031 omega1  = vb_solid_angle_check(V1,F1);
0032 omega2  = vb_solid_angle_check(V2,F2);
0033 
0034 fprintf('omegaL/4pi = %e\n',omega1);
0035 fprintf('omegaR/4pi = %e\n',omega2);
0036 
0037 V  = [V1 ; V2];
0038 xx = [xx1; xx2];
0039 indx = [indx1; indx2 + NL];
0040 NL = size(V1,1);
0041 
0042 Ndipole = size(V,1);
0043 
0044 fprintf('Original Vertex = %d , New = %d\n',NP, Ndipole)
0045 fprintf('Original Left Vertex = %d , New = %d\n',F.NdipoleL, NL)
0046 
0047 % Left/Right hemisphere patch
0048 F.F3L = F1;
0049 F.F3R = F2 + NL;
0050 F.F3  = [F.F3L ; F.F3R];
0051 F.NdipoleL = NL;
0052 
0053 % Dimensional info
0054 Vinfo.NdipoleL  = NL ;
0055 Vinfo.Ndipole   = Ndipole;
0056 Vinfo.Npatch    = size(F,1);
0057 Vinfo.Coord     = 'SPM_Right_m';
0058 
0059 return
0060 
0061 
0062 % SPM Standard brain cortex in MNI-mm coordinate (origin in MNI-space)
0063 load(std_brain_file,'vert','face','normal')
0064 
0065 sn = load(deblank(snfile)); 
0066 
0067 % Convert to subject SPM-right coordinate
0068 V = vb_unsn( vert', sn)'*0.001;  
0069 
0070 [V,F,xx] = vb_separate_LR_cortex(V,face);

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