Home > functions > tool_box > atlas2vb_dir > vb_try_atlas_correct.m

vb_try_atlas_correct

PURPOSE ^

Correct holes and islands in atlas label by morphology

SYNOPSIS ^

function Act = vb_try_atlas_correct(brainfile,atlasfile,atlas_id)

DESCRIPTION ^

 Correct holes and islands in atlas label by morphology
   [Atlas] = vb_try_atlas_correct
   [Atlas] = vb_try_atlas_correct(brainfile,atlasfile,atlas_id)
 --- Optional Input
  If input is not given, file name is asked by vb_file_select
 brainfile
 atlasfile
 atlas_id
 --- Output
 Atlas : structure of atlas label
 Atlas.xxP        : label value for each vertex
 Atlas.label      : label value
 Atlas.label_name : label_name corresponding to 'label'
 

 2006-11-12 M. 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  Act = vb_try_atlas_correct(brainfile,atlasfile,atlas_id)
0002 % Correct holes and islands in atlas label by morphology
0003 %   [Atlas] = vb_try_atlas_correct
0004 %   [Atlas] = vb_try_atlas_correct(brainfile,atlasfile,atlas_id)
0005 % --- Optional Input
0006 %  If input is not given, file name is asked by vb_file_select
0007 % brainfile
0008 % atlasfile
0009 % atlas_id
0010 % --- Output
0011 % Atlas : structure of atlas label
0012 % Atlas.xxP        : label value for each vertex
0013 % Atlas.label      : label value
0014 % Atlas.label_name : label_name corresponding to 'label'
0015 %
0016 %
0017 % 2006-11-12 M. Sato
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 DEBUG = 0;
0023 
0024 if DEBUG == 1,
0025     proj_root = [getenv('MATHOME') '/Retino_TY'];
0026     MRI_ID    = 'Retino_TY';
0027     brainfile = [proj_root '/' MRI_ID '.brain.mat'];
0028     atlasfile = [proj_root '/' MRI_ID   '.atlas.mat' ];    
0029     atlas_id = 'aal';
0030     atlas_id = 'brodmann';
0031 end
0032 
0033 % Select Brain & Atlas file
0034 if ~exist('brainfile','var')
0035     [pathname, filename] = vb_file_select({'.brain.mat'}, 'Select brain file');
0036     if isempty(filename), return; end;
0037     brainfile = fullfile(pathname, filename{1})
0038 end
0039 
0040 if ~exist('atlasfile','var')
0041     [pathname, filename] = vb_file_select({'.atlas.mat'}, 'Select atlas file');
0042     if isempty(filename), return; end;
0043     atlasfile = fullfile(pathname, filename{1})
0044 end
0045 
0046 if ~exist('atlas_id','var')
0047     prompt = 'Enter atlas key.';
0048     answer = inputdlg(prompt,'Atlas key',1, {'brodmann'});
0049     atlas_id = answer{1}
0050 end
0051 
0052 % Para.Rlabel : max radius for morphology  [m]
0053 % Para.rate : number less than rate*(# of largest region) is deleted
0054 switch    atlas_id
0055 case    'aal'
0056     Para.Rlabel = 0.01;% [m]
0057     Para.rate   = 0.6;
0058 case    'brodmann'
0059     Para.Rlabel = 0.012;% [m]
0060     Para.rate   = 0.3;
0061 end
0062 
0063 prompt = {['Enter elimination ratio.' ...
0064            ' Increasing it eliminate larger islands']};
0065 answer = inputdlg(prompt,'Ratio',1, {num2str(Para.rate)});
0066 Para.rate = str2num(answer{1})
0067 
0068 % load atlas
0069 Atlas = vb_get_act(atlasfile,atlas_id);
0070 
0071 % Correct_atlas_label
0072 switch    atlas_id
0073 case    'aal'
0074     Act   = vb_correct_atlas_label(Atlas,brainfile,Para);
0075 case    'brodmann'
0076     Act   = vb_correct_atlas_label_LR(Atlas,brainfile,Para);
0077 end
0078 
0079 vb_plot_atlas_area(brainfile,Act);
0080 
0081 vb_plot_atlas2(brainfile,Act);
0082 
0083 return

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