Even if the amount of magnetic material pieces that can be placed at each position of the shim tray is limited, in order to achieve high magnetic field homogeneity, the distribution of the static magnetic field generated by the static magnetic field generating device is measured, and the distribution of the static magnetic field And the target magnetic field is calculated and the achievable magnetic field uniformity in the case where the magnetic material piece is arranged at one or more of the plurality of positions of the shim tray is calculated while varying the target magnetic field within the predetermined magnetic field range . A target magnetic field whose amount of magnetic material pieces at each position of the shim tray is equal to or less than a predetermined upper limit value and whose achievable magnetic field homogeneity is equal to or less than a predetermined value is selected and the arrangement of the magnetic material pieces corresponding to the target magnetic field and The amount is placed in the shim tray.