function a = lslice(al,l)
%
% lslice: slice one gray level in an image to another
% On input:
%     al:
%     l:
% On output:
%     a:
% Call:
%     a = lslice(al,l)
%

[m,n] = size(al);
a = al;
[lmax,two] = size(l);
if lmax>0
  for i1 = 1:m
    for j1 = 1:n
      label1 = al(i1,j1);
	  for l1 = 1:lmax
	    if label1 == l(l1,1)
		  a(i1,j1) = l(l1,2);
		end
	  end
	end
  end
end
