A Topological Sampling Theorem for Robust Boundary Reconstruction and Image Segmentation