Implement geodesic reconstruction by dilation.

Tested on 2d and 3d images.