An apparatus is provided that includes a digital processing circuit to obtain a digital signal corresponding to an output signal of a photon-counting detector determine, from the obtained digital signal, a plurality of X-ray photons received by the photon-counting detector during a measurement period determine a corresponding energy level of each of the plurality of X-ray photons determine, based on the corresponding energy level, a corresponding weight for each of the plurality of X-ray photons and calculate a sum of the corresponding weights of the plurality of X-ray photons.