Home > vbmeg > demo > sample_scripts > test_vbmeg_version_compatibility.m

test_vbmeg_version_compatibility

PURPOSE ^

Check VBMEG version compatibility.

SYNOPSIS ^

function vb_test_vbmeg_version_compatibility

DESCRIPTION ^

 Check VBMEG version compatibility. 

 This function compares .vbresult.mat files specified at the first part
 of this function. Compared variables, included in .vbresult.mat, are as
 follows: 

 V    : Vertex coordinates of cortical surface model. 
 Vinfl: Vertex coordinates of inflated model. 
 xxP  : Cortical activity map. 
 G    : Leadfield matrix. 
 Z    : Estimated Z-current. 

 [syntax]
 vb_test_vbmeg_version_compatibility

 [note]
 This function refers parameters of VBMEG test condition in
 test_parm. If this parameters does not match, a warning messeage will
 be shown. If vertex number of the two cortical surface models are
 different, this program will stop. 

 [histroy]
 2010-06-30 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function vb_test_vbmeg_version_compatibility
0002 % Check VBMEG version compatibility.
0003 %
0004 % This function compares .vbresult.mat files specified at the first part
0005 % of this function. Compared variables, included in .vbresult.mat, are as
0006 % follows:
0007 %
0008 % V    : Vertex coordinates of cortical surface model.
0009 % Vinfl: Vertex coordinates of inflated model.
0010 % xxP  : Cortical activity map.
0011 % G    : Leadfield matrix.
0012 % Z    : Estimated Z-current.
0013 %
0014 % [syntax]
0015 % vb_test_vbmeg_version_compatibility
0016 %
0017 % [note]
0018 % This function refers parameters of VBMEG test condition in
0019 % test_parm. If this parameters does not match, a warning messeage will
0020 % be shown. If vertex number of the two cortical surface models are
0021 % different, this program will stop.
0022 %
0023 % [histroy]
0024 % 2010-06-30 Taku Yoshioka
0025 %
0026 % Copyright (C) 2011, ATR All Rights Reserved.
0027 % License : New BSD License(see VBMEG_LICENSE.txt)
0028 
0029 %
0030 % .vbresult.mat files to be compared. You can modify filenames here.
0031 %
0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0033 file1 = ['./vbmeg0.80a_test/vbmeg_result_spm5/' ...
0034          'bv_meg_sarvas_fmri_single_spm5.vbresult.mat']
0035 file2 = ['./vbmeg0.82_test/vbmeg_result_spm5/' ...
0036          'bv_meg_sarvas_fmri_single_spm5.vbresult.mat']
0037 
0038 %
0039 % Load data and initial check number of cortical surface model
0040 %
0041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0042 S1 = load(file1);
0043 S2 = load(file2); 
0044 
0045 if isequal(S1.test_parm,S2.test_parm), 
0046   fprintf('There is no any difference in test condition parameters.\n');
0047 else
0048   fprintf(['Warning: There is some differences in test condition ' ...
0049            'parameters.\n']);
0050 end;
0051 
0052 if size(S1.V,1)~=size(S2.V,1), 
0053   fprintf('Vertex numbers of cortical surface models are different.\n');
0054   return; 
0055 end
0056 
0057 %
0058 % Compare variables
0059 %
0060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0061 fprintf('nRMSE of: \n'); 
0062 fprintf('Cortical surface model = %f\n',calc_nRMSE(S1.V,S2.V));
0063 fprintf('Inflated model         = %f\n',calc_nRMSE(S1.Vinfl,S2.Vinfl));
0064 fprintf('Cortical activity map  = %f\n',calc_nRMSE(S1.xxP,S2.xxP));
0065 fprintf('Leadfield matrix       = %f\n',calc_nRMSE(S1.G,S2.G));
0066 fprintf('Z-current              = %f\n',calc_nRMSE(S1.Z,S2.Z));
0067 
0068 return;
0069 
0070 %
0071 % Inner function
0072 %
0073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0074 function err = calc_nRMSE(var1,var2)
0075 norm = sum((var1(:)).^2);
0076 err = sqrt(sum((var1(:)-var2(:)).^2)/norm);
0077 
0078 return;

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