Home > functions > leadfield > vb_make_ascii.m

vb_make_ascii

PURPOSE ^

SYNOPSIS ^

function vb_make_ascii(bemfile,brainfile,megfile,Nreduce)

DESCRIPTION ^

 境界モデルと電源モデルをascii形式ファイルに変換するプログラム。
 電源モデル(ダイポール方向)に対する正規化モードは1。

 bemfile  : 境界モデルファイル(センサ座標に変換済)
 brainfile: 脳モデルファイル
 megfile  : MEGファイル(センサ位置)
 Nreduce  : 境界モデル三角面削減率(オプション)

 2004-01-15 Taku Yoshioka


 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 vb_make_ascii(bemfile,brainfile,megfile,Nreduce)
0002 %
0003 % 境界モデルと電源モデルをascii形式ファイルに変換するプログラム。
0004 % 電源モデル(ダイポール方向)に対する正規化モードは1。
0005 %
0006 % bemfile  : 境界モデルファイル(センサ座標に変換済)
0007 % brainfile: 脳モデルファイル
0008 % megfile  : MEGファイル(センサ位置)
0009 % Nreduce  : 境界モデル三角面削減率(オプション)
0010 %
0011 % 2004-01-15 Taku Yoshioka
0012 %
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 %
0018 % 電流双極子の位置と方向
0019 %
0020 if ~isempty(brainfile)
0021   load(brainfile,'V','F','xx','xxF');
0022 
0023   % Mean patch normal vector
0024   xx = vb_mean_normal_vector_1(1:size(V,1),F,V,xx);
0025   % Mean of patch normal at next-neighbor
0026   xx= vb_mean_normal_vector_4(1:size(V,1),F,V,xx,xxF);
0027 
0028   V0 = [V xx];
0029 
0030   % 脳モデルasciiファイル
0031   filename = strrep(brainfile,'.brain.mat','.V0.brain.mat');
0032   save('-ascii',filename,'V0');
0033   fprintf('''%s'' is created.\n',filename);
0034 end
0035 
0036 %
0037 % 境界面の面と頂点
0038 %
0039 if ~isempty(bemfile)
0040   load(bemfile,'Vhead','Fhead','XXhead');
0041   if exist('Nreduce') & Nreduce<size(Vhead,1)
0042     [Fnew,Vnew] = reducepatch(Fhead,Vhead,Nreduce/size(Vhead,1));
0043     ix = vb_find_match_point(Vhead,Vnew,10);
0044     XXhead = XXhead(ix,:);
0045     Vhead = Vnew;
0046     Fhead = Fnew;
0047   end
0048   Fhead = Fhead-1;
0049 
0050   % 境界モデルasciiファイル
0051   if exist('Nreduce') & Nreduce~=1
0052     filename = strrep(bemfile,'.head.mat',...
0053               sprintf('_%d.Vhead.head.mat',Nreduce));
0054     save('-ascii',filename,'Vhead');
0055     fprintf('''%s'' is created.\n',filename);
0056     filename = strrep(bemfile,'.head.mat',...
0057               sprintf('_%d.Fhead.head.mat',Nreduce));
0058     save('-ascii',filename,'Fhead');
0059     fprintf('''%s'' is created.\n',filename);
0060     filename = strrep(bemfile,'.head.mat',...
0061               sprintf('_%d.XXhead.head.mat',Nreduce));
0062     save('-ascii',filename,'XXhead');
0063     fprintf('''%s'' is created.\n',filename);
0064   else
0065     filename = strrep(bemfile,'.head.mat','.Vhead.head.mat');
0066     save('-ascii',filename,'Vhead');
0067     fprintf('''%s'' is created.\n',filename);
0068     filename = strrep(bemfile,'.head.mat','.Fhead.head.mat');
0069     save('-ascii',filename,'Fhead');
0070     fprintf('''%s'' is created.\n',filename);
0071     filename = strrep(bemfile,'.head.mat','.XXhead.head.mat');
0072     save('-ascii',filename,'XXhead');
0073     fprintf('''%s'' is created.\n',filename);
0074   end
0075 end
0076 
0077 %
0078 % センサ位置と方向
0079 %
0080 if ~isempty(megfile)
0081   load(megfile,'pick');
0082   filename = strrep(megfile,'.meg.mat','.pick.meg.mat');
0083   save('-ascii',filename,'pick');
0084   fprintf('''%s'' is created.\n',filename);
0085 end

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