A first and a second accumulated value calculating units are provided which, in a location where foil shadows by grid foil strips straddle pixels, identify this location based on geometry, and calculate straddle accumulated values of the foil shadows in the identified location. Even when the foil shadows by the grid foil strips straddle the pixels due to twisting and bending of the grid foil strips, such location is identified based on geometry and the straddle accumulated values of the foil shadows in the identified location are calculated. Therefore, even when changes are made in the pitches or pixel sizes of an X-ray grid and a flat panel X-ray detector (FPD), the foil shadows will be removed based on the straddle accumulated values. As a result, the foil shadows can be removed taking twisting and bending of the grid foil strips into consideration, and in a way to accommodate X-ray grids and FPDs of various sizes.