According to this invention, in order to obtain high-quality images even when the slice selective gradient magnetic fields waveform is distorted by eddy currents and vibration, high-frequency magnetic field information is calculated on the basis of an output gradient magnetic field waveform applied in accordance with the input gradient magnetic field waveform that is set in a pulse sequence, and the calculated high-frequency magnetic field information is set in the pulse sequence. Then, the set input gradient magnetic field, and the excitation RF pulses of the calculated high-frequency magnetic field information are used during imaging. The output gradient magnetic field waveform used in determining the excitation RF pulses is found by measurement and calculation, for example, by using the input gradient magnetic field waveform.