Image registration based on maximization of gradient code mutual information