%%function im=imthresh(data,thresh)
%%Thresholds image data (multiple thresholds are ok)

function im=imthresh(data,thresh)

thresh=sort(thresh); %added JL 2000-06-20
data=double(data);
classes=length(thresh);
colstep=64/classes;

im=(data>thresh(classes)).*colstep*classes;

for i=1:classes-1
        im=im + ( ( (data>thresh(i)) & (data<=thresh(i+1)) ).*colstep*(i) );
end
