Home > functions > job > job_select_area_dir > inverse_filter.m

inverse_filter

PURPOSE ^

[F,ix,meg_filt,Tperiod,Tnext] = inverse_filter(resultfile,ix0)

SYNOPSIS ^

function [F,ix,meg_filt,Tperiod,Tnext] = inverse_filter(resultfile,ix0)

DESCRIPTION ^

 [F,ix,meg_filt,Tperiod,Tnext] = inverse_filter(resultfile,ix0)

 Return inverse filters based on the parameters saved in a 
 specified result file. In current version, the number of 
 leadfield components in the inverse filter calculation must be
 one (L=1). If not so, the function will not work correctly. 

 2004-09-19 Taku Yoshioka

 --- Input parameters
 resultfile: .bayes.mat file which has the inverse filter params. 
 ix0       : Indices of the area of interest. If it is empty, 
             all of the dipoles for estimation are included 
             in the filter. 

 --- 
 F       : Inverse filter, I-by-N matrices (I=length(ix)). 
 ix      : Indices of the union of ix0 and indices of the dipoles 
           caclulated by the original inverse filters.
 meg_filt: Analysis time window. 
 Tperiod : Size of analysis time window
 Tnext   : 


 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 [F,ix,meg_filt,Tperiod,Tnext] = inverse_filter(resultfile,ix0)
0002 % [F,ix,meg_filt,Tperiod,Tnext] = inverse_filter(resultfile,ix0)
0003 %
0004 % Return inverse filters based on the parameters saved in a
0005 % specified result file. In current version, the number of
0006 % leadfield components in the inverse filter calculation must be
0007 % one (L=1). If not so, the function will not work correctly.
0008 %
0009 % 2004-09-19 Taku Yoshioka
0010 %
0011 % --- Input parameters
0012 % resultfile: .bayes.mat file which has the inverse filter params.
0013 % ix0       : Indices of the area of interest. If it is empty,
0014 %             all of the dipoles for estimation are included
0015 %             in the filter.
0016 %
0017 % ---
0018 % F       : Inverse filter, I-by-N matrices (I=length(ix)).
0019 % ix      : Indices of the union of ix0 and indices of the dipoles
0020 %           caclulated by the original inverse filters.
0021 % meg_filt: Analysis time window.
0022 % Tperiod : Size of analysis time window
0023 % Tnext   :
0024 %
0025 %
0026 % Copyright (C) 2011, ATR All Rights Reserved.
0027 % License : New BSD License(see VBMEG_LICENSE.txt)
0028 
0029 load(resultfile,'bayes_parm','Model','basis','Cov',...
0030      'ix_fine','W','bsnorm');
0031 
0032 % NOT support multiple sessions (2005-01-12)
0033 if iscell(basis)
0034   fprintf(['.bayes.mat file contains estimation results for ' ...
0035        '%d sessions\n'],length(basis'));
0036   fprintf('Only the result of the first session is used.\n');
0037   basis = basis{1};
0038   Cov = Cov{1};
0039   bsnorm = bsnorm(1);
0040 end
0041 
0042 if nargin==1 | isempty(ix0)
0043   ix0 = ix_fine;
0044 end
0045 
0046 N = size(Model.a,2); % Number of filters
0047 
0048 switch bayes_parm.mode
0049  case {1,2} % Distributed current estimation
0050   [ix,ia,ib] = intersect(ix_fine,ix0);
0051   WW = W(ia,:); % Smoothing filter in interested region
0052   F = zeros(length(ix),size(Cov,1),N);
0053   a = size(WW,1)*size(WW,2);
0054   b = size(F,1)*size(F,2);
0055   
0056   for i = 1:size(Model.a,2)
0057     F0 = meg_filter_old(Model.a(:,i),basis,Cov);
0058     if b<a
0059       F(:,:,i) = WW*((1/bsnorm)*F0);
0060     else
0061       F(:,:,i) = ((1/bsnorm)*WW)*F0;
0062     end
0063   end
0064 
0065  otherwise,
0066   error(['Estimation mode ' num2str(bayes_parm.mode) ...
0067      ' has not been supported.']);
0068 end
0069 
0070 % parameters of time windows
0071 meg_filt = bayes_parm.meg_filt;
0072 if isfield(bayes_parm,'Tperiod')
0073   Tperiod = bayes_parm.Tperiod;
0074   Tnext = bayes_parm.Tnext; 
0075 elseif length(meg_filt)==2
0076   Tperiod = meg_filt(2)-meg_filt(1)+1;
0077   Tnext = Tperiod;
0078 else
0079   Tperiod = meg_filt(3)-meg_filt(2)+1;
0080   Tnext = Tperiod;
0081 end
0082 
0083 
0084

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