Home > vbmeg > functions > brain > vb_find_near_root.m

vb_find_near_root

PURPOSE ^

Find nearest root point for each vertex & make member list

SYNOPSIS ^

function [member_id] = vb_find_near_root(Vindx,nextIX,nextDD,Rmax)

DESCRIPTION ^

 Find nearest root point for each vertex & make member list
  [member_id] = vb_find_near_member(Vindx,nextIX,nextDD)
 --- Input
 nextIX{i} : Neighbor index list for the vertex-i
 nextDD{i} : Distance from the vertex-i
 Vindx     : Vertex index for root point
 Rmax      : Max radius for neighbor search
 --- Output
 member_id{n} : member vertex index which belog to the root point Vindx(n)

 M. Sato 2006-7-15

 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  [member_id] = vb_find_near_root(Vindx,nextIX,nextDD,Rmax)
0002 % Find nearest root point for each vertex & make member list
0003 %  [member_id] = vb_find_near_member(Vindx,nextIX,nextDD)
0004 % --- Input
0005 % nextIX{i} : Neighbor index list for the vertex-i
0006 % nextDD{i} : Distance from the vertex-i
0007 % Vindx     : Vertex index for root point
0008 % Rmax      : Max radius for neighbor search
0009 % --- Output
0010 % member_id{n} : member vertex index which belog to the root point Vindx(n)
0011 %
0012 % M. Sato 2006-7-15
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 % Total number of vertex in the original brain
0018 Nall  = length(nextDD);
0019 Nroot = length(Vindx);
0020 
0021 % Index transform table for root points
0022 Itrans = zeros(Nall,1);
0023 Itrans(Vindx) = 1:Nroot;
0024 
0025 member_id = cell(Nroot,1);
0026 
0027 for n=1:Nroot
0028     member_id{n} = Vindx(n);
0029 end
0030 
0031 Mindx = find( Itrans == 0 );
0032 
0033 for m=1:length(Mindx)
0034     % neighbor distance & index
0035     n  = Mindx(m);
0036     dd = nextDD{n};
0037     id = nextIX{n};
0038     
0039     % find nearest root
0040     ix = find( Itrans(id) > 0 & dd > 0);
0041     [dmin, imin] = min(dd(ix));
0042     
0043     if isempty(imin) | dmin > Rmax , continue; end;
0044     
0045     % root index
0046     jj = id(ix(imin(1)));
0047     k  = Itrans(jj);
0048     member_id{k} = [member_id{k}, n];
0049 end

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