A method of performing nuclear magnetic resonance imaging of a body, comprising: immerging said body in a static magnetic field for aligning nuclear spins along a magnetization axis exposing said body to a gradient pulse and to a transverse radio-frequency pulse for performing slice-selective excitation of said nuclear spins, thus flipping the nuclear spins of atoms contained within a slice of said body detecting a signal emitted by excited nuclear spins and reconstructing a magnetic resonance image of said slice of the body on the basis of the detected signal the method being characterized in that said radio-frequency pulse is constituted by a train of slice-selective elementary pulses, approximately equivalent to a train of elementary rectangular pulses with constant frequencies which are designed for compensating for inhomogeneity of the radio-frequency field within the body.