This function returns the Betti numbers b0, b1 and b2, which represents the number of connected components,
the number of independent tunnelsand the number of closed regions in space, respectively.
The function implementation followsthe algorithms described by Konkle, Moran, Hamann, and Joy in the work
Fast Methods for Computing Isosur-face Topology with Betti Numbers.