function g = getrow(a,i0,j0)
%
% getrow: return the indexes to the  row neighbors of (i0,j0) which are ~=0
% On input:
%     a:     2D array of labeled ridge segments
%     i0:    i index of starting point
%     j0:    j index of starting point
% On output:
%     g:    indexes of non-zero row neighbors of (i0,j0)
% Call:
%     g = getrow(a,i0,j0)
%  Authors:	Tom Henderson
%		Univ of Utah
%		8 Sept 1996
%

[m,n] = size(a);
g = [i0,j0];
j1 = j0-1;
while j1>0
  if a(i0,j1)>0
    g = [g; i0,j1];
    j1 = j1-1;
  else
    j1 = 0;
  end
end
j1 = j0+1;
while j1<=n
  if a(i0,j1)>0
    g = [g; i0,j1];
   j1 = j1+1;
  else
    j1 = n+1;
  end
end
