A deformable grid approach for Bayesian image registration