Home > functions > tool_box > atlas2vb_dir > vb_correct_atlas_label_repeat.m

vb_correct_atlas_label_repeat

PURPOSE ^

Correct holes and islands in atlas label

SYNOPSIS ^

function vb_correct_atlas_label_repeat(Para)

DESCRIPTION ^

 Correct holes and islands in atlas label
   vb_correct_atlas_label_repeat(atlasfile,brainfile,Para)
 Para.atlasfile
 Para.atlasout
 Para.brainfile

 Para.Rlabel : max radius for morphology  [mm]
 Para.rate : number less than rate*(# of largest region) is deleted
 Para.Nmin : number less than Nmin is deleted
 Para.Ncorrect : number of repeat
 Para.Nfinal : target number of Unlabeled points

 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_correct_atlas_label_repeat(Para)
0002 % Correct holes and islands in atlas label
0003 %   vb_correct_atlas_label_repeat(atlasfile,brainfile,Para)
0004 % Para.atlasfile
0005 % Para.atlasout
0006 % Para.brainfile
0007 %
0008 % Para.Rlabel : max radius for morphology  [mm]
0009 % Para.rate : number less than rate*(# of largest region) is deleted
0010 % Para.Nmin : number less than Nmin is deleted
0011 % Para.Ncorrect : number of repeat
0012 % Para.Nfinal : target number of Unlabeled points
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 % number of iteration for atlas correction
0018 Ncorrect_min = 5;
0019 
0020 if isfield(Para,'Ncorrect')
0021     Ncorrect  = Para.Ncorrect;
0022 else
0023     Ncorrect  = 15;
0024 end
0025 if isfield(Para,'Nfinal')
0026     Nfinal  = Para.Nfinal;
0027 else
0028     Nfinal  = 0;
0029 end
0030 
0031 load(Para.atlasfile);
0032 
0033 Atlas = Act{1};
0034 
0035 Non_label = sum( Atlas.xxP == 0 );
0036 if Non_label==0, return; end;
0037 
0038 %
0039 % --- Correct atlas by removing disconnected vertex and filling holes
0040 %
0041 for n=1:Ncorrect
0042     fprintf('Iteration = %d\n',n)
0043     
0044     [Atlas,result] = vb_correct_atlas_label(Atlas, Para.brainfile, Para);
0045     
0046     if result == 0, break; end;
0047     
0048     Non_label = sum( Atlas.xxP == 0 );
0049     if Non_label <= Nfinal,  break; end;
0050     if n > Ncorrect_min && Non_old <= Non_label
0051         break;
0052     end
0053     Non_old = Non_label;
0054 end
0055 
0056 if isfield(Para,'atlasout')
0057     vb_add_act(Para.atlasout, Atlas, [],false);
0058 end

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