In this paper, we focus on the retrospective topology correction of surfaces. We propose a technique to accurately correct the spherical topology of cortical surfaces. Specifically, we construct a mapping from the original surface onto the sphere to detect topological defects as minimal nonhomeomorphic regions. The topology of each defect is then corrected by opening and sealing the surface along a set of nonseparating loops that are selected in a Bayesian framework. The proposed method is a wholly self-contained topology correction algorithm, which determines geometrically accurate, topologically correct solutions based on the magnetic resonance imaging (MRI) intensity profile and the expected local curvature. Applied to real data, our method provides topological corrections similar to those made by a trained operator.