An exemplary method for correcting inhomogeneities of the static magnetic
field generated by the magnetic structure of a machine for acquiring
nuclear magnetic resonance images includes determining the number, the
position and the magnetic moment of dipoles compensating inhomogeneities
of the magnetic field to be positioned on a positioning grid such that a
function is minimized. The total magnetic moment of compensation dipoles
for compensating the magnetic field inhomogeneity can be minimized in
addition to minimizing a norm of the difference between an inhomogeneity
vector of each of the magnetic field components and the linear
combination of effect vectors corresponding to the magnetic field
component of compensation dipoles.