function t = ctopo(f)
%
% ctopo: labels ridges and ravines
%
% On input:
%    f: 2D image function
%
% On output:
%    t: 2D labeled image
%       0: no topo feature
%       1: ravine
%       2: ridge
%

g3 = gauss(1,3);
fg = conv2tch(f,g3);
fc = curltopo(fg);
fridge = nmsdir(fc.*(fc>0));
fravine = nmsdir(-fc.*(fc<0));

t = (fravine>0) + 2*(fridge>0);
