Distance transformation algorithm implemented