Imaging of transient magnetization gratings in nmr. analogies with laser-induced gratings and applications to diffusion and flow