Distance computations are now done on meshes rather than images.

The ITK filter for transforming meshes to images has turned out not
to be very reliable (it produces streaks if a mesh has bad quality).
As we cannot control the mesh quality, we chose to do distance computations
on mesh level instead.
Threshold binary image after reading to force it to values 0 and 1
Changed optimizer used for model fitting to gradient descent