A simplified look...
Other contaminants which work their way into the supply chain can include wood, plastic and other solid non-metallic contaminants – all of which cannot be identified by metal detection. This is where x-ray detection comes into play.
A simplified look at how x-ray detection works for food and pharmaceutical applications.

Components of an x-ray system
(A) X-ray generator
(B) Detector
(C) Control system