All scripts sort of work, I even get to reproduce the results of vertical distance. Now it's time to modify the mask so I can condition the distances to inner-outer.
New implementation of the histogram finished. Now it shows measure errors.