Add calcul of the distance for a pixel number