multiple level thresholding