Thinning algorithm for 3D binary images and skeletonization.