K-edge energy-based calibration method for photon counting detectors