Home > FR3DSource > xNeighborhood.m

xNeighborhood

PURPOSE ^

xNeighborhood(File,Indices,v,MaxDiff,MaxInsert) returns indices "near"

SYNOPSIS ^

function [NewIndices] = xNeighborhood(File,Indices,v,Display)

DESCRIPTION ^

 xNeighborhood(File,Indices,v,MaxDiff,MaxInsert) returns indices "near"
 the given indices, in a way determined by the code v

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % xNeighborhood(File,Indices,v,MaxDiff,MaxInsert) returns indices "near"
0002 % the given indices, in a way determined by the code v
0003 
0004 function [NewIndices] = xNeighborhood(File,Indices,v,Display)
0005 
0006 MaxDiff = Display.MaxDiff;
0007 MaxInsert = Display.MaxInsert;
0008 
0009 p = Display.p;
0010 
0011 N = length(Indices);
0012 
0013 switch v,
0014   case 0,
0015     NewIndices = Indices;
0016   case 1,
0017     NewIndices = Indices;
0018     for n = 1:(N-1),
0019       if (MaxDiff(n) < Inf) | (MaxInsert(n) < 16),   % if only few insertions
0020         NewIndices = [NewIndices (Indices(n)+1):(Indices(n+1)-1)];
0021       end
0022     end
0023   case 2,
0024     NewIndices = Indices;
0025     for n = 1:(N-1),
0026       if (MaxDiff(n) < Inf) | (MaxInsert(n) < 20),   % if only few insertions
0027         NewIndices = [NewIndices (Indices(n)+1):(Indices(n+1)-1)];
0028       end
0029     end
0030   otherwise,
0031     d = [1 1 6 8 10];
0032     a = zeros(1,File.NumNT);
0033     for j=1:length(Indices),
0034       a = a + (File.Distance(Indices(j),:) < d(v)) .* ...
0035               (File.Distance(Indices(j),:) > 0);
0036     end
0037     a(Indices) = zeros(1,length(Indices));  % take out ones in Indices
0038     B = find(a);
0039     NewIndices = [Indices B];
0040 end
0041 
0042 NewIndices = sort(NewIndices);
0043 
0044 % it should make sure there are no duplicates in NewIndices
0045 % it should check File to make sure that everything in NewIndices really
0046 % is present in File, otherwise something will crash

Generated on Fri 03-Apr-2009 09:52:35 by m2html © 2003