Correcting spatial distortions and nonuniform response in area detectors