Probabilistic Image Segmentation with Closedness Constraints