mlocalhistogram: fixed bugs, use median as reference value for classification of upper and lower level sets