Custom filtering by smoothing and thresholding