Home > vbmeg > functions > brain > vb_area_to_reduce_brain.m

vb_area_to_reduce_brain

PURPOSE ^

Area index is transformed to area index in the reduced brain model

SYNOPSIS ^

function vb_area_to_reduce_brain(areafile, areakey,reducekey,reduced_areafile)

DESCRIPTION ^

 Area index is transformed to area index in the reduced brain model
   vb_area_to_reduce_brain(areafile, areakey)
   vb_area_to_reduce_brain(areafile, areakey, reducekey,reduced_areafile)
 --- Input
  areafile = 'xxx.area.mat'
  areakey
 --- Optional input
  reducekey : area key to specify reduced brain model
            = 'reduced_cortex' (Default)
  reduced_areafile ; area file for reduced brain model
            = 'xxx_reduced.area.mat' (Default)
 --- Output
 Area index corresponding to areakey
 is converted to the area index in the reduced brain model

 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_area_to_reduce_brain(areafile, areakey, ...
0002                                  reducekey,reduced_areafile)
0003 % Area index is transformed to area index in the reduced brain model
0004 %   vb_area_to_reduce_brain(areafile, areakey)
0005 %   vb_area_to_reduce_brain(areafile, areakey, reducekey,reduced_areafile)
0006 % --- Input
0007 %  areafile = 'xxx.area.mat'
0008 %  areakey
0009 % --- Optional input
0010 %  reducekey : area key to specify reduced brain model
0011 %            = 'reduced_cortex' (Default)
0012 %  reduced_areafile ; area file for reduced brain model
0013 %            = 'xxx_reduced.area.mat' (Default)
0014 % --- Output
0015 % Area index corresponding to areakey
0016 % is converted to the area index in the reduced brain model
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 if ~exist('reducekey','var'), reducekey   = 'reduced_cortex'; end;
0022 
0023 Area  = vb_get_area(areafile,reducekey);
0024 
0025 if isempty(Area), 
0026     fprintf('No reduced brain key : [%s] in [%s]\n',reducekey,areafile)
0027     return
0028 end
0029 
0030 Ixall = Area.Iextract;
0031 Nall  = length(Ixall);
0032 
0033 Area  = vb_get_area(areafile,areakey);
0034 
0035 if isempty(Area), 
0036     fprintf('No area key : [%s] in [%s]\n',areakey,areafile)
0037     return
0038 end
0039 
0040 Vindx = Area.Iextract;
0041 
0042 Nmax = max(max(Vindx),Nall);
0043 Itrans = zeros(Nmax,1);
0044 Itrans(Ixall) = 1:Nall;
0045 
0046 Rindx = Itrans(Vindx);
0047 ixnz  = find( Rindx > 0 );
0048 Rindx = Rindx(ixnz);
0049 
0050 if ~exist('reduced_areafile','var') | isempty(reduced_areafile),
0051     reduced_areafile = vb_change_file_basename(areafile, '_reduce');
0052 end
0053 
0054 AreaNew.key = areakey;
0055 AreaNew.Iextract = Rindx(:);
0056 vb_add_area([reduced_areafile], AreaNew);

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