An imaging system is provided that includes a pixelated detector and a processing unit. The pixelated detector has individually read pixels. The processing unit is configured to count events detected by the detector unit using an energy window for each pixel. The energy window is individually tailored for each pixel, and is defined by an upper energy boundary corresponding to a higher energy level and a lower energy boundary corresponding to a lower energy level. At least one of the upper energy boundary or the lower energy boundary of the energy window is adjusted based on acquired events. The processing unit adjusts the at least one of the upper energy boundary or the lower energy boundary of the energy window for a given pixel before counting the events for the given pixel.