A method of processing a diffraction pattern image obtained in an electron microscope, the method comprising: according to a first set of microscope conditions, causing an electron beam to impinge upon a calibration specimen so as to cause resulting electrons to be emitted therefrom and monitoring the resulting electrons using a detector device so as to obtain a calibration image comprising a plurality of pixels having values, the first set of microscope conditions being configured such that the calibration image includes substantially no electron diffraction pattern; obtaining, from the calibration image, a gain variation image comprising a plurality of pixels, each having a value representing relative detector device gain for a corresponding pixel of the calibration image, wherein obtaining the value of each pixel of the gain variation image comprises calculating an estimate of the relative detector device gain for a corresponding pixel of the calibration image; according to a second set of microscope conditions, causing an electron beam to impinge upon a target specimen so as to cause resulting electrons to be emitted therefrom and monitoring the resulting electrons using the detector device so as to obtain a target image comprising a plurality of pixels having values, the second set of microscope conditions being configured such that the target image includes an electron diffraction pattern; and for each pixel of the target image, removing from the pixel value, in accordance with the value of the corresponding pixel of the gain variation image, the contribution to the pixel value of the relative detector device gain, so as to obtain a gain variation-corrected image. according to a first set of microscope conditions, causing an electron beam to impinge upon a calibration specimen so as to cause resulting electrons to be emitted therefrom and monitoring the resulting electrons using a detector device so as to obtain a calibration image comprising a plurality of pixels having values, the first set of microscope conditions being configured such that the calibration image includes substantially no electron diffraction pattern; obtaining, from the calibration image, a gain variation image comprising a plurality of pixels, each having a value representing relative detector device gain for a corresponding pixel of the calibration image, wherein obtaining the value of each pixel of the gain variation image comprises calculating an estimate of the relative detector device gain for a corresponding pixel of the calibration image; according to a second set of microscope conditions, causing an electron beam to impinge upon a target specimen so as to cause resulting electrons to be emitted therefrom and monitoring the resulting electrons using the detector device so as to obtain a target image comprising a plurality of pixels having values, the second set of microscope conditions being configured such that the target image includes an electron diffraction pattern; and for each pixel of the target image, removing from the pixel value, in accordance with the value of the corresponding pixel of the gain variation image, the contribution to the pixel value of the relative detector device gain, so as to obtain a gain variation-corrected image.