The distance program calculates exact Euclidean distances using a fast and simple four pass algorithm. The key to the approach is varying the size of the neighborhood search according to the current distance value at each point in the image. The proof of the correctness of this method is described in Mohamad Seaidoun's PhD dissertation. If you are interested in the details you are welcome to look at the code. (see code)
distance [options] infile outfile
[-d] Print debugging information
[-e] Calculate exact distances
[-p #] Number of passes (default=4)
TO BE ADDED