Global optimization algorithms for image registration and clustering