contour region to 2d mask working