function [times,row,col] = ridges(a,Kcol,Krow);
%   label topographic simple ridges in an image
%       [times,row,col] = ridges(a,Kcol,Krow)
%
%  ridges: uses 1D quadratic fit to extract ridge pixels
%          groups neighbors into labeled simple (no branches) ridge segments
%
%  on input:
%
%    a:     2D array of heights at pixels
%    Kcol:  number of column elements to fit parameter 
%    Krow:  number of row elements to fit parameter 
%
%  on output:
%
%    times: 	    2x5 matrix of the timings of the functions used :
% 			1 = ridge1
%			2 = labelr8
%			3 = simridge
%			4 = simlabel
%			5 = rthinc (or rthinr)
%    row:	    2D array of labeled row ridge segments
%    col:	    2D array of labeled column ridge segments
%
%  Authors:	Tom Henderson/Scott Morris
%		Univ of Utah
%		8 Sept 1996
%

times = zeros(2,5);

[icx,ice,ich,icr,irx,ire,irh,irr] = tgraph(a,Kcol,Krow);
tic
rcol = ridge1(ich);
times(1,1) = toc;

tic
lcol = labelr8(rcol);
times(1,2) = toc;

tic
scol = simridge(lcol);
times(1,3)= toc;

tic
scol2 = simlabel(scol);
times(1,4) = toc;

tic
col = rthinc(scol2,ich);
times(1,5) = toc;

%%%%%%%%%%% Switch to processing the rows image

tic
rrow = ridge1(irh);
times(2,1) = toc;

tic
lrow = labelr8(rrow);
times(2,2) = toc;

tic
srow = simridge(lrow);
times(2,3) = toc;

tic
srow2 = simlabel(srow);
times(2,4) = toc;

tic
row = rthinr(srow2,irh);
times(2,5) = toc;




