Motion Detection and Correction in Magnetic Resonance Imaging