Home > functions > common > loadfunc > vb_load_current_z.m

vb_load_current_z

PURPOSE ^

load estimated current

SYNOPSIS ^

function [Zact,ix_act] =vb_load_current_z(currfile,curr_type,ave_mode,trial,ix_area);

DESCRIPTION ^

 load estimated current

 USAGE:
  [Jact,ix_act] = ...
            vb_load_current_z(currfile,curr_type,ave_mode,trial,ix_area);

 --- INPUT:
  currfile  - current file name
 --- Optional INPUT:
  curr_type - current type 
            = 0 : J-current : original vertex current [Default]
            = 1 : Z-current : internal current 
                              correspond to locally spread source
     If currfile is old format, curr_type is neglected
     and Jact is returned
  ave_mode : trial average mode
          = ON  : trial average is done
          = OFF : No trial average
  trial   : trial number to load 
            if empty, all trials are loaded
  ix_area : (absolute) vertex index to load
            if empty, all vertices are loaded
 --- OUTPUT:
 ix_act  : Vertex index corresponding to current
 Jact    : current in focal region
   Jact(Nact,Nsample)          for ave_mode = ON 
   Jact(Nact,Nsample,Ntrials)  for ave_mode = OFF
     Nact     = Lact * Nvact,  Nvact = length(ix_act)
     Nsample  : # of time sample, 
     Ntrials  : # of trials in all session]

   Jact( n + Nvact*(i-1), t, :) 
    current at the vertex 'ix_act(n)', 'i-th' direction, time index 't'

   Time sample in MEG data : t_meg = Tsample(t)
   Time (ms)   in MEG data : t_ms  = (t_meg - Pretrigger)*(1000/SampleFreq)


 2007-3-5 Masa-aki Sato
 2008-7-9 Masa-aki Sato

 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 [Zact,ix_act] = ...
0002             vb_load_current_z(currfile,curr_type,ave_mode,trial,ix_area);
0003 % load estimated current
0004 %
0005 % USAGE:
0006 %  [Jact,ix_act] = ...
0007 %            vb_load_current_z(currfile,curr_type,ave_mode,trial,ix_area);
0008 %
0009 % --- INPUT:
0010 %  currfile  - current file name
0011 % --- Optional INPUT:
0012 %  curr_type - current type
0013 %            = 0 : J-current : original vertex current [Default]
0014 %            = 1 : Z-current : internal current
0015 %                              correspond to locally spread source
0016 %     If currfile is old format, curr_type is neglected
0017 %     and Jact is returned
0018 %  ave_mode : trial average mode
0019 %          = ON  : trial average is done
0020 %          = OFF : No trial average
0021 %  trial   : trial number to load
0022 %            if empty, all trials are loaded
0023 %  ix_area : (absolute) vertex index to load
0024 %            if empty, all vertices are loaded
0025 % --- OUTPUT:
0026 % ix_act  : Vertex index corresponding to current
0027 % Jact    : current in focal region
0028 %   Jact(Nact,Nsample)          for ave_mode = ON
0029 %   Jact(Nact,Nsample,Ntrials)  for ave_mode = OFF
0030 %     Nact     = Lact * Nvact,  Nvact = length(ix_act)
0031 %     Nsample  : # of time sample,
0032 %     Ntrials  : # of trials in all session]
0033 %
0034 %   Jact( n + Nvact*(i-1), t, :)
0035 %    current at the vertex 'ix_act(n)', 'i-th' direction, time index 't'
0036 %
0037 %   Time sample in MEG data : t_meg = Tsample(t)
0038 %   Time (ms)   in MEG data : t_ms  = (t_meg - Pretrigger)*(1000/SampleFreq)
0039 %
0040 %
0041 % 2007-3-5 Masa-aki Sato
0042 % 2008-7-9 Masa-aki Sato
0043 %
0044 % Copyright (C) 2011, ATR All Rights Reserved.
0045 % License : New BSD License(see VBMEG_LICENSE.txt)
0046 
0047 if ~exist('curr_type','var'), curr_type = 0; end;
0048 if ~exist('ave_mode','var'), ave_mode = ON; end;
0049 if ~exist('trial','var'), trial = []; end;
0050 if ~exist('ix_area','var'), ix_area = []; end;
0051 
0052 load(currfile)
0053 
0054 if ~exist('Zact','var') 
0055     error(['There is no Zact in ' currfile])
0056 end
0057 
0058 [NJ, T, Ntrial] = size(Zact);
0059 if isempty(trial), trial = 1:Ntrial; end;
0060 
0061 % find selected area index
0062 if curr_type==0
0063     [ix_act_ex, jx_act_ex, ix_act, jx_act, Wact, Lact] = ...
0064       vb_current_area_info(Jinfo,ix_area);
0065 else
0066     [ix_act, jx_act] = vb_current_area_info_z(Jinfo,ix_area);
0067 end
0068 
0069 Zact = Zact(jx_act,:,trial);
0070 
0071 if ave_mode==ON,
0072     Zact = mean(Zact,3);
0073 end
0074 
0075 if curr_type==0
0076     Zact = vb_convert_current_j(Zact, Wact, Lact);
0077     ix_act = ix_act_ex; 
0078 end
0079

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