Linear fitting of multi-threshold counting data with a pixel-array detector for spectral X-ray imaging.