A switchable grating for phase contrast imaging comprising a reservoir with a medium and x-ray absorbing particles acoustically connected to a first ultrasound generator and a second ultrasound generator arranged along a side of the reservoir orthogonal to the first side. The ultrasound generators are each, individually or together, configured to generate a soundwave with a frequency and phase such that a standing wave is formed within the medium causing the x-ray absorbing particles to organize along pressure nodes of the standing waves.