Flat X-ray detectors require a systematic calibration and correction of image artifacts. Based on an analysis of the physics of the image generation chain, this work presents a unified framework for the correction of these artifacts. Algorithms for the correction steps are presented, including a new method for the calibration and correction of the intertwined offset, gain, and non-linearity as well as an improved method for the interpolation of defects, where the interpolation direction is chosen based on a novel method. Experiments using a hand phantom without and with a wire, imaged on a flat detector, demonstrate that line artifacts in Digital Subtraction Angiography (DSA) applications due to differences in non-linearity between adjacent amplifiers are significantly reduced by applying the non-linearity, offset, and gain correction in the correct order, as proposed in this work. For the defect interpolation investigations, we used medical images of angiographic image subtraction sequences, containing small vessels. Artificial clusters of pixel defects were added to these images and subsequently corrected. The experimental verification clearly demonstrates the robustness and superior performance of the new interpolation scheme, especially for clusters of defects.