Home > vbmeg > functions > job > subdirectory > 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_root,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_root,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 if isempty(proj_root)
0102     brain_file = [brain_parm.brain_file];
0103 else
0104     brain_file = [proj_root filesep brain_parm.brain_file];
0105 end
0106 load([brain_file],'BV_index','Vinfo');
0107 
0108 V2L = V0L(BV_index.Left ,:);
0109 V2R = V0R(BV_index.Right-Vinfo.NdipoleL0,:);
0110 
0111 inf_LC    = LColor(BV_index.Left ,:);
0112 inf_RC    = RColor(BV_index.Right-Vinfo.NdipoleL0,:);
0113 
0114 switch filetype, 
0115  case 'BrainVoyager', 
0116   %
0117   % --- Analyze voxcel coordinate
0118   %
0119   % [Right-hand coordinate]
0120   % X: Left   -> Right
0121   % Y: Back   -> Front
0122   % Z: Bottom -> Top
0123 
0124   V2L = vb_bvoyger_to_vox(V2L);
0125   V2R = vb_bvoyger_to_vox(V2R);
0126 
0127   inf_V3L = vb_vox_to_analyze_right(V2L);
0128   inf_V3R = vb_vox_to_analyze_right(V2R);
0129   
0130  case 'FreeSurfer', 
0131   inf_V3L = V2L; 
0132   inf_V3R = V2R; 
0133 end; 
0134 
0135 % Total vertex
0136 % inf_V3 -> V
0137 Vinflate = [inf_V3L ; inf_V3R];   
0138 inf_C     = [inf_LC  ; inf_RC ];

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005