1. A method to generate gain correction data for correcting a direct radiography or computed radiography image, the method comprising the steps of: exposing an x-ray detector to a substantially uniform x-ray beam to generate an x-ray image; converting the x-ray image into a digital image representation; using the digital image representation for calculation of the gain correction data; performing a statistical analysis on pixel values of at least one region of interest in the digital image representation; determining a presence of a source of x-ray beam inhomogeneity by comparing results of the statistical analysis with least one predetermined acceptance criterion; and using the digital image representation for the calculation of the gain correction data when it is determined in the determining step that no source of x-ray beam inhomogeneity is present; wherein the statistical analysis includes an evaluation of low and high histogram shoulders of a histogram of the pixel values in the region of interest determined relative to a center value in the histogram; the center value is a median, an average, or a modus value of the pixel values of the region of interest; and the method further comprises the step of determining a cause of the beam inhomogeneity by evaluating at least one significance level being determined by thresholding low and high shoulder fractions, the low and high shoulder fractions being determined as an amount of ROI-pixels with values below a low shoulder value divided by a total amount of ROI-pixels and an amount of ROI-pixels with values above a high shoulder value divided by the total amount of ROI-pixels.