Home > vbmeg > functions > common > container > vb_rm_area.m

vb_rm_area

PURPOSE ^

This function is used to remove cortical area data.

SYNOPSIS ^

function vb_rm_area(areafile,area_key,flag)

DESCRIPTION ^

 This function is used to remove cortical area data. 

 --- Syntax
 vb_rm_area(areafile,area_key,flag)

 --- Input
 areafile: Cortical area file (.area.mat)
 area_key: ID of area information to be removed

 --- Optional input
 - flag  : If OFF, confirmation dialog will be suppressed. 

 --- Output

 --- Example
 >> areafile = './TY/data/TY.area.mat';
 >> area_key = 'tmp';
 >> vb_rm_area(areafile,area_key);

 --- History
 2004-12-27 Taku Yoshioka
 2006-08-11 Taku Yoshioka (dialog suppression flag)

 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_rm_area(areafile,area_key,flag)
0002 % This function is used to remove cortical area data.
0003 %
0004 % --- Syntax
0005 % vb_rm_area(areafile,area_key,flag)
0006 %
0007 % --- Input
0008 % areafile: Cortical area file (.area.mat)
0009 % area_key: ID of area information to be removed
0010 %
0011 % --- Optional input
0012 % - flag  : If OFF, confirmation dialog will be suppressed.
0013 %
0014 % --- Output
0015 %
0016 % --- Example
0017 % >> areafile = './TY/data/TY.area.mat';
0018 % >> area_key = 'tmp';
0019 % >> vb_rm_area(areafile,area_key);
0020 %
0021 % --- History
0022 % 2004-12-27 Taku Yoshioka
0023 % 2006-08-11 Taku Yoshioka (dialog suppression flag)
0024 %
0025 % Copyright (C) 2011, ATR All Rights Reserved.
0026 % License : New BSD License(see VBMEG_LICENSE.txt)
0027 
0028 if nargin<3, flag=ON; end
0029 Area = [];
0030 if exist(areafile) == 2
0031   load(areafile);
0032   % Support for old version
0033   if ~exist('MRI_ID'), 
0034     MRI_ID = '0000000';
0035     disp(['--- Area file ''' areafile ''' is a old version, ' ...
0036       'in which variable ''MRI_ID'' is not saved. A tentative ' ...
0037       'ID ''0000000'' was automatically assigned to the area ' ...
0038       'file.']);
0039   end
0040 else
0041   disp('Area data file is not found.');
0042   return;
0043 end
0044 
0045 for i = 1:length(Area)
0046   if strcmp(area_key,Area{i}.key)
0047     AreaNew = cell(length(Area)-1,1);
0048     for j = 1:i-1
0049       AreaNew{j} = Area{j};
0050     end
0051     for j = i+1:length(Area)
0052       AreaNew{j-1} = Area{j};
0053     end
0054     Area = AreaNew;
0055     vb_fsave(areafile,'Area','MRI_ID');
0056     if flag,
0057       h = msgbox(['Area ''' area_key ''' was removed.']);
0058       uiwait(h);
0059     end
0060     return;
0061   end
0062 end
0063 
0064 error(['Area ''' area_key ''' is not found.']);
0065

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