Image reconstruction from an elastically distorted scan