The invention provides for a medical instrument comprising a magnetic resonance imaging system with an imaging zone. The magnetic resonance imaging system comprises a gradient coil system with three orthogonal gradient coils.The execution of the machine executable instructions causes a processor controlling the medical instrument to: repeatedly control the magnetic resonance imaging system with the calibration pulse sequence commands to acquire the magnetic resonance calibration data for multiples slices using at least one of the three orthogonal gradient coils to generate the slice select gradient magnetic field; compute a Fourier transform of the magnetic resonance calibration data for each of the voxels of the multiple slices in the phase encoding directions; compute an expansion of the Fourier transformed magnetic resonance calibration data into spherical harmonics; and calculate a three-dimensional gradient impulse response function for the at least one of the three orthogonal gradient coils using the expansion into spherical harmonics. The calibration pulse sequence commands are configured for acquiring magnetic resonance calibration data from a magnetic resonance imaging phantom within the imaging zone according to a calibration magnetic resonance imaging protocol with two-dimensional phase encoding perpendicular to a slice select gradient magnetic field. The calibration magnetic resonance imaging protocol is configured for acquiring slices divided into voxels by the two-dimensional phase encoding.