distance transform with a nice interface