Home > vbmeg > functions > brain > vb_copy_std_atlas_area.m

vb_copy_std_atlas_area

PURPOSE ^

Copy atlas area/act files of standard brain to the same directory of brainfile

SYNOPSIS ^

function vb_copy_std_atlas_area(brainfile, Nvertex)

DESCRIPTION ^

 Copy atlas area/act files of standard brain to the same directory of brainfile

  vb_copy_std_atlas_area(brainfile, Nvertex)

 [history]
 2015-12-27 M. Sato 
   Ver.2.0 New version for group analysis
 2019-12-02 rhayashi
   copy all the area/act files inside standard brain directory.

 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_copy_std_atlas_area(brainfile, Nvertex)
0002 % Copy atlas area/act files of standard brain to the same directory of brainfile
0003 %
0004 %  vb_copy_std_atlas_area(brainfile, Nvertex)
0005 %
0006 % [history]
0007 % 2015-12-27 M. Sato
0008 %   Ver.2.0 New version for group analysis
0009 % 2019-12-02 rhayashi
0010 %   copy all the area/act files inside standard brain directory.
0011 %
0012 % Copyright (C) 2011, ATR All Rights Reserved.
0013 % License : New BSD License(see VBMEG_LICENSE.txt)
0014 
0015 % --- Set standard brain
0016 [std_parm, proj_root] = vb_set_icbm152(Nvertex);
0017 std_dir        = fullfile(std_parm.std_dir, [std_parm.std_id, '_', num2str(std_parm.Nvertex)]);
0018 std_brain_file = fullfile(std_dir, std_parm.brain_file);
0019 std_basename   = strrep(std_brain_file, '.brain.mat', '');
0020 
0021 % search area files inside standard brain directory
0022 tmp_area_files = dir(fullfile(std_dir, 'mni_*.area.mat'));
0023 
0024 % extract std files and its atlas_ids ({'_aal', 'Yeo2011_17Networks', ...})
0025 std_area_files  = cell(0);
0026 atlas_ids        = cell(0);
0027 for k=1:length(tmp_area_files)
0028      std_area_files{k} = fullfile(std_dir, tmp_area_files(k).name);
0029      tmp = strrep(std_area_files{k}, '.area.mat', '');
0030      tmp = strrep(tmp, std_basename, '');
0031      atlas_ids{k} = tmp;
0032 end
0033 
0034 % Copy the standard atlas file with the subject name.
0035 EXT_brain = '.brain.mat';
0036 brain_id  = brainfile(1:findstr(brainfile,EXT_brain)-1);
0037 
0038 for k=1:length(std_area_files)
0039     std_area_file = std_area_files{k};
0040     std_act_file  = strrep(std_area_files{k}, '.area.mat', '.act.mat');
0041     
0042     subj_area_file = [[brain_id, atlas_ids{k}], '.area.mat'];
0043     subj_act_file  = [[brain_id, atlas_ids{k}], '.act.mat'];
0044     
0045     if exist(std_area_file, 'file'), copyfile(std_area_file, subj_area_file); end
0046     if exist(std_act_file, 'file'),  copyfile(std_act_file, subj_act_file); end
0047 end

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