Multispectral photon-counting for medical imaging and beam characterization