morphological thinning of a 2D binary image based on a set of structing elements