ENH: Threshold an image based on a given quantile