Home > functions > brain > vb_make_inflate_data.m

vb_make_inflate_data

PURPOSE ^

Incorporate inflated model of Brain Voyager/FreeSurfer.

SYNOPSIS ^

function [Vinflate,inf_C] = vb_make_inflate_data(proj_root, brain_parm)

DESCRIPTION ^

 Incorporate inflated model of Brain Voyager/FreeSurfer. 
 These data are associated with the cortical surface model from which 
 inflate or flat map are created. This function needs .brain.mat file,
 created based on the brain surface data, to make correspondence 
 of vertices between the original brain and inflated model. 
 Variables 'BV_index'  in .brain.mat file are used to make
 correspondence, i.e., reduction of vertices from the brain
 surface data to VBMEG cortical surface model (.brain.mat). 

 [syntax]
 [Vinflate,inf_C] = vb_make_inflate_data(proj_coor,brain_parm)

 [input]
 proj_root : <<string>> VBMEG project root directory. 
 brain_parm: <<structure>> Parameters for creating inflated model
 --- fields of brain_parm
  brain_file  : <<string>> Filename of .brain.mat file

  (parameters for BrainVoyager inflated model)
  BV_left_infl_file : <<string>> Brain-Voyager left  inflate file
  BV_right_infl_file: <<string>> Brain-Voyager right inflate file

  (parameters for FreeSurfer inflated model)
  FS_left_infl_file : <<string>> FreeSurfer left inflate file
  FS_right_infl_file: <<string>> FreeSurfer right inflate file
  FS_left_curv_file : <<string>> FreeSurfer left curvature file
  FS_right_curv_file: <<string>> FreeSurfer right curvature file
 ---

 [output]
 Vinflate: <<matrix>> Inflate model vertex
 inf_C   : <<vector>> Color corresponding to curvature

 [history]
 Ver 1.0 written by M. Sato  2003-3-15
 Ver 2.0  modified by M. Sato  2005-4-8
  SPM right-handed coordinate system is emplyoed. 
 Ver 2.1  modified by M. Sato  2005-8-9
  Drastic revision of variables.
 2010-05-28 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 [Vinflate,inf_C] = vb_make_inflate_data(proj_root, brain_parm)
0002 % Incorporate inflated model of Brain Voyager/FreeSurfer.
0003 % These data are associated with the cortical surface model from which
0004 % inflate or flat map are created. This function needs .brain.mat file,
0005 % created based on the brain surface data, to make correspondence
0006 % of vertices between the original brain and inflated model.
0007 % Variables 'BV_index'  in .brain.mat file are used to make
0008 % correspondence, i.e., reduction of vertices from the brain
0009 % surface data to VBMEG cortical surface model (.brain.mat).
0010 %
0011 % [syntax]
0012 % [Vinflate,inf_C] = vb_make_inflate_data(proj_coor,brain_parm)
0013 %
0014 % [input]
0015 % proj_root : <<string>> VBMEG project root directory.
0016 % brain_parm: <<structure>> Parameters for creating inflated model
0017 % --- fields of brain_parm
0018 %  brain_file  : <<string>> Filename of .brain.mat file
0019 %
0020 %  (parameters for BrainVoyager inflated model)
0021 %  BV_left_infl_file : <<string>> Brain-Voyager left  inflate file
0022 %  BV_right_infl_file: <<string>> Brain-Voyager right inflate file
0023 %
0024 %  (parameters for FreeSurfer inflated model)
0025 %  FS_left_infl_file : <<string>> FreeSurfer left inflate file
0026 %  FS_right_infl_file: <<string>> FreeSurfer right inflate file
0027 %  FS_left_curv_file : <<string>> FreeSurfer left curvature file
0028 %  FS_right_curv_file: <<string>> FreeSurfer right curvature file
0029 % ---
0030 %
0031 % [output]
0032 % Vinflate: <<matrix>> Inflate model vertex
0033 % inf_C   : <<vector>> Color corresponding to curvature
0034 %
0035 % [history]
0036 % Ver 1.0 written by M. Sato  2003-3-15
0037 % Ver 2.0  modified by M. Sato  2005-4-8
0038 %  SPM right-handed coordinate system is emplyoed.
0039 % Ver 2.1  modified by M. Sato  2005-8-9
0040 %  Drastic revision of variables.
0041 % 2010-05-28 Taku Yoshioka
0042 %  Minor change (verbose level support)
0043 %
0044 % Copyright (C) 2011, ATR All Rights Reserved.
0045 % License : New BSD License(see VBMEG_LICENSE.txt)
0046 
0047 %
0048 % --- Brain-Voyager coordinate
0049 %
0050 % [Left-hand coordinate]
0051 % X:Front(0) -> Back(255)
0052 % Y:Top(0)   -> Bottom(255)
0053 % Z:Right(0) -> Left(255)
0054 
0055 % V0L, V0R, LColor, RColor
0056 tic; 
0057 if isfield(brain_parm,'BV_left_infl_file') & ...
0058       ~isempty(brain_parm.BV_left_infl_file),
0059   vb_disp_nonl('Make inflate model using BrainVoyager SRF files: ');
0060   filetype = 'BrainVoyager'; 
0061   
0062   Srf = vb_ScriptLoadSRF(brain_parm.BV_left_infl_file);
0063 
0064   V0L    = [Srf.VertexX, Srf.VertexY, Srf.VertexZ]; 
0065   LColor = Srf.MeshColor;
0066 
0067   Srf    = vb_ScriptLoadSRF(brain_parm.BV_right_infl_file);
0068 
0069   V0R    = [Srf.VertexX, Srf.VertexY, Srf.VertexZ]; 
0070   RColor = Srf.MeshColor;
0071 
0072   clear Srf
0073 elseif isfield(brain_parm,'FS_left_infl_file') & ...
0074       ~isempty(brain_parm.FS_left_infl_file), 
0075   vb_disp_nonl('Make inflate model using FreeSurfer .asc files: ');
0076   filetype = 'FreeSurfer'; 
0077   
0078   [V0L,F0L] = vb_fs_load_surface(brain_parm.FS_left_infl_file);
0079   [V0R,F0R] = vb_fs_load_surface(brain_parm.FS_right_infl_file);
0080   
0081   clear F0L F0R
0082   
0083   [N0L,LColor] = vb_fs_load_normal(brain_parm.FS_left_curv_file);
0084   [N0R,RColor] = vb_fs_load_normal(brain_parm.FS_right_curv_file);
0085 
0086   xmean = mean([V0L(:,1); V0R(:,1)]);
0087   xwidth = max(abs([V0L(:,1); V0R(:,1)])-xmean);
0088   V0L(:,1) = V0L(:,1)-xwidth; 
0089   V0R(:,1) = V0R(:,1)+xwidth; 
0090   
0091   LColor = (sign(LColor)+1)/2; 
0092   RColor = (sign(RColor)+1)/2; 
0093   
0094   clear N0L N0R
0095 end
0096 vb_disp(sprintf('%f[sec]',toc));
0097 
0098 %
0099 % --- redeuce patchs
0100 %
0101 load([proj_root filesep brain_parm.brain_file],'BV_index','Vinfo');
0102 
0103 V2L = V0L(BV_index.Left ,:);
0104 V2R = V0R(BV_index.Right-Vinfo.NdipoleL0,:);
0105 
0106 inf_LC    = LColor(BV_index.Left ,:);
0107 inf_RC    = RColor(BV_index.Right-Vinfo.NdipoleL0,:);
0108 
0109 switch filetype, 
0110  case 'BrainVoyager', 
0111   %
0112   % --- Analyze voxcel coordinate
0113   %
0114   % [Right-hand coordinate]
0115   % X: Left   -> Right
0116   % Y: Back   -> Front
0117   % Z: Bottom -> Top
0118 
0119   V2L = vb_bvoyger_to_vox(V2L);
0120   V2R = vb_bvoyger_to_vox(V2R);
0121 
0122   inf_V3L = vb_vox_to_analyze_right(V2L);
0123   inf_V3R = vb_vox_to_analyze_right(V2R);
0124   
0125  case 'FreeSurfer', 
0126   inf_V3L = V2L; 
0127   inf_V3R = V2R; 
0128 end; 
0129 
0130 % Total vertex
0131 % inf_V3 -> V
0132 Vinflate = [inf_V3L ; inf_V3R];   
0133 inf_C     = [inf_LC  ; inf_RC ];

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